PerlMagick Makefile.PL -> make:: /usr/bin/ld: cannot find -lMagickCore-6.Q16
Posted: 2016-02-26T12:04:51-07:00
I am trying to install PerlMagick with HDRI and have run into the most bizarre situation; the /usr/bin/make is rewriting the Makefile and removing all references to HDRI! It then attempts to link against the non-HDRI IM library and the link fails.
Perl is 5.22.1 built from source with a SHARED libperl.so (Build a shared libperl.so (y/n) [n] y)
ImageMagick 6.9.3-5 is successfully built from source with HDRI-enabled << See `identify` output below
Makefile.PL is edited to reflect the need to link against MagickCore-6.Q16HDRI
`perl Makefile.PL` runs perfectly, resulting Makefile looks fine
New directory, first run of perl/make
make test is failing by issuing the wrong LD_RUN_PATH library, -lMagickCore-6.Q16 (without the needed HDRI suffix)
And, /usr/bin/make is defiling the MAKEFILE, REMOVING ALL REFERENCES TO HDRI!
===================================================
GORY PROCEDURE:
Download perl-5.22.1
Download ImageMagick-6.9.3-5, configure, make works
./configure --with-perl --enable-hdri --enable-opencl --with-x
=======================================
MAKEFILE HACK:
Edit Makefile per README.txt (-> edit Makefile.PL and change LIBS and INC)
Check editing by examining all WORDS (Frequency Count) like Q16 or HDRI:
DIFF Hacked Makefile.PL against Original
========================================
PERL Makefile.PL::
Verify that generated Makefile has right library and HDRI enabled:
=====================================
MAKE (Run AMUCK!)
>> MOSTLY HARMLESS ?? MANGLING a LIBRARY_NAME is *_NOT-HARMLESS_* <<
AND... MAKEFILE was DEFILED; MAKE EDITED IT!
=========================================
PKG-CONFIG::
pkg-config finds the right pkg-config file with both MagickCore-6.Q16HDRI and MagickCore
===================================================
IDENTIFY -LIST CONFIGURE::
Perl is 5.22.1 built from source with a SHARED libperl.so (Build a shared libperl.so (y/n) [n] y)
ImageMagick 6.9.3-5 is successfully built from source with HDRI-enabled << See `identify` output below
Makefile.PL is edited to reflect the need to link against MagickCore-6.Q16HDRI
`perl Makefile.PL` runs perfectly, resulting Makefile looks fine
New directory, first run of perl/make
make test is failing by issuing the wrong LD_RUN_PATH library, -lMagickCore-6.Q16 (without the needed HDRI suffix)
And, /usr/bin/make is defiling the MAKEFILE, REMOVING ALL REFERENCES TO HDRI!
Code: Select all
/usr/bin/ld: cannot find -lMagickCore-6.Q16
collect2: error: ld returned 1 exit status
Makefile:486: recipe for target 'blib/arch/auto/Image/Magick/Magick.so' failed
GORY PROCEDURE:
Download perl-5.22.1
Code: Select all
Build a shared libperl.so (y/n) [n] y << Required for ImageMagick to link
perl -v | grep version => This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux
gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2), [ matches Perl v5.22.1, dyslexically ]
uname -a => Linux raptor 4.2.0-30-generic #35-Ubuntu SMP Fri Feb 19 13:52:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
PerlMagick-6.89c$ make --version | grep Make => GNU Make 4.0 << From Kubuntu, stock
./configure --with-perl --enable-hdri --enable-opencl --with-x
=======================================
MAKEFILE HACK:
Edit Makefile per README.txt (-> edit Makefile.PL and change LIBS and INC)
Check editing by examining all WORDS (Frequency Count) like Q16 or HDRI:
Code: Select all
PerlMagick-6.89c$ egrep "Q16|HDRI" Makefile.orig.PL | freq -w | egrep "HDR|Q16"
3 -DMAGICKCORE_HDRI_ENABLE=0 >> "FREQ.PL -W" hashes WORDS -> FREQ Counts <<
3 -lMagickCore-6.Q16
PerlMagick-6.89c$ egrep "Q16|HDRI" Makefile.PL | freq -w | egrep "HDR|Q16"
4 -DMAGICKCORE_HDRI_ENABLE=1 << ENABLED => 1
3 -lMagickCore-6.Q16HDRI << HDRI appended
Code: Select all
PerlMagick-6.89c$ diff Makefile.orig.PL Makefile.PL | freq -w | grep -i MagickCore | grep -v DEPTH
3 -DMAGICKCORE_HDRI_ENABLE=0
4 -DMAGICKCORE_HDRI_ENABLE=1
3 -lMagickCore-6.Q16
3 -lMagickCore-6.Q16HDRI << HDRI installed, both places
PERL Makefile.PL::
Code: Select all
PerlMagick-6.89c$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json << Looks GREAT!
Code: Select all
PerlMagick-6.89c$ egrep "Q16|HDRI" Makefile | freq -w | egrep "HDR|Q16"
6 -DMAGICKCORE_HDRI_ENABLE=1
7 -lMagickCore-6.Q16HDRI << MAKEFILE has right HDRI library
MAKE (Run AMUCK!)
Code: Select all
PerlMagick-6.89c$ make
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Image::Magick ()
chmod 644 "Magick.bs"
"/usr/local/bin/perl" "/usr/local/lib/perl5/5.22.1/ExtUtils/xsubpp" -typemap "/usr/local/lib/perl5/5.22.1/ExtUtils/typemap" -typemap "typemap" Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
cc -c -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Ofast -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/local/lib/perl5/5.22.1/x86_64-linux/CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H -DMAGICKCORE_HDRI_ENABLE=1 Magick.c
rm -f blib/arch/auto/Image/Magick/Magick.so
LD_RUN_PATH="/usr/local/lib" cc -L/usr/local/lib -lMagickCore-6.Q16HDRI -shared -Ofast -L/usr/local/lib -fstack-protector-strong Magick.o -o blib/arch/auto/Image/Magick/Magick.so \
-L/usr/local/lib -lMagickCore-6.Q16HDRI -lperl -lm \
chmod 755 blib/arch/auto/Image/Magick/Magick.so
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
Manifying 1 pod document
"/usr/local/bin/perl" "-Iblib/arch" "-Iblib/lib" Makefile.orig.PL Makefile.orig
Warning (mostly harmless): No library found for -lMagickCore-6.Q16
AND... MAKEFILE was DEFILED; MAKE EDITED IT!
Code: Select all
PerlMagick-6.89c$ egrep -i "Q16|HDRI" Makefile | freq -w | egrep -i "Q16|HDRI"
4 -DMAGICKCORE_HDRI_ENABLE=0 <<<<<< WRONG!!!
5 -lMagickCore-6.Q16 <<<<<< WRONG!!!
PKG-CONFIG::
pkg-config finds the right pkg-config file with both MagickCore-6.Q16HDRI and MagickCore
Code: Select all
~$ pkg-config --libs MagickCore-6.Q16HDRI
-L/usr/local/lib -lMagickCore-6.Q16HDRI
~$ pkg-config --libs MagickCore
-L/usr/local/lib -lMagickCore-6.Q16HDRI
~$ loc MagickCore-6.Q16HDRI | grep "\.pc$" | grep -v rian
/usr/local/lib/pkgconfig/MagickCore-6.Q16HDRI.pc
~$ cat /usr/local/lib/pkgconfig/MagickCore-6.Q16HDRI.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/ImageMagick-6
includearchdir=/usr/local/include/ImageMagick-6
libname=MagickCore-6.Q16HDRI
moduledir=${exec_prefix}/lib/ImageMagick-6.9.3/modules-Q16HDRI
Name: MagickCore
Description: MagickCore - C API for ImageMagick (ABI Q16HDRI)
URL: https://www.imagemagick.org
Version: 6.9.3
Cflags: -I${includearchdir} -I${includedir} -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
Libs: -L${libdir} -l${libname}
Libs.private: -L${libdir} -l${libname} -ljbig -llcms2 -ltiff -lfreetype -ljpeg -L/usr/local/lib -lpng16 -lfontconfig -lfreetype -lXext -lSM -lICE -lX11 -L/usr/local/lib -llzma -lbz2 -L/usr/local/lib -lopenjp2 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo -lxml2 -L/usr/local/lib -lz -lm -lgomp -lm
===================================================
IDENTIFY -LIST CONFIGURE::
Code: Select all
~$ identify -list Configure | egrep "Q16|HDRI"
Path: /usr/local/lib/ImageMagick-6.9.3//config-Q16HDRI/configure.xml
CFLAGS -I/usr/include/libxml2 -I/usr/local/include/libpng16 -pthread -I/usr/local/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/local/include -I/usr/local/include/openjpeg-2.1 -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/local/include -ffast-math -m64 -Ofast -march=native -fopenmp -funroll-loops -flto -mtune=broadwell -Wall -mtune=core2 -fexceptions -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /usr/local/lib/ImageMagick-6.9.3/modules-Q16HDRI/coders
FEATURES DPC HDRI Cipher OpenMP
FILTER_PATH /usr/local/lib/ImageMagick-6.9.3/modules-Q16HDRI/filters
PCFLAGS -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.9.3/config-Q16HDRI