Bug 186424 - net-analyzer/wireshark-0.99.6 fails to link due to undefined reference to `modf' on uclibc
Bug#: 186424 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: pva@gentoo.org Reported By: natanael.copa@gmail.com
Component: Ebuilds
URL:  http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1704
Summary: net-analyzer/wireshark-0.99.6 fails to link due to undefined reference to `modf' on uclibc
Keywords:  
Status Whiteboard: 
Opened: 2007-07-24 06:36 0000
Description:   Opened: 2007-07-24 06:36 0000
I bet there is a missing -lm in LDFLAGS somewhere there.

/bin/sh ./libtool --tag=CC --mode=link i386-gentoo-linux-uclibc-gcc  -DINET6
-D_U_="__attribute__((unused))" -march=i386 -O3 -pipe -fomit-frame-pointer
-fno-stack-protector -Wall -W -Wdeclaration-after-statement -Wendif-labels
-Wpointer-arith -I/usr/local/include -I/usr/include/glib-1.2
-I/usr/lib/glib/include -DNETSNMP_ENABLE_IPV6 -march=i386 -pipe -O2 -Ulinux
-Dlinux=linux -I. -I/usr/include  -L/usr/local/lib -o capinfos  capinfos.o
plugins.o report_err.o privileges.o filesystem.o wiretap/libwiretap.la
-L/usr/lib -rdynamic -lgmodule -lglib -lz 
i386-gentoo-linux-uclibc-gcc -DINET6 "-D_U_=__attribute__((unused))"
-march=i386 -O3 -pipe -fomit-frame-pointer -fno-stack-protector -Wall -W
-Wdeclaration-after-statement -Wendif-labels -Wpointer-arith
-I/usr/local/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include
-DNETSNMP_ENABLE_IPV6 -march=i386 -pipe -O2 -Ulinux -Dlinux=linux -I.
-I/usr/include -o .libs/mergecap mergecap.o merge.o -rdynamic  -L/usr/local/lib
wiretap/.libs/libwiretap.so -L/usr/lib /usr/lib/libgmodule.so
/usr/lib/libglib.so -lz
wiretap/.libs/libwiretap.so: undefined reference to `modf'
collect2: ld returned 1 exit status
make[2]: *** [mergecap] Error 1
make[2]: *** Waiting for unfinished jobs....
i386-gentoo-linux-uclibc-gcc -DINET6 "-D_U_=__attribute__((unused))"
-march=i386 -O3 -pipe -fomit-frame-pointer -fno-stack-protector -Wall -W
-Wdeclaration-after-statement -Wendif-labels -Wpointer-arith
-I/usr/local/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include
-DNETSNMP_ENABLE_IPV6 -march=i386 -pipe -O2 -Ulinux -Dlinux=linux -I.
-I/usr/include -o .libs/capinfos capinfos.o plugins.o report_err.o privileges.o
filesystem.o -rdynamic  -L/usr/local/lib wiretap/.libs/libwiretap.so -L/usr/lib
/usr/lib/libgmodule.so /usr/lib/libglib.so -lz
rm -f .libs/tshark.nm .libs/tshark.nmS .libs/tshark.nmT
creating .libs/tsharkS.c
(cd .libs && i386-gentoo-linux-uclibc-gcc  -march=i386 -O3 -pipe
-fomit-frame-pointer -fno-stack-protector -c -fno-builtin "tsharkS.c")
wiretap/.libs/libwiretap.so: undefined reference to `modf'
collect2: ld returned 1 exit status
make[2]: *** [capinfos] Error 1

------- Comment #1 From Jakub Moc (RETIRED) 2007-07-24 06:40:27 0000 -------
emerge --info please.

------- Comment #2 From Natanael Copa 2007-07-24 06:46:38 0000 -------
Portage 2.1.2.9 (uclibc/x86/hardened, gcc-3.4.6, uclibc-0.9.28.3-r0,
2.6.22-gentoo-r1 i686)
=================================================================
System uname: 2.6.22-gentoo-r1 i686 Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
Gentoo Base System release 2.0.0_alpha4
Timestamp of tree: Sat, 21 Jul 2007 23:00:02 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.61
sys-devel/automake:  1.6.3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i386-gentoo-linux-uclibc"
CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
CHOST="i386-gentoo-linux-uclibc"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"
CXXFLAGS="-Os -pipe"
DISTDIR="/var/cache/distfiles"
FEATURES="autoconfig buildpkg distlocks metadata-transfer nodoc noinfo noman
sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/linux/distributions/gentoo"
MAKEOPTS="-j3"
PKGDIR="/var/cache/packages/default"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --delete-after --stats --timeout=180
--exclude=/distfiles --exclude=/local --exclude=/packages
--filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/alpine-portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X509 bitmap-fonts bri bzip2 cli cracklib dri encode expat extensions
hardened iproute2 ipv6 jpeg lua mad midi mudflap ncurses netboot nonfsv4 ntfs
ogg openmp oss pci pcmcia pic png pppd pri readline reflection rrdtool sensord
session snmp speex spl ssl tdb truetype truetype-fonts type1-fonts uclibc
uclibc++ udev usb userlocales wifi wordexp x86 xorg zaptel zlib"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file
hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route
share shm softvol" ELIBC="uclibc" INPUT_DEVICES="keyboard mouse evdev"
KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001
mtxorb ncurses text" MISDN_CARDS="avmfritz hfcmulti hfcpci hfcsmini hfcsusb
netjetpci sedlfax w6692pci xhfc" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l
apm ark chips cirrus cyrix epson glint i128 i740 i810 imstt mach64 mga neomagic
nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx
tga trident tseng vesa vga via voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS,
LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

------- Comment #3 From Peter Volkov 2007-07-24 06:56:51 0000 -------
Please, attach config.log and wiretap/config.log.

------- Comment #4 From Natanael Copa 2007-07-24 07:06:14 0000 -------
Created an attachment (id=125839) [details]
wireshark-0.99.6-ldflag-lm.patch

You will get the config.log and wiretap/config.log in a second. (I blowed away
my /var/tmp/..../wireshark dir so i need to recompile)

------- Comment #5 From Natanael Copa 2007-07-24 07:16:28 0000 -------
Created an attachment (id=125841) [details]
config.log

as requested

------- Comment #6 From Natanael Copa 2007-07-24 07:17:02 0000 -------
Created an attachment (id=125842) [details]
wiretap/config.log

------- Comment #7 From Natanael Copa 2007-07-24 07:24:20 0000 -------
After applying the previously attatched wireshark-0.99.6-ldflag-lm.patch the
linking works. "Forgetting" -lm is a common mistake since glibc works without
it. Other libc's are not as forgiving.

------- Comment #8 From Peter Volkov 2007-07-24 08:25:02 0000 -------
Created an attachment (id=125849) [details]
wireshark-0.99.6-lm.patch

Eh. Your clarification helped me to recall the problem.

But why do you fix compilation of the programs which compiles with
libwireshark, while the problem is in libwireshark? Does this ^^ patch works
for you?

Thank you for report, BTW :)

------- Comment #9 From Peter Volkov 2007-07-24 08:35:30 0000 -------
Also, may be the correct solution will be use @LIBM@ and add AC_CHECK_LIBM into
wiretap/configure.in which is part of libtool distribution (libtool.m4).

------- Comment #10 From Natanael Copa 2007-07-24 09:05:23 0000 -------
(In reply to comment #9)
> Also, may be the correct solution will be use @LIBM@ and add AC_CHECK_LIBM into
> wiretap/configure.in which is part of libtool distribution (libtool.m4).
> 

Sounds like the proper way to handle this.
Should be reported upstream too.

btw. The patch you posted works too. (my patch was shooting at anything that
was moving...)

------- Comment #11 From Peter Volkov 2007-07-24 18:19:54 0000 -------
wireshark-0.99.6-r1 is commited with the fixes for this problem too.  Please,
report if I did anything wrong, as I do not have system with ulibc to test the
fix.

Again, thank you for report... fixed. :)