Main Menu

ARM-Linux

Started by jamesYu, July 20, 2015, 08:33:03 PM

Previous topic - Next topic

jamesYu

Good Day Phil,

First of all thank you for your Tool (ExifTool), it helped me a lot.
Anyway, here's my problem below. Will you help me with this?
When I compile it with your Makefile it is Okay, but when I compile using arm-linux-gnueabihf-g++ and I have made my own Makefile I get this error below. Thank you in advance!

<<<<This is my error message when I compile it with arm-linux-gnueabihf-g++>>>>>>

/usr/local/arm-2013.11/bin/arm-linux-gnueabihf-g++ -g -I/home/iornman/work/inc -I/home/iornman/work/src/include -I/include  -c -fmessage-length=0 -Wold-style-cast -Woverloaded-virtual -o cphoto.o cphoto.cpp
cphoto.cpp:20:22: fatal error: ExifTool.h: No such file or directory
#include "ExifTool.h"

<<< I will attached my source code and Makefile here >>>>>>>>>>>
<<< Here's my source code (can't attached two files) >>>>>>>>>
#include <iostream>
#include <stdio.h>
#include "ExifTool.h"
using namespace std;


void usage(){
   fprintf(stderr,
      "usage:\n"
       "Help command:\n"
      "   cphoto v1.00 07192015\n"
      "   syntax cphoto [FILE]\n"
      "   --help                      show this help\n"
       "\n"   
   );
}

void GetImageMetaData(string InputFile){
//FILE *pfile;

const char *FileName = InputFile.c_str();
ExifTool *et = new ExifTool();
TagInfo *info = et->ImageInfo(FileName,NULL,5);         // read metadata from the image ("use -b option to extract thumbnailImage)
    if (info){
    //pfile = fopen("file.txt","wr");   
   for (TagInfo *i=info; i; i=i->next){
   //cout << i->name << " = " << i->value << endl;
   printf("%s = %s\n",i->name,i->value);      // read metadata from the image
    }
    //fclose(pfile);
    delete info;                  // deleting the information when done
    } else if (et->LastComplete() <= 0) {
        cerr << "Error executing exiftool!" << endl;
    }
    char *err = et->GetError();               // print exiftool stderr messages
    if (err) cerr << err;
    delete et;                        // delete ExifTool object
}

int main(int argc, char **argv)
{
   
   if( argc <= 1 ){
   usage();
   return 0;   
   }   
   string argcomp = argv[1];
   if(argcomp == "--h"){
   usage();   
   }
   if ( argc == 2){
   GetImageMetaData(argv[1]);
   }else{
   cout << "parameter error\n";   
   }

return 0;
}

<<<<<<<<<<<<< THANKS >>>>>>>>>>>>>>>>>>>



Thank you!
Best Regards,
James

Phil Harvey

Hi James,

I think you're talking about the C++ interface for ExifTool.

The problem is that ExifTool.h isn't in your include path somewhere.  Add a compiler -I option with the proper directory to fix this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jamesYu

Phil,

I have revised my Makefile.
now I'm close to compile my code to arm-linux-gnueabihf-g++.
The only problem is I got this error below.

<<<< Error Message >>>>>

/usr/local/arm-2013.11/bin/arm-linux-gnueabihf-g++ -O3 -Wall -Werror -I/home/iornman/work/MyPhoto/src -I/home/iornman/work/MyPhoto/inc/include -I/include  -c -fmessage-length=0 -Wold-style-cast -Woverloaded-virtual -o cphoto.o cphoto.cpp

cc1plus: out of memory allocating 3355443200 bytes after a total of 466944 bytes
make: *** [cphoto.o] Error 1


<<<<< END >>>>

I have no idea yet why it run out of memory when I compiled it.
Anyway, I will attached my Makefile.
Thank you for your quick response.

- James

jamesYu

Phil,

I have successfully compiled my program.
Thank you!

Regards,
James

jamesYu

Hi Phil Harvey,

Please help me on this. I used -Wall and -Werror flags and I got this error message below.
I think the problem is related to your ExifTool library.


<<<<<<<<< ERROR MESSAGE >>>>>>>>>>>>>>

/usr/local/cross-tool/bin/arm-linux-gnueabihf-g++  -O3 -Wall -Werror -I/home/iornman/work/MyPhoto/inc -I/home/iornman/work/MyPhoto/src/include -I/include  -c -fmessage-length=0 -Wold-style-cast -Woverloaded-virtual -o cphoto.o cphoto.cpp
/usr/local/cross-tool/bin/arm-linux-gnueabihf-g++  -O3 -Wall -Werror -I/home/iornman/work/MyPhoto/inc -I/home/iornman/work/MyPhoto/src/include -I/include  -c -fmessage-length=0 -Wold-style-cast -Woverloaded-virtual -o src/ExifTool.o src/ExifTool.cpp
In file included from /home/iornman/work/MyPhoto/inc/ExifTool.h:18:0,
                 from src/ExifTool.cpp:26:
/home/iornman/work/MyPhoto/inc/ExifToolPipe.h: In member function 'char* ExifToolPipe::GetString()':
/home/iornman/work/MyPhoto/inc/ExifToolPipe.h:27:78: error: use of old-style cast [-Werror=old-style-cast]
     char  * GetString() { return (mString && mString[0]) ? mString : (char *)0; }
                                                                              ^
In file included from src/ExifTool.cpp:26:0:
/home/iornman/work/MyPhoto/inc/ExifTool.h: In constructor 'ExifTool::ExifTool(const char*, const char*)':
/home/iornman/work/MyPhoto/inc/ExifTool.h:80:19: error: 'ExifTool::mCmdQueueSize' will be initialized after [-Werror=reorder]
     int           mCmdQueueSize;// size of command queue
                   ^
/home/iornman/work/MyPhoto/inc/ExifTool.h:76:19: error:   'int ExifTool::mWatchdog' [-Werror=reorder]
     int           mWatchdog;    // watchdog process ID
                   ^
src/ExifTool.cpp:121:1: error:   when initialized here [-Werror=reorder]
ExifTool::ExifTool(const char *exec, const char *arg1)
^
src/ExifTool.cpp:168:48: error: use of old-style cast [-Werror=old-style-cast]
         execvp(args[firstArg], (char * const *)args + firstArg);
                                                ^
src/ExifTool.cpp: In destructor 'virtual ExifTool::~ExifTool()':
src/ExifTool.cpp:213:9: error: unused variable 'cmdNum' [-Werror=unused-variable]
     int cmdNum = Command("-stay_open\nfalse\n");
         ^
cc1plus: all warnings being treated as errors
make: *** [src/ExifTool.o] Error 1


<<<<<<<<<  END >>>>>>>>>>>>>>>>>

Thank you in advance!

Regards,
James

jamesYu

Phil,

I have a found a thread here related to arm cross compilation below.
-> https://exiftool.org/forum/index.php?topic=2125.0

I have no idea why it cannot compile to arm-linux-gnueabihf-g++?
I have posted the error above.

Thanks!
Regards,
James

Phil Harvey

Hi James,

None of those look like errors to me.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jamesYu

Phil,

thanks for your info.
anyway it compiled but when I used to extract the image on arm board it won't succeed.
Do I need to run a Perl Makefile.PL on the board?

Thanks
Regards,
James

Phil Harvey

No.  The Perl part doesn't need to be compiled.  You just need to be sure that the C++ interface can find the executable, and that the lib directory exists in the same location.  I suggest using this form of the constructor to be safe (setting the proper directories for your arm system):

ExifTool *et = new ExifTool("/usr/bin/perl", "/usr/local/bin/exiftool");

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jamesYu

Phil,


problem is I have no perl in the usr/bin/ directory.
is there a chance to run the lib in another way?

Thanks,
Regards,
James

Hayo Baan

James,

Without Perl on your system, there is no way you can get exiftool to work; it's completely written in Perl...
Hayo Baan – Photography
Web: www.hayobaan.nl

jamesYu

Hi Hayo,

Do you have any suggestions what alternative library to use?
I'm currently studying Exiv2 library.

anyway, thank you for your help.

Regards,
James

Phil Harvey

Exiv2 is what I would recommend.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jamesYu

Thanks Phil!

Thank you for all your help.
Take care always.

Regards,
James