Project

General

Profile

How to compile exiv2 in windows used mingw

Added by Anonymous over 10 years ago

How can I compile exiv2 in windows used mingw or how can I get libexiv2-5.dll.
I try use MSYS to do it but when I do make it show:
$ make
if test "x1" = "x1"; then cd xmpsdk/src && c:/MinGW/bin/make xmpsdk; fi;
make1: Entering directory `C:/MSYS/z/dev/exiv2/xmpsdk/src'
Xinclude DEXV_HAVE_STDINT_H=1 -c -o XML_Node.o XML_Node.lo
C:\MSYS\z\dev\exiv2\libtool: compile: warning: libobj name `include -DEXV_HAVE_STDINT_H=1 -c -o XML_Node.o XML_Node.lo' may not contain shell special characters.
rm: invalid option -
D
Try `rm --help' for more information.
C:\MSYS\z\dev\exiv2\libtool: compile: g++ O2 -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -MMD -I. -I/z/dev/zlib//include "-DEXV_LOCALEDIR=\\/usr/local/share/locale\" -I../include -funsigned-char -DNDEBUG=1 -I/z/dev/expat//include -DEXV_HAVE_STDINT_H=1 -c -o XML_Node.o XML_Node.cpp" -o include -DEXV_HAVE_STDINT_H=1 -c -o XML_Node.o XML_Node.o
g++.exe: XML_Node.o: No such file or directory
g++.exe: no input files
rm: invalid option -
D
Try `rm --help' for more information.
make1: * [XML_Node.o] Error 1
make1: Leaving directory `C:/MSYS/z/dev/exiv2/xmpsdk/src'
make: *
[xmpsdk] Error 2


Replies (6)

RE: How to compile exiv2 in windows used mingw - Added by Anonymous over 10 years ago

I compile exiv2 for windows.
But when I link my program with libexiv2.a I get errors:
undefined reference to '_img___N5Exiv212ImageFactory4openERKSs'
undefined reference to '_img___N5Exiv25Value8tostringEv'
What is this or where is my mistake?

RE: How to compile exiv2 in windows used mingw - Added by Robin Mills over 10 years ago

Aleksandr:

I've just built the library sample/exifprint using the terminal.

$ tar xf exiv2-0.21.1.tar.gz
$ cd exiv2-0.21.1
$ ./configure --disable-visibility
$ make clean
$ make
$ make install
$ cd samples
$ g++ -c exifprint.cpp -o exifprint.o -I/usr/local/include
$ g++ exifprint.o -o exifprint.exe -lexiv2 -L/usr/local/lib
$ cp /usr/local/bin/*.dll .
$ ./exifprint.exe /c/Users/rmills/R.jpg

Copying the dlls from /usr/local/bin isn't nice. Much better to extend the PATH:

$ del *.dll
$ export PATH=$PATH:/usr/local/lib:/usr/local/bin
$ ./exifprint.exe  ~/R.jpg
I'm sure there's an environment string (or something) to avoid the inconvenience of:
  1. -I/usr/local/include on the compilation of exifprint.cpp
  2. -L/usr/local/lib on the link of exifprint.exe

There was a discussion earlier this year about using QtCreator (which uses the MinGW toolchain). QtCreator provides a nice IDE. You'll have to specify the include and library path's is in the .pro file:

win32 {
    DEFINES      += __WINDOWS__=1
    INCLUDEPATH  += $$quote(C:/MinGW/msys/1.0/local/include)
    LIBS         += $$quote(C:/MinGW/msys/1.0/local/lib/libexiv2.dll.a)
}

http://dev.exiv2.org/boards/3/topics/773

I hope that helps.

Robin

RE: How to compile exiv2 in windows used mingw - Added by Anonymous over 10 years ago

So, I solve problem.
I use in Linux:
./configure --prefix=/usr/i586-mingw32msvc
make
And use libexiv2-10.dll
But how to use static library I don't know.

RE: How to compile exiv2 in windows used mingw - Added by Robin Mills over 10 years ago

Aleksandr

I haven't understood what Linux has to do with this.

You'll have to build/install the static version of the library (its dependents expat and zlib and probably libiconv and libintl). To build the static exiv2 library:

$ ./configure --enable-static --disable-shared --disable--visibility
$ make clean ; make ; make install

Then compile and link:
$ g++ -c exifprint.cpp -o exifprint.o -I/usr/local/include
$ g++ exifprint.o -o exifprint.exe -lexiv2 -lexpat -liconv -lz -lintl -L/usr/local/lib
$ ls -alt *.exe
-rwxr-xr-x+ 1 rmills root 2397209 May 27 10:18 exifprint.exe

I've build the stuff above on Cygwin because I don't have MinGW on my office machine. The build on Linux/Mac/Cygwin/MinGW all use the autotools and ought to be the same on all platforms.

Please be aware that you have only linked the static version of exiv2 - you have still linked the DLLs for some of the other libraries. There's a little utility msvc/depends2.exe which reveals the DLLs required by a program (the source is in the exiv2 repository).

$ ../msvc/depends2.exe exifprint.exe
cygexpat-1.dll
cygstdc++-6.dll
cygz.dll
cygintl-8.dll
cyggcc_s-1.dll
cygiconv-2.dll
Secur32.dll
RPCRT4.dll
ntdll.dll
KERNEL32.dll
ADVAPI32.DLL
cygwin1.dll
exifprint.exe
$

If you wish to link with another static library (eg /usr/local/lib/libexpat.a), you can declare it when you link. As you'll see below, this has removed the depenancy of exifprint.exe on cygexpat-1.dll and made exifprint.exe larger.

$ g++ exifprint.o -o exifprint.exe -lexiv2 /usr/local/lib/libexpat.a -liconv -lz -lintl -L/usr/local/lib
$ ls -alt exifprint.exe
-rwxr-xr-x+ 1 rmills root 2735438 May 27 10:37 exifprint.exe
$ ../msvc/depends2.exe  exifprint.exe
cygstdc++-6.dll
cygz.dll
cygintl-8.dll
cyggcc_s-1.dll
cygiconv-2.dll
Secur32.dll
RPCRT4.dll
ntdll.dll
KERNEL32.dll
ADVAPI32.DLL
cygwin1.dll
exifprint.exe
$

If I still haven't answered your question, then please provide more information about what you are doing.

RE: How to compile exiv2 in windows used mingw - Added by Anonymous over 10 years ago

Many thanks for the help.

    (1-6/6)