Exiv2 compilation under mingw32
Added by Jos De Laender 80 days ago
Dear all,
I'm using the exiv2 library in a raw convertor of mine.
While porting this application to Windows, I got completely stuck with compiling Exiv2 under mingw32 (TDM-2 mingw32) gcc 4.4.1.
I got errors along the lines that follow.
Did someone actually succeed in compiling this with a similar configuration ? Any hints appreciated.
I realize it might be as well a mingw32 issue, or even more likely a combination of issues in mingw and in exiv2.
Additional info :
- It does compile all very well under linux.
- It used to compile with some older mingw32 (but I think this was still based on gcc 4.3.X)
Thanks for your help and/or referrals.
Jos
if test "x1" = "x1"; then cd xmpsdk/src && make xmpsdk; fi;
make1: Entering directory `/c/jdlRaw/exiv2-0.18.2/xmpsdk/src'
g++ -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -MMD -I. -DEXV_LOCALEDIR=\"/mingw/share/locale\" -I../include -funsigned-char -DNDEBUG=1 -DEXV_HAVE_STDINT_H=1 -c XMPMeta.cpp -DDLL_EXPORT -DPIC -o .libs/XMPMeta.o
XMPMeta.cpp:32: warning: ignoring #pragma warning
XMPMeta.cpp:33: warning: ignoring #pragma warning
XMPMeta.cpp:34: warning: ignoring #pragma warning
XMPMeta.cpp:35: warning: ignoring #pragma warning
In file included from XMPMeta.cpp:23:
c:\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/cstdio:165: error: '::snprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/cstdio:176: error: '__gnu_cxx::snprintf' has not been declared
XMPMeta.cpp: In function 'XMP_Status DumpNodeOptions(XMP_OptionBits, XMP_Status ()(void, const char*, XMP_StringLen), void*)':
XMPMeta.cpp:179: error: 'snprintf' was not declared in this scope
XMPMeta.cpp: In function 'XMP_Status DumpPropertyTree(const XMP_Node*, int, size_t, XMP_Status ()(void, const char*, XMP_StringLen), void*)':
XMPMeta.cpp:219: error: 'snprintf' was not declared in this scope
XMPMeta.cpp: In static member function 'static bool XMPMeta::Initialize()':
XMPMeta.cpp:578: warning: unused variable 'flag'
XMPMeta.cpp: In static member function 'static bool XMPMeta::RegisterNamespace(const char*, const char*, const char**, XMP_StringLen*)':
XMPMeta.cpp:902: error: 'snprintf' was not declared in this scope
make1: *** [XMPMeta.o] Error 1
make1: Leaving directory `/c/jdlRaw/exiv2-0.18.2/xmpsdk/src'
make: *** [xmpsdk] Error 2
Replies
RE: Exiv2 compilation under mingw32 - Added by Robin Mills 79 days ago
Jos
I'll look at this after Christmas. Happy Holidays to you and your family.
RE: Exiv2 compilation under mingw32 - Added by Jos De Laender 79 days ago
Dear,
Thanks for your prompt reply.
Some further feedback.
This feedback is pointing largely to the build environment rather than exiv2 but nevertheless prevents me from building smoothly.
So what have I now :
1. I took Qt (open source gui toolkit) which includes a mingw32 with gcc 4.4.0 compiler environment.
2. MSYS as 'shell' and elementary tools.
3. Latest released exiv2.
The errors are the same as with the TDM-mingw32, and I could get rid of it by :
1.Changing the 'include <cstdio>' by 'include <stdio.h>' in XMPMeta.cpp
2.Pasting all the #defines at the end of config.log generated by ./configure into config/config.h.
I would agree that both are probably mingw related issues or even mingw bugs.
The second case seems at least on my machine somehow consistent : config.h or alike is not generated by ./configure.
Again, while this doesn't point into an exiv2 issue, it looks like exiv2 can't be build on a recent standard mingw / gcc 4.4.0 environment ?
I would be interested in experiences of people that did succeed.
Once more thanks for the efforts on this program. And best wished to you as well.
Jos
RE: Exiv2 compilation under mingw32 - Added by Jos De Laender 79 days ago
Dear,
Most of the issues were generated because I ran apparently in a known issue when decompressing exiv2 via WinZip :
http://sourceforge.net/tracker/index.php?func=detail&aid=2894666&group_id=2435&atid=102435
When I decompress via the MSYS shell, the whole issue with having to paste config.log => config.h disappears. The configuration works OK then.
The first issue ( resolved by changing the 'include <cstdio>' by 'include <stdio.h>' in XMPMeta.cpp ) stays though.
My feeling is it is a mingw/msys issue as well, but I don't find it.
Again , if someone was able to compile completely without changing exiv2 under mingw/msys (with a gcc 4.4.X compiler), I would appreciate the feedback.
Best regards,
Jos
RE: Exiv2 compilation under mingw32 - Added by Andreas Huggel 79 days ago
Hi Jos,
I think this is #653, Exiv2 0.18.2 doesn't compile with gcc 4.4
The bug is fixed in the trunk but that has some other issues on MinGW/MSYS which I'll resolve in the next few days.
For now, I suggest you either fix the problem locally by adding the missing #includeS or use gcc 3.4.5 on MinGW/MSYS.
Andreas
RE: Exiv2 compilation under mingw32 - Added by Jos De Laender 79 days ago
Andreas,
I need gcc 4.4 so I will resolve locally right now.
Is there any value in me trying the latest one on the trunk under MinGW/MSYS with gcc 4.4 and reporting back ?
Or do you prefer me to just wait and see ?
By the way : thanks for a great program !
Jos
RE: Exiv2 compilation under mingw32 - Added by Andreas Huggel 79 days ago
Jos,
Yes please try and report back if you run into issues! I'm still using the old version 3.4.5 right now.
The configuration for iconv needs work, you might need to manually undefine EXV_HAVE_ICONV in src/exv_conf.h, then run "make clean; make" in the src directory again. But do that only if you really encounter an iconv-related problem.
Andreas
RE: Exiv2 compilation under mingw32 - Added by Andreas Huggel 78 days ago
The configuration for iconv needs work, you might need to manually undefine EXV_HAVE_ICONV
That should be fixed now, pls update to r1965
RE: Exiv2 compilation under mingw32 - Added by Jos De Laender 78 days ago
Andreas,
I saw that the XMPMeta.cpp is altered bringing in the #include <stdio.h>
Still on my mingw32 (TDM-Mingw32 again) this is of no help.
I still have to comment the #include <cstdio>.
I'm not sure it is a exiv2 bug, but again, it doesn't build off the shelf on a 'popular' mingw32.
Best regards,
Jos
RE: Exiv2 compilation under mingw32 - Added by Andreas Huggel 77 days ago
Hi Jos,
If the fix is so simple, we should just do it. I'm not sure if I understand correctly what you modified though. I've done this: http://dev.exiv2.org/repositories/diff/exiv2?rev=1971 and it works on Mac OSX (gcc 4.2.1) and Linux (gcc 4.4.2), I'll test with my old MinGW gcc 3.4.5 and MSVC 9 tomorrow.
Can you pls confirm if this is what you meant? Does the trunk compile on your MinGW installation with this change?
Thanks,
Andreas
RE: Exiv2 compilation under mingw32 - Added by Andreas Huggel 77 days ago
...and now I've also realized that XMPMeta.cpp includes <stdio.h> not twice, but three times(!), so I've removed two of them. Only tested on Mac OSX.
RE: Exiv2 compilation under mingw32 - Added by Jos De Laender 77 days ago
Andreas,
Yes, just substituting <cstdio> by <stdio.h> as you did, works on my TDM-MinGW32.
Including it once should be ok ;).
I cannot confirm if it works on other platforms, but you seem to be checking and it looks good.
Thanks,
Jos