openjpeg fails to link against -lm which breaks -Wl,--as-needed (Bug #306)
Description
$ sorcery -v
1.15.1-rc1
$ gaze version poppler openjpeg
Grimoire Section Spell Grimoire Version Installed Version
-------- ------- ----- ---------------- -----------------
test graphics-libs poppler 0.18.0 0.16.7
test graphics-libs openjpeg 1.4 1.4
- cast poppler
...
checking for opj_cio_open in -lopenjpeg... no
configure: error: "*** libopenjpeg library not found ***"
Checking poppler's config.log for the failed cast:
configure:18931: checking for opj_cio_open in -lopenjpeg
configure:18956: g++ -o conftest -march=native -mtune=native -m32 -pipe -DPIC -fPIC -O2 -ansi -lm -s -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu conftest.cpp -lopenjpeg >&5
/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../libopenjpeg.so: undefined reference to `floor'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../libopenjpeg.so: undefined reference to `ceilf'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../libopenjpeg.so: undefined reference to `floorf'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../libopenjpeg.so: undefined reference to `pow'
collect2: ld returned 1 exit status
Shows that we're alreading telling poppler's openjpeg test to use -lm, but it still cannot find it (because of -Wl,--as-needed which sees -lopenjpeg as not linking against -lm and nothing in the openjpeg test using -lm so removing it).
$ ldd /usr/lib/libopenjpeg.so
linux-gate.so.1 => (0xb78a7000)
libc.so.6 => /lib/libc.so.6 (0xb76cd000)
/lib/ld-linux.so.2 (0xb78a8000)
Yet openjpeg does use math functions:
$ strings /usr/lib/libopenjpeg.so | grep floor
floor
floorf
After fixing openjpeg to always link against -lm:
$ ldd /usr/lib/libopenjpeg.so
linux-gate.so.1 => (0xb78a7000)
libm.so.6 => /lib/libm.so.6 (0xb7833000)
libc.so.6 => /lib/libc.so.6 (0xb76cd000)
/lib/ld-linux.so.2 (0xb78a8000)
And now poppler casts fine using openjpeg and -Wl,--as-needed in LDFLAGS.
History
Updated by Eric Sandall over 1 year ago
Fixed in test with:
commit a06e3da9c5aaa197ded19044a58022f7015789f4
Author: Eric Sandall <sandalle@sourcemage.org>
Date: Thu Oct 20 16:02:20 2011 -0700
openjpeg: Link against -lm or -Wl,--as-needed may break #306
PATCHLEVEL++Updated by Vlad Glagolev over 1 year ago
marking as resolved then
- % Done changed from 0 to 100
- Status changed from New to Resolved