Ubuntu 11.10: /src/lib/.libs/libavis.so: undefined reference
Brought to you by:
phillipsm
Hi there
I am having some trouble with building the Avis C library (1.2.4) on Ubuntu 11.10.
I run autoreconf, then./configure and then sudo make, and come up with this error:
../../src/lib/.libs/libavis.so: undefined reference to `ceil'
I've read through this thread: http://sourceforge.net/tracker/?func=detail&aid=2566342&group_id=181381&atid=896975, but following these instructions doesn't work, and unfortunately I cannot find anything else online. Your help in getting this fixed will be greatly appreciated.
Thanks
Kyle
Hi Kyle,
have a look at configure.ac line 79 that looks like:
# linked libraries needed by various platforms
case $host in
*-*-linux*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
sparc-sun-solaris*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm -lsocket"
;;
*-*-freebsd*|*-*-openbsd*|*-*-netbsd*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
esac
You need the "-lm" and I think your Ununtu is not matching any of those. You could just hack a "*" matching line in there, or let me know what the correct $host looks like.'
Matthew.
Hi Matthew
I went in and added another condition that would catch any other hosts that weren't in the case statement, like so:
# linked libraries needed by various platforms
case $host in
*-*-linux*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
sparc-sun-solaris*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm -lsocket"
;;
*-*-freebsd*|*-*-openbsd*|*-*-netbsd*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
esac
I am not sure if this is correct, but after doing this is still does not work.
How can I get the $host?
Apologies, this is pretty deep down the rabbit hole for me.
Thanks
Hi Matt
I have subsequently found out that by default Ubuntu does not declare the host variable, so I manually set it (to simply linux-ubuntu). I also updated the lines in configure.ac to:
# linked libraries needed by various platforms
case $host in
*-*-linux*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
sparc-sun-solaris*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm -lsocket"
;;
*-*-freebsd*|*-*-openbsd*|*-*-netbsd*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
*-ubuntu*)
AVIS_LDFLAGS="$AVIS_LDFLAGS -lm"
;;
esac
I then re-reun autoreconf, ./configure and make, and still come up with the same error. Will carry on testing, thanks for the help.
Kyle
Hi Kyle,
I'll have a try compiling on a Ubuntu box later today and see what happens. I strongly suspect the -lm is still not sticking.
As a last resort, do a "make distclean" (or re-extract the tar ball and patch configure.ac) and try again.
I've just successfully compiled the client lib on Ubuntu 10.04 (I don't have a an 11.10 box handy), no changes required. I'm very surprised there's any difference between these two, since the Avis client lib doesn't depend on anything at all sophisticated.
Hi Matt
Thanks for following up. That's odd it compiled straight away, I've tried a number of combinations of conditionals in configure.ac, as well as various different $host values, still with no luck. From what I understand it's not a big issue, and the -lm is needed, but for whatever reason it's not getting there.
If you have any suggestions for me, it would be of great help. I need this middleware to work in order to run another program, and there are no substitutions.
Let me know if I can assist with any dumps of data, or anything else.
Thanks
I can send you a .so or .a if you're really stuck: I suspect it will be fine on a later distro. Is this 32 or 64 bit?
Alternatively, you could try "export CFLAGS=-lm" before running the build, which may get the flag into the compilation.
Dump from autoreconf to failed make
Hi Matt
I ran the export and did not effect the outcome (I also tried before and after the configure commands in case). I have attached the complete dump from autoreconf until the failed make, hopefully this helps. The distro I am using is 32 bit, up-to-date Ubuntu 11.10. Your help is most appreciated.
Thanks
Hi Kyle,
grab the Ubuntu ELF 32-bit .so (http://dl.dropbox.com/u/363918/libavis.so.0.0.0) and .a (http://dl.dropbox.com/u/363918/libavis.a) and see if that can at least get you unstuck.
Matthew.
Hi,
This problem is because a new flag activated on ldd since ubuntu 11.10.
There's more info and a solution here: http://ubuntuforums.org/showthread.php?t=1859400