Installing delegate FlashPIX (libpfx) fails in Debian/Ubuntu
Posted: 2014-03-04T05:30:53-07:00
6 month ago I started a new topic "Installing delegate (libfpx) on Ubuntu 12.04 fails" @ viewtopic.php?f=1&t=24126 seeking help on how to build ImageMagick in order to support this delegate format. I got no valid answer. An admin of the site stated "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 1 month later in same thread another one complained about the same thing for his build on an a [Debian] Ubuntu Server. No intelligible response from the admin team.
Though a rule of thumb in the software business is that if 2 different users got the same bug then there is a likely 100 % chance the bug is for real ... That is not an enforced rule here at ImageMagick.
I then revisited the issue over the last week-end and was ready to investigate further as no other would even look at it seriously. I found the bug in the configure script and made a patch. I posted my findings on my thread. The following day some one from ImageMagick told me to post this in the bugs section of the forum. So here I am. I will only post here my latest post detailing the solution. All the postings are available on the thread identified earlier.
From the config.log file hopefully I got the C++ file conftest.cpp and got the compilation CLI which failed :
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:
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:
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.
This set of linked libraries is then used with the compilation CLI of later delegates (I don't know why exactly ...).
My working patch and proposed change is to add a line after 28939: . The new line will be hence 28940:
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
Before leaving the code implementing FlashPIX support.
This command performed after installation of the new build
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.
Then 1 month later in same thread another one complained about the same thing for his build on an a [Debian] Ubuntu Server. No intelligible response from the admin team.
Though a rule of thumb in the software business is that if 2 different users got the same bug then there is a likely 100 % chance the bug is for real ... That is not an enforced rule here at ImageMagick.
I then revisited the issue over the last week-end and was ready to investigate further as no other would even look at it seriously. I found the bug in the configure script and made a patch. I posted my findings on my thread. The following day some one from ImageMagick told me to post this in the bugs section of the forum. So here I am. I will only post here my latest post detailing the solution. All the postings are available on the thread identified earlier.
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
Code: Select all
$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx
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
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.
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.
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
This command performed after installation of the new build
Code: Select all
$ identify -list format
[...]
FPX rw- FlashPix 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.