Installing delegate (libfpx) on Ubuntu 12.04 fails

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Antonio19
Posts: 6
Joined: 2013-09-19T17:10:46-07:00
Authentication code: 6789

Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by Antonio19 »

I downloaded libfpx-1.3.1-3.tar.gz from the ImageMagick FTP server for delegates. I made a ./configure --prefix=/usr
then a make to compile the source, then a package through checkinstall --install=no . Everything went fine. I later made my own Debian package using the Debian directory /usr/lib/x86_64-linux-gnu instead of /usr/lib from checkinstall. This directory contains the shared library libfpx.so.1.0.31 and a symlink libfpx.so.1 pointing to it as well. I did add a postinst and postrm (for ldconfig) in the DEBIAN dir.

I made a separate libfpx-dev package containing the include files fpxlib.h and fpxlib-config.h in /usr/include/libfpx and 2 symlinks in /usr/include , the static library libfpx.a and libfpx.la with one symlink to the shared library (libfpx.so.1.0.31) libfpx.so in /usr/lib/x86_64-linux-gnu . In addition I made a package config file descriptor libfpx.pc in /usr/lib/x86_64-linux-gnu/pkgconfig .

Everything went fine.

Then I just grabbed the latest version of ImageMagick 6.8.6-9 and went on to perform a configure. In my case it was from a build dir :

Code: Select all

$ ../configure CFLAGS="-O3 -g3" CXXFLAGS="-O3 -g3" --with-gslib=yes --with-mupdf=yes --with-rsvg=yes --with-wmf=yes --enable-hdri=yes
I was expecting ImageMagick to recognize the FlashPIX format outright. However the console log showed:

Code: Select all

-------------------------------------------------------------
checking for FlashPIX... 
checking fpxlib.h usability... yes
checking fpxlib.h presence... yes
checking for fpxlib.h... yes
checking for FPX_OpenImageByFilename in -lfpx... no
checking if FlashPIX package is complete... no -- some components failed test
-------------------------------------------------------------
Looking further in config.log I found:

Code: Select all

configure:28753: result: -------------------------------------------------------------
configure:28755: checking for FlashPIX
configure:28757: result: 
configure:28768: checking fpxlib.h usability
configure:28768: g++ -c -O3 -g3 -pthread   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16  conftest.cpp >&5
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking fpxlib.h presence
configure:28768: g++ -E   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16  conftest.cpp
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking for fpxlib.h
configure:28768: result: yes
configure:28776: checking for FPX_OpenImageByFilename in -lfpx
configure:28801: g++ -o conftest -O3 -g3 -pthread   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16    conftest.cpp -lfpx  -lfftw3 -ldjvulibre -lz -lXext -lXt  -lSM -lICE -lX11  -lbz2 -lgomp -lm    >&5
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator new[](unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `atan2'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `__cxa_pure_virtual'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator delete[](void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `__gxx_personality_v0'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `pow'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `sqrt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `sincosf'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
collect2: ld returned 1 exit status
configure:28801: $? = 1
This says that the shared library is found, however it looks like there is some big trouble using this library as everything look as an "undefined reference" to ImageMagick. I've never seen that before.

Do you have any thoughts about was went wrong ? Was this particular libfpx shared library working in previous versions of imageMagick ? My target system is Ubuntu 12.04 Precise amd64. Thank you for your help.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by magick »

As a sanity check, we compiled /installed FlashPix 1.3.1-3 and then configured and compiled ImageMagick 6.8.6-10. The configure script found the FlashPix library and linked it without complaint. The identify -list delegate command-line returns:
  • DELEGATES bzlib djvu fftw fpx fontconfig freetype gslib jng jp2 jpeg lcms lzma openexr pango png ps tiff webp x xml zlib
Notice it includes FlashPix support (e.g. fpx). We compiled under Fedora.
Antonio19
Posts: 6
Joined: 2013-09-19T17:10:46-07:00
Authentication code: 6789

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by Antonio19 »

From the error messages

Code: Select all

undefined reference to `atan2'
undefined reference to `sqrt'
undefined reference to `sincosf'
It is clear that at least the math library (for functions like ArcTan SquareRoot and Sin Cos) is not linked when compiling the conftest

Code: Select all

g++ -o conftest -O3 -g3 -pthread   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16    conftest.cpp -lfpx  -lfftw3 -ldjvulibre -lz -lXext -lXt  -lSM -lICE -lX11  -lbz2 -lgomp -lm    >&5
As well I don't see any error in this line. As the call to link the math library is -lm and is the last of the command line as it should be.

The math library is named libm.so, and the -l command option assumes a lib prefix and .a or .so suffix.

The file libm.so is present in my Ubuntu system in /usr/lib/x86_64-linux-gnu as a symlink to /lib/x86_64-linux-gnu/libm.so.6 which is itself a symlink to /lib/x86_64-linux-gnu/libm-2.17.so which is the math library.

I don't see why it is not linked properly. I am not expert at this linking / compiling process either. Has anyone any clue on how I could get a better diagnostic of what went wrong ? Thanks
electricart
Posts: 14
Joined: 2013-07-23T17:53:31-07:00
Authentication code: 6789

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by electricart »

Did anyone find a solution for this or have any suggestions?

I believe I have the same problem. I've tried compiling FlashPix on a few different versions of Ubuntu Server and whilst the compile/install of the FlashPix library seems fine, ImageMagick can never find it during configure?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by magick »

Flashpix requires the stdc++ library. Is it installed on your system?

Also check config.log. It will tell you why ImageMagick fails to find Flashpix.
electricart
Posts: 14
Joined: 2013-07-23T17:53:31-07:00
Authentication code: 6789

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by electricart »

Hi, thanks for the reply.

Yes, I can confirm I have the stdc++ library installed.

Here is the relevant section from config.log.

Code: Select all

configure:28753: checking for FlashPIX
configure:28755: result: 
configure:28766: checking fpxlib.h usability
configure:28766: g++ -c -g -O2 -pthread -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libpng12 -I/usr/include/ImageMagick-6     -DMAGICKCORE_HDRI_ENABLE=1 -D
MAGICKCORE_QUANTUM_DEPTH=16  -I/usr/include/X11 conftest.cpp >&5
configure:28766: $? = 0
configure:28766: result: yes
configure:28766: checking fpxlib.h presence
configure:28766: g++ -E -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libpng12 -I/usr/include/ImageMagick-6     -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANT
UM_DEPTH=16  -I/usr/include/X11 conftest.cpp
configure:28766: $? = 0
configure:28766: result: yes
configure:28766: checking for fpxlib.h
configure:28766: result: yes
configure:28774: checking for FPX_OpenImageByFilename in -lfpx
configure:28799: g++ -o conftest -g -O2 -pthread -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libpng12 -I/usr/include/ImageMagick-6     -DMAGICKCORE_HDRI_EN
ABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16  -I/usr/include/X11   -L/usr/lib/X11 conftest.cpp -lfpx  -lfftw3 -ldjvulibre -lz -lXext -lXt  -lSM -lICE -lX11  -lbz2 -lgomp -lrt -lm    >&5
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `operator new[](unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `atan2'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `__cxa_pure_virtual'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `operator delete[](void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `__gxx_personality_v0'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `pow'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `sqrt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `sincosf'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libfpx.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
collect2: ld returned 1 exit status
configure:28799: $? = 1
configure: failed program was:
| /* confdefs.h */
It appears to be very similar to the error that Antonio19 is getting.

I'm not sure how to proceed to fix something like this - any help would be greatly appreciated!

Thank you kindly for your time.
Antonio19
Posts: 6
Joined: 2013-09-19T17:10:46-07:00
Authentication code: 6789

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by Antonio19 »

Almost 6 month ago I reported here and asked you why I could not install the delegate for the FlashPIX format. The only answer I got was from an admin of the site : "As a sanity check, we compiled / installed FlashPix 1.3.1-3 and then configured and compiled ImageMagick 6.8.6-10 [on Fedora]. The configure script found the FlashPix library and linked it without complaint."

Then one month later another one did complain here of the same issue on another Debian Linux. The answer from an admin again was less than even usefull. The message from ImageMagick was clear : NO ACTION.

I revisited the issue yesterday and was ready to investigate the issue as no other would even look at it seriously. From the config.log file hopefully I got the C++ file conftest.cpp and got the compilation CLI which failed :

Code: Select all

$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx -lfftw3 -ldjvulibre -lz -lXext -lXt -lSM -lICE -lX11 -lbz2 -lgomp -lm    >&5
After searching for a while on g++ linking shared libraries, I decided to run the compilation command line with no other linked libraries than libfpx :

Code: Select all

$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx
It compiled without errors. Then I tried to look for which linked shared libraries the error popped. That was the libdjvulibre library ... Removing the -ldjvulibre from the command line had the conftest.cpp compiled again without errors:

Code: Select all

$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx -lfftw3 -lz -lXext -lXt -lSM -lICE -lX11 -lbz2 -lgomp -lm
gave me an object file conftest (as specified in the command).

I did check on the package implementing this djvulibre shared library : It's the Official Ubuntu package for Raring 13.04: Package name is libdjvulibre21 and version is 3.5.25.3-3 .

Obviouly then this is a bug in the ImageMagick configure script present in the source tarball.

As I believe that the ImageMagick team will take years to correct this bug, I went on to correct this one myself in order to have a build supporting this format. So here are my findings and the patch to the configure script for the latest version 6.8.8-7. The nbr: on the left is the line nbr of that file.

Code: Select all

28740:    LIBS="$DJVU_LIBS $LIBS"		--->	is adding -ldjvulibre to the set of linked libraries.
This set of linked libraries is then used with the compilation CLI of later delegates (I don't know why exactly ...).

Code: Select all

28938:    ac_check_lib_save_LIBS=$LIBS     --->  saving the value of LIBS before adding -lfpx to LIBS
28939:    LIBS="-lfpx  $LIBS"		       --->  is adding -lfpx to the linker.
My working patch and proposed change is to add a line after 28939: . The new line will be hence 28940:

Code: Select all

28940:    LIBS=${LIBS/-ldjvulibre/}		---> This will remove the djvulibre library from the linker
This has no incidence on the other delegates as LIBS is restored to its saved value on the following line

Code: Select all

28966:    LIBS=$ac_check_lib_save_LIBS	---> This is restoring the value of LIBS to its earlier saved value
Before leaving the code implementing FlashPIX support.

This command performed after installation of the new build

Code: Select all

$ identify -list format
[...]
      FPX  rw-   FlashPix Format
[...]
confirms full support for the FlashPIX FPX Format.

The configure script was to blame for the error. Will you take any action to correct this behaviour?

I went on to look at other unsupported format in my build. I found that LIBOPENJP2 was not supported although I have version 1.3, 1.5 and 2.0 installed. This is corresponding to so version 2, 5 and 6. The sources are coming from OpenJPEG at http://www.openjpeg.org/ and http://code.google.com/p/openjpeg. Your script is looking for a package named "libopenjp2" ... At least on all Debian Linux there has never been any package of this name ... The related packages are named (according to the developers group name) libopenjpeg2 (for shared library libopenjpeg.so.2), libopenjpeg5 (for shared library libopenjpeg.so.5) and libopenjpeg6 (for shared library libopenjpeg.so.6) ...

It looks like we are far away from any standard JPEG 2000 (from OpenJPEG) recognition in ImageMagicks.

Thanks for taking time to read this post.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Installing delegate (libfpx) on Ubuntu 12.04 fails

Post by fmw42 »

I think you need to address these issues on the Bugs forum
Post Reply