2011/10/2 Simson Garfinkel <simsong(a)acm.org>:
> Date: Sat, 1 Oct 2011 20:30:46 +0200
> From: Kai Tietz <ktietz70(a)googlemail.com>
> Subject: Re: weird linking errors with exiv2
> To: "Fedora MinGW (Windows cross-compiler) project"
> <mingw(a)lists.fedoraproject.org>
> Cc: ahuggel(a)gmx.net
> Message-ID:
> <CAEwic4aBk0arJYrxc-suedToUAE24cFtjeC4A_8sOL1Sna1U4g(a)mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> So is libexiv2.a a static library or an DLL import library?
>
> As far as I can see are just __imp_ symbols undefined. If libexiv2.a
> is an static library, then they are of course not present. Might it
> be that there is also an libexiv2.dll.a import-library?
>
> Regards,
> Kai
Kai,
Thanks for your email.
In fact, I did have both the .dll and the static library:
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libexiv2.a
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libexiv2.dll.a
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libexiv2.la
As a reminder, my link command says "--static":
> 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
I removed the library:
$ sudo /bin/rm /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libexiv2.dll.a
$ sudo /bin/rm /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libexiv2.la
And got the same error:
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
This really has me stumped. My only recourse seems to be to find another exif library.
Well, you could Use also on command line simply -Wc,lexiv2.dll option.
By this you are choosing always the shared variant (which is used in
scan_exif.cpp source via dllimport). By this the link-failures should
be gone.
Not sure about it, but for testing you might want to remove the
libexiv2.la file.
Another way to solve this, so that you are able to use static version
here, is to make sure that in scan_exif.cpp for imported libexiv2 API
no dllimport attribute gets specified.
Regards,
Kai