ExifTool Forum

ExifTool => Developers => Topic started by: jamesYu on July 20, 2015, 08:33:03 PM

Title: ARM-Linux
Post by: jamesYu on July 20, 2015, 08:33:03 PM
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
Title: Re: ARM-Linux
Post by: Phil Harvey on July 20, 2015, 09:01:48 PM
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
Title: Re: ARM-Linux
Post by: jamesYu on July 20, 2015, 09:25:40 PM
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
Title: Re: ARM-Linux
Post by: jamesYu on July 21, 2015, 12:01:07 AM
Phil,

I have successfully compiled my program.
Thank you!

Regards,
James
Title: Re: ARM-Linux
Post by: jamesYu on July 21, 2015, 10:16:36 PM
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
Title: Re: ARM-Linux
Post by: jamesYu on July 21, 2015, 10:58:42 PM
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
Title: Re: ARM-Linux
Post by: Phil Harvey on July 22, 2015, 07:34:56 AM
Hi James,

None of those look like errors to me.

- Phil
Title: Re: ARM-Linux
Post by: jamesYu on July 23, 2015, 08:09:22 PM
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
Title: Re: ARM-Linux
Post by: Phil Harvey on July 23, 2015, 08:28:02 PM
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
Title: Re: ARM-Linux
Post by: jamesYu on July 23, 2015, 08:35:11 PM
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
Title: Re: ARM-Linux
Post by: Hayo Baan on July 24, 2015, 02:06:35 AM
James,

Without Perl on your system, there is no way you can get exiftool to work; it's completely written in Perl...
Title: Re: ARM-Linux
Post by: jamesYu on July 24, 2015, 03:28:05 AM
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
Title: Re: ARM-Linux
Post by: Phil Harvey on July 24, 2015, 06:58:35 AM
Exiv2 is what I would recommend.
Title: Re: ARM-Linux
Post by: jamesYu on July 24, 2015, 08:05:58 PM
Thanks Phil!

Thank you for all your help.
Take care always.

Regards,
James