Project

General

Profile

Errors related to Exiv2

Added by Giovanni Mugnai almost 9 years ago

Hi,

Today i've built exiv2 on Haiku.
I have all dependencies correctly installed (zlib, gettext, libiconv and expat).
Configure and make end fine, without errors. I found error when i try to compile applications which uses Exiv.
This is the full output of configure and make of Exiv: [[http://pastebin.com/dKj5eHx2]] as we can see there are no errors.
But I always get error about Exiv when i attempt to build applications which uses Exiv: [[http://pastebin.com/fSVw7KvQ]]
This is just an example, but the errors are always the same with every app which need exiv: i got errors about "undefined refernces" on exiv about compress2, crc32, libiconv and xml. All these others components (zlib, iconv, gettext and expat) are correctly installed on my system because i've used them for others things.

If i do make samples inside exiv2-0.23/samples folder I don't see nothing of strange.

What can i do?

Best regards.


Replies (11)

RE: Errors related to Exiv2 - Added by Giovanni Mugnai almost 9 years ago

I'm sorry for the double message; there was an error which tell me "internal error" so i have refreshed the page.

Regards.

RE: Errors related to Exiv2 - Added by Robin Mills almost 9 years ago

I've never worked with Haiku. I see you're using Qt. Before trying to work with Qt, let's make sure that you can link simple terminal programs. Here's what to do:

1) After you build, install the libraries
$ sudo make install
2) Build the samples
$ make samples
3) Run the test suite:
$ make tests
4) build and link some code:
$ mkdir little_test
$ cd little_test
$ g++ ../samples/exifprint.cpp -lexiv2 -o exiftest
$ ./exiftest ../test/data/smiley1.jpg

536 rmills@rmills-imac:~/gnu/exiv2/test.build $ mkdir little_test
537 rmills@rmills-imac:~/gnu/exiv2/test.build $ cd little_test
538 rmills@rmills-imac:~/gnu/exiv2/test.build/little_test $ g++ ../samples/exifprint.cpp -lexiv2 -o exiftest
539 rmills@rmills-imac:~/gnu/exiv2/test.build/little_test $ ./exiftest ../test/data/smiley1.jpg
Exif.Image.ImageDescription                  0x010e Ascii      45  Well it is a smiley that happens to be green
Exif.Image.XResolution                       0x011a Rational    1  72/1
Exif.Image.YResolution                       0x011b Rational    1  72/1
Exif.Image.ResolutionUnit                    0x0128 Short       1  2
Exif.Image.Software                          0x0131 Ascii      11  ImageReady
Exif.Image.DateTime                          0x0132 Ascii      21  2004-07-13T21:23:44Z
Exif.Image.Artist                            0x013b Ascii       7  No one
Exif.Image.Copyright                         0x8298 Ascii       1  
Exif.Image.ExifTag                           0x8769 Long        1  226
Exif.Photo.Flash                             0x9209 Short       1  80
Exif.Photo.PixelXDimension                   0xa002 Long        1  167
Exif.Photo.PixelYDimension                   0xa003 Long        1  140
540 rmills@rmills-imac:~/gnu/exiv2/test.build/little_test $ 

Here are my notes about linking Exiv2 and Qt: [[http://clanmills.com/exiv2/qt.shtml]]

Exiv2 works with Qt on most platforms: Mac/Linux/Windows: MinGW and Visual Studio. Exiv2 works fine on Cygwin, however Qt has difficulty with Cygwin. There have been about 10 threads in the last couple of years concerning Qt and Exiv2 and all have been successfully resolved. It may be worth using the "search" box on the forum and you'll draw inspiration from another case!

Let me know what progress you make. I see there is a live CD available for Haiku. If you're still stuck, I'll have a play with Haiku and maybe I can fix this for you.

Robin

RE: Errors related to Exiv2 - Added by Giovanni Mugnai almost 9 years ago

Hi Robin,

first of all many thanks for interest.. You are very gentle!

I can run Exiv2 binaries to read images exif data: [[http://pastebin.com/bfCtrqAa]] As i've said, i have successfully compiled Exiv2, since it works as expected.. The only thing is seems that i cannot use Exiv2 to build QT apps which need Exiv2.
In anyway about Haiku: is a standard Unix like operating system, so it uses GCC4 as compiler and has most common bash CLI.. Here i have also pkgconfig and include files, and i can see, again, that Exiv2 is correctly installed :-)

Best regards.

RE: Errors related to Exiv2 - Added by Robin Mills almost 9 years ago

Giovanni

There's not much wrong here! The pastebin you've just sent is strong evidence that your build is good. [[http://pastebin.com/bfCtrqAa]]

I've copied the output from your linking errors [[http://pastebin.com/fSVw7KvQ]], and grep for 'undefined':

502 rmills@rmills-imac:~/temp $ grep undefined foo.txt
pngchunk.cpp:(.text+0x463): undefined reference to `compress2'
pngchunk.cpp:(.text+0x5c1): undefined reference to `uncompress'
pngchunk.cpp:(.text+0xbf5): undefined reference to `crc32'
pngchunk.cpp:(.text+0xc06): undefined reference to `crc32'
pngchunk.cpp:(.text+0x110e): undefined reference to `crc32'
pngchunk.cpp:(.text+0x111f): undefined reference to `crc32'
types.cpp:(.text+0x109b): undefined reference to `libintl_bindtextdomain'
types.cpp:(.text+0x10b1): undefined reference to `libintl_dgettext'
convert.cpp:(.text+0x96f5): undefined reference to `libiconv_open'
convert.cpp:(.text+0x97a6): undefined reference to `libiconv'
convert.cpp:(.text+0x99c5): undefined reference to `libiconv_close'
ExpatAdapter.cpp:(.text+0x15a): undefined reference to `XML_Parse'
ExpatAdapter.cpp:(.text+0x3bc): undefined reference to `XML_ParserFree'
ExpatAdapter.cpp:(.text+0xbe2): undefined reference to `XML_ParserCreateNS'
ExpatAdapter.cpp:(.text+0xbf9): undefined reference to `XML_SetUserData'
ExpatAdapter.cpp:(.text+0xc13): undefined reference to `XML_SetNamespaceDeclHandler'
ExpatAdapter.cpp:(.text+0xc2d): undefined reference to `XML_SetElementHandler'
ExpatAdapter.cpp:(.text+0xc3f): undefined reference to `XML_SetCharacterDataHandler'
ExpatAdapter.cpp:(.text+0xc59): undefined reference to `XML_SetCdataSectionHandler'
ExpatAdapter.cpp:(.text+0xc6b): undefined reference to `XML_SetProcessingInstructionHandler'
ExpatAdapter.cpp:(.text+0xc7d): undefined reference to `XML_SetCommentHandler'
503 rmills@rmills-imac:~/temp $ 

Your analysis is correct. These entry points are in libz, libiconv and libxmp. There must be something inconsistent between how exiv2/samples link and Qt/QMake's linking.

I see you've built the shared libraries. Good! It's unlikely to be shared/static library mismatch. (I think Qt will want to link shared libraries). So several thoughts:

  1. Are you certain that libz.so (and xmp and iconv) are visible to the linker. You might need to add -L/usr/local/lib or something to your qmake file.
  2. Look in the file /usr/local/lib/libexiv2.la. It has magic used by libtool to link from exiv2 to other libraries.
  3. Can you link a simple program that only uses libz (or libxmp or libiconv) from Qt. (use the code from the {libz|libxmp|libiconv} samples)
  4. Does your linker have a flag to say "verbose trace"? (I don't see that on the Mac's ld man page).

Some other ideas:
If you've built from the trunk, you can use the command $ exiv2 -v -V (or: --verbose --version) to see what's being loaded at run-time. The code to handle -v -V is platform specific and may not work on Haiku.

The Linux command ldd is useful for sniffing into the dynamic loader.

Rename /usr/lib/libz.so (and the other suspects) and relink from Qt. Do you get errors? Rebuild exiv2. Errors?

It's 22:45 here in California, and I'm about to go to bed. If you're still stuck, I'll get the Live CD for Haiku and look at this after work tomorrow. We'll fix this, you'll see.

Robin

RE: Errors related to Exiv2 - Added by Giovanni Mugnai almost 9 years ago

Hi Robin,

I have some news about.
First of all libz, libiconv and other libraries are correctly linked, because in past i have succesfully built QT applications which need them.
But today i have found a thing about Exiv2 compiling. As we can see the undefined references come from "pngchunck.cpp" "types.cpp" and "ExpadAdapter.cpp"
I have tried to ifdef'ing these references in this way:

#ifndef _HAIKU_
code related to compress2, uncompress, crc32
#endif

Then if I recompile Exiv2 with these mods, i no longer get errors about compress2, uncompress and crc32!

But this workaround works only for the file "pngchunk.cpp". If i attempt to add "#ifndef HAIKU" to other files with undefined references:

types.cpp:(.text 0x109b): undefined reference to `libintl_bindtextdomain'
types.cpp:(.text 0x10b1): undefined reference to `libintl_dgettext'
convert.cpp:(.text 0x96f5): undefined reference to `libiconv_open'
convert.cpp:(.text 0x97a6): undefined reference to `libiconv'
convert.cpp:(.text 0x99c5): undefined reference to `libiconv_close'
ExpatAdapter.cpp:(.text 0x15a): undefined reference to `XML_Parse'
ExpatAdapter.cpp:(.text 0x3bc): undefined reference to `XML_ParserFree'
ExpatAdapter.cpp:(.text 0xbe2): undefined reference to `XML_ParserCreateNS'
ExpatAdapter.cpp:(.text 0xbf9): undefined reference to `XML_SetUserData'
ExpatAdapter.cpp:(.text 0xc13): undefined reference to `XML_SetNamespaceDeclHandler'
ExpatAdapter.cpp:(.text 0xc2d): undefined reference to `XML_SetElementHandler'
ExpatAdapter.cpp:(.text 0xc3f): undefined reference to `XML_SetCharacterDataHandler'
ExpatAdapter.cpp:(.text 0xc59): undefined reference to `XML_SetCdataSectionHandler'
ExpatAdapter.cpp:(.text 0xc6b): undefined reference to `XML_SetProcessingInstructionHandler'
ExpatAdapter.cpp:(.text 0xc7d): undefined reference to `XML_SetCommentHandler'

These errors won't gone away. Maybe i'm adding #ifndef HAIKU in the wrong way?

Best regards.

RE: Errors related to Exiv2 - Added by Robin Mills almost 9 years ago

You can enable/disable PNG (zlib) XMP (expat) and NLS and INTL (iconv) support in exv_conf.h. Two words of caution:

1 The file exv_conf.h is a generated file!
- it's regenerated from config/config.h on every compile, so edit config/config.h
http://dev.exiv2.org/issues/849
- every time you run ./configure you'll recreate config/config.h
- config/config.h is generated by config/configure.ac (only brave people ever go there)
So put your #ifdef HAIKU code into config/config.h DONT RERUN ./configure, and you'll make progress.

2 I'm not totally confident that #ifdef HAVE_xxx and #ifdef ENABLE_xxx are robust
- Our "normal" build is to assume XMP/EXPAT/ZLIB/NLS/ICONV are available
- You might be in for some frustration.

I'm at work now. I'll have a look at the Haiku LiveCD this evening.

Robin

RE: Errors related to Exiv2 - Added by Giovanni Mugnai almost 9 years ago

Hi Robin.

you are a wizard!!

With your workaround i have solved!!

Thank you very very much!

RE: Errors related to Exiv2 - Added by Giovanni Mugnai almost 9 years ago

In anyway, to be more complete i have also tried to build Exiv2 without disabling PNG (zlib) XMP (expat) and NLS and INTL (iconv), but keeping inserted #ifdef HAIKU inside config.h.
Still works ok!
Maybe this could be the start for a patch? :-)

Thank you again, Robin!

RE: Errors related to Exiv2 - Added by Robin Mills almost 9 years ago

Happiness is a happy user. Two Happy Users on Tuesday - you and Mick.

Yes, please send your code and I'll review and submit it. Please create the patch with:

$ cd <exiv2dir>
$ svn diff -q > Forum1456.patch

You'll see code in configure.ac about Cygwin and MinGW. That might be the place to fix things - but maybe not! A simpler place is in src/makefile. You'll see there's a sed command to modify exv_conf.h, and you can probably add something to respect haiku. That's a nice place, because I'll have to port your fix to the CMake build environment.

If you want to write some notes about "Building on HAIKU (with/without Qt)", I'll review/polish and link them here: [[http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform]]

Bottom line: Please give me what you have, and I'll review/polish/submit/publish. You can review my changes when I'm done. It'd be especially great if you could validate the CMake build on Haiku. I'll probably open a bug about "Build Support for HAIKU" to track HAIKU related issues.

Robin

RE: Errors related to Exiv2 - Added by Giovanni Mugnai over 8 years ago

Hi Robin,

sorry for delay, but i was busy.

I am not able to make the diff file, i don't know why.. If i do svn diff -q > Forum1456.patch i get

Subcommand 'diff' doesn't accept option '-q [--quiet]'
Type 'svn help diff' for usage.

Why?

RE: Errors related to Exiv2 - Added by Robin Mills over 8 years ago

My mistake. The command should is: $ svn diff > Forum1456.patch

I use the command $ svn status -q to see what files are going to be written. It shows you the status of your svn tree.

Robin

    (1-11/11)