Discussion:
avis-client-c: ceilf, linking with -lm
Daniel Pocock
2013-09-16 10:25:12 UTC
Permalink
I've observed this binary linking successfully on Debian but not on
Ubuntu. The package uses an autotools build system.

On Ubuntu, gcc link complains about unresolved reference to ceilf, even
though -lm is in the linker command line

Can anybody comment on the correct way to go about this? On both
platforms, autoreconf is executed as part of the package build from
debian/rules and there is one patch against configure.ac, for supporting
HURD and kFreeBSD kernels.


Source:

http://anonscm.debian.org/gitweb/?p=collab-maint/avis-client-c.git;a=tree


Ubuntu error:

/bin/bash ../../libtool --tag=CC --mode=link gcc -Wall -pedantic -pthread -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -lm -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -o tests tests.o check_messages.o check_security.o check_client.o check_collections.o check_invoke.o check_uri.o ../../src/lib/libavis.la ../../packages/check/src/libcheck.la
libtool: link: gcc -Wall -pedantic -pthread -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/tests tests.o check_messages.o check_security.o check_client.o check_collections.o check_invoke.o check_uri.o -lm ../../src/lib/.libs/libavis.so ../../packages/check/src/.libs/libcheck.a -pthread
../../src/lib/.libs/libavis.so: undefined reference to `ceilf'
collect2: error: ld returned 1 exit status
make[4]: *** [tests] Error 1
make[4]: Leaving directory `/tmp/buildd/avis-client-c-1.2.4/src/test'


Full Ubuntu bug details (with config.status and config.log):

https://bugs.launchpad.net/ubuntu/+bug/1224928

Debian build log (successful build):


https://buildd.debian.org/status/fetch.php?pkg=avis-client-c&arch=i386&ver=1.2.4-7&stamp=1378377013
Daniel Pocock
2013-09-16 14:05:47 UTC
Permalink
Post by Daniel Pocock
I've observed this binary linking successfully on Debian but not on
Ubuntu. The package uses an autotools build system.
On Ubuntu, gcc link complains about unresolved reference to ceilf, even
though -lm is in the linker command line
Did you read and observe the ceilf manual page on Ubuntu? Perhaps one
of the stated requirements in order for this function to be exposed
has not been met.
I looked through the package and I found that there was a utility
library in there that didn't have the same AM_LDFLAGS definition as all
the other components

The problem was only appearing much later in the build unfortunately,
when building the test binary, but it is fixed now.

Can anything be done to make this type of thing easier to diagnose?
Zack Weinberg
2013-09-16 15:29:31 UTC
Permalink
Post by Daniel Pocock
I looked through the package and I found that there was a utility
library in there that didn't have the same AM_LDFLAGS definition as all
the other components
The problem was only appearing much later in the build unfortunately,
when building the test binary, but it is fixed now.
Can anything be done to make this type of thing easier to diagnose?
If the "utility library" is linked into a shared object,
-Wl,-z,defs,--as-needed may help. If it only exists in .a and/or .la
format (no .so) then unfortunately I don't think there's anything that
can be done without a good deal of work. 'ar' doesn't have any
equivalent of -z defs, and 'ld' has no "just check for unresolved
externals, don't create any output" mode.

zw
Bob Friesenhahn
2013-09-16 13:57:16 UTC
Permalink
Post by Daniel Pocock
I've observed this binary linking successfully on Debian but not on
Ubuntu. The package uses an autotools build system.
On Ubuntu, gcc link complains about unresolved reference to ceilf, even
though -lm is in the linker command line
Did you read and observe the ceilf manual page on Ubuntu? Perhaps one
of the stated requirements in order for this function to be exposed
has not been met.

Bob
--
Bob Friesenhahn
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Thomas Jahns
2013-09-17 14:19:39 UTC
Permalink
Hi,
Post by Daniel Pocock
/bin/bash ../../libtool --tag=CC --mode=link gcc -Wall -pedantic -pthread -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -lm -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -o tests tests.o check_messages.o check_security.o check_client.o check_collections.o check_invoke.o check_uri.o ../../src/lib/libavis.la ../../packages/check/src/libcheck.la
libtool: link: gcc -Wall -pedantic -pthread -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/tests tests.o check_messages.o check_security.o check_client.o check_collections.o check_invoke.o check_uri.o -lm ../../src/lib/.libs/libavis.so ../../packages/check/src/.libs/libcheck.a -pthread
../../src/lib/.libs/libavis.so: undefined reference to `ceilf'
collect2: error: ld returned 1 exit status
make[4]: *** [tests] Error 1
make[4]: Leaving directory `/tmp/buildd/avis-client-c-1.2.4/src/test'
You have the order of libraries incorrect: -lm is a dependency of libavis and
therefore needs to be specified afterwards. But from the launchpad page one can
see that's only half the story. Anyhow: it's unrelated to autotools.

Regards, Thomas
--
Thomas Jahns
DKRZ GmbH, Department: Application software

Deutsches Klimarechenzentrum
Bundesstraße 45a
D-20146 Hamburg

Phone: +49-40-460094-151
Fax: +49-40-460094-270
Email: Thomas Jahns <***@dkrz.de>
Loading...