Bug #796
Build static lib on windows with mingw64?
100%
Description
I am attempting to build exiv2 with the mingw32 and mingw64 cross-compiler. I am able to build a .a file but I cannot link with the .a file; I get unresolved externals:
Below is the error that I'm getting:
x86_64-w64-mingw32-g++ -g -D_FORTIFY_SOURCE=2 -Wall -D_FORTIFY_SOURCE=2 -Wall -Wno-format --static -mthreads -o bulk_extractor.exe bulk_extractor.o threadpool.o context_list.o histogram.o utils.o support.o base64_forensic.o feature_recorder.o feature_recorder_set.o image_process.o image_process_fts.o sbuf.o md5.o scan_ccns2.o scan_find.o scan_net.o scan_wordlist.o scan_exif.o scan_base64.o xml.o scan_zip.o scan_gzip.o scan_pdf.o scan_aes.o scan_json.o scan_winprefetch.o scan_hiberfile.o pyxpress.o scan_email.o scan_accts.o scan_kml.o scan_gps.o -lewf -lz -lpthreadGC2 -lws2_32 -lgdi32 -lexiv2 -lexpat scan_exif.o: In function `scan_exif': /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:168: undefined reference to `__imp__ZN5Exiv212ImageFactory4openEPKhl' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:169: undefined reference to `__imp__ZNK5Exiv25Image4goodEv' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:202: undefined reference to `__imp__ZNK5Exiv25Value8toStringEv' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:204: undefined reference to `__imp__ZNK5Exiv25Value8toStringEv' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:214: undefined reference to `__imp__ZNK5Exiv25Value8toStringEv' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:217: undefined reference to `__imp__ZNK5Exiv25Value8toStringEv' /home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:220: undefined reference to `__imp__ZNK5Exiv25Value8toStringEv' scan_exif.o:/home/simsong/domex/src/bulk_extractor/src/scan_exif.cpp:223: more undefined references to `__imp__ZNK5Exiv25Value8toStringEv' follow scan_exif.o: In function `Exiv2::LogMsg::setLevel(Exiv2::LogMsg::Level)': /usr/x86_64-w64-mingw32/sys-root/mingw/include/exiv2/error.hpp:116: undefined reference to `__imp__ZN5Exiv26LogMsg6level_E' collect2: ld returned 1 exit status make[2]: *** [bulk_extractor.exe] Error 1 make[2]: Leaving directory `/home/simsong/domex/src/bulk_extractor/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/simsong/domex/src/bulk_extractor' make: *** [all] Error 2
Here is the usage for the exiv2 configure:
$ ./configure --help `configure' configures exiv2 0.22 to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/exiv2] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-dependency-tracking speeds up one-time build --disable-visibility do not use symbol visibility support --disable-lensdata do not use the lens database for Nikon lens names --enable-commercial compile with the EXV_COMMERCIAL_VERSION symbol set --disable-xmp do not compile XMP support and the XMP Toolkit Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-zlib=DIR root directory path of zlib installation defaults to /usr/local or /usr if not found in /usr/local --without-zlib to disable zlib usage completely --with-expat[=DIR] use libexpat in DIR Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CXXCPP C++ preprocessor CC C compiler command CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to <ahuggel@gmx.net>. $
And here is the command I'm using to create exiv2:
./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32/sys-root/mingw --enable-static --without-libiconv-prefix
History
Updated by Robin Mills about 10 years ago
- Category set to build
- Assignee set to Robin Mills
- Target version set to 0.23
I'm going to investigate this. The pyexiv2 project would like a 64 bit GCC build of exiv2 (although the MSVC/x64/ReleaseDLL 64 bit build works fine with pyexiv2).
In what environment/platform are you issuing the ./configure commands? Are you cross-compiling from Linux, or are using MinGW/64 or what?
I don't want to guess the time required to get this fixed. If it's easy, it might be done in a day or two. However if it's troublesome, it'll probably have to be put to the side until Christmas (or possibly later).
Updated by Andreas Huggel about 10 years ago
Although for Android, there may be some general pointers for cross-compilation with the configure script here: http://dev.exiv2.org/boards/3/topics/768
Updated by Robin Mills over 8 years ago
- Target version set to 0.25
I wasn't able to cross compile this on my Ubuntu machine. Deferred for 0.25.
Updated by Robin Mills almost 7 years ago
- Status changed from Assigned to Resolved
I am now supporting MinGW (both 32 and 64 bit builds) on the build server. The build server runs on a Mac Mini and has virtual machines running Linux and Windows. I have been unable to build a static version of the library on MinGW.
This bug has been outstanding for 3 years and I'm marking it as "Resolved" with the sad reason of "cannot fix/will not fix".