Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 355455 - dev-db/mysql-5.1.51 fails to compile. strings/.libs/libmystrings.so: undefined reference to `finite'
Summary: dev-db/mysql-5.1.51 fails to compile. strings/.libs/libmystrings.so: undefine...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-18 17:04 UTC by Tom Lloyd
Modified: 2018-02-12 10:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Full build log (build.log,500.02 KB, text/plain)
2011-02-18 17:05 UTC, Tom Lloyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Lloyd 2011-02-18 17:04:42 UTC
MySQL 5.1.51 fails to compile on my uClibc/ppc/hardened machine.

Reproducible: Always

Steps to Reproduce:
emerge =dev-db/mysql-5.1.51


Actual Results:  
<snip>
libtool: link: powerpc-gentoo-linux-uclibc-gcc -O2 -mcpu=603e -pipe -DHAVE_ERRNO_AS_DEFINE=1 -fno-stack-protector-all -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX -Wl,-z -Wl,relro -rdynamic -o .libs/factorial my_main.o factorial.o  ./.libs/libdbug.so -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread ../mysys/.libs/libmysys.so -lpthread -lpthread -lpthread -lpthread -L/usr/powerpc-gentoo-linux-uclibc/bin -L/usr/powerpc-gentoo-linux-uclibc/lib -lpthread -lpthread -lpthread -lpthread /usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6/libstdc++.so -L/usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6 -L/usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6/../../../../powerpc-gentoo-linux-uclibc/lib -lgcc_s -lc ../strings/.libs/libmystrings.so -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -L/usr//lib -lz -lpthread -lcrypt -lnsl -lm -lpthread -Wl,-rpath -Wl,/usr/lib/mysql
libtool: link: powerpc-gentoo-linux-uclibc-gcc -O2 -mcpu=603e -pipe -DHAVE_ERRNO_AS_DEFINE=1 -fno-stack-protector-all -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX -Wl,-z -Wl,relro -rdynamic -o .libs/dbug_analyze dbug_analyze.o  ./.libs/libdbug.so -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread ../mysys/.libs/libmysys.so -lpthread -lpthread -lpthread -lpthread -L/usr/powerpc-gentoo-linux-uclibc/bin -L/usr/powerpc-gentoo-linux-uclibc/lib -lpthread -lpthread -lpthread -lpthread /usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6/libstdc++.so -L/usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6 -L/usr/lib/gcc/powerpc-gentoo-linux-uclibc/3.4.6/../../../../powerpc-gentoo-linux-uclibc/lib -lgcc_s -lc ../strings/.libs/libmystrings.so -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -lpthread -L/usr//lib -lz -lpthread -lcrypt -lnsl -lm -lpthread -Wl,-rpath -Wl,/usr/lib/mysql
../strings/.libs/libmystrings.so: undefined reference to `finite'
collect2: ld returned 1 exit status
distcc[9207] ERROR: compile (null) on localhost failed
make[1]: *** [factorial] Error 1
make[1]: *** Waiting for unfinished jobs....
../strings/.libs/libmystrings.so: undefined reference to `finite'
collect2: ld returned 1 exit status
distcc[9233] ERROR: compile (null) on localhost failed
make[1]: *** [dbug_analyze] Error 1
make[1]: Leaving directory `/mnt/spare/portage/dev-db/mysql-5.1.51/work/mysql/dbug'
make: *** [all-recursive] Error 1
emake failed




Portage 2.1.9.25 (uclibc/ppc/hardened, gcc-3.4.6, uclibc-0.9.30.1-r1, 2.6.28-hardened-r9-muttley-3-wifi ppc)
=================================================================
System uname: Linux-2.6.28-hardened-r9-muttley-3-wifi-ppc-G2_LE-with-gentoo-1.12.14
Timestamp of tree: Wed, 16 Feb 2011 21:45:01 +0000
distcc 3.1 powerpc-gentoo-linux-uclibc [enabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p9
dev-lang/python:     2.4.6, 2.5.4-r3, 2.6.6-r1, 3.1.2-r4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.65-r1
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       3.4.6-r2, 4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="ppc"
ACCEPT_LICENSE="* -@EULA"
CBUILD="powerpc-gentoo-linux-uclibc"
CFLAGS="-O2 -mcpu=603e -pipe"
CHOST="powerpc-gentoo-linux-uclibc"
CONFIG_PROTECT="/etc /usr/share/openvpn/easy-rsa /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/php/apache2-php5.2/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5.2/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5.2/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -mcpu=603e -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distcc distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-z,relro"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/mnt/spare"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman"
SYNC="rsync://splig/gentoo-portage"
USE="alsa apache2 bzip2 cgi cli cracklib crypt cxx dri embedded fastcgi hardened ipv6 modules mudflap mysql ncurses offensive openmp pcre perl php pic ppc python quotas readline samba session sni sqlite ssl ssp suhosin syslog tcpd uclibc uclibc-compat unicode xorg zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="alias auth_basic authn_alias authn_anon authn_default authn_file authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy proxy_http dav dav_fs auth_digest" APACHE2_MPMS="prefork" CAMERAS="sq905" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="uclibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Tom Lloyd 2011-02-18 17:05:14 UTC
Created attachment 262929 [details]
Full build log
Comment 2 Tom Lloyd 2011-02-18 17:12:39 UTC
Sorry, forgot to add this may be related to bug 344885, which appears to fail in the same file but with a different error.
Comment 3 Rafał Mużyło 2011-02-18 18:08:21 UTC
Bug 344885 seems unrelated - here libmystrings.so doesn't get linked with libm.
Comment 4 Wormo (RETIRED) gentoo-dev 2011-02-18 23:58:57 UTC
Actually it is being linked to libm:

../strings/.libs/libmystrings.so -lpthread -lpthread -lpthread
-lpthread -lpthread -lpthread -lpthread -lpthread -L/usr//lib -lz -lpthread
-lcrypt -lnsl -lm

but checking 'man finite':
 Note that these functions are obsolete.  C99 defines macros isfinite(),
 isinf(), and isnan() (for all types) replacing them. 

and the problem turns out to be that uclibc libm has the C99 standard name isfinite() instead of the BSDism finite(), while glibc supports both. Replacing finite() calls by isfinite() should solve this problem.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-04-17 22:49:54 UTC
embedded:
mysql-$PV/include/my_global.h contains the following (whitespace added for legibility):
#ifndef isfinite
#  ifdef HAVE_FINITE
#    define isfinite(x) finite(x)
#  else
#    define finite(x) (1.0 / fabs(x) > 0.0)
#  endif /* HAVE_FINITE */
#endif /* isfinite */

Ergo we do NOT need to change finite() -> isfinite(), and your headers should instead not be exporting HAVE_FINITE if it's not available. See also the HAVE_ISINF block in the same file.
Comment 6 SpanKY gentoo-dev 2011-04-30 02:57:24 UTC
nowhere does uClibc define HAVE_FINITE.  it does however #define isfinite.  so your own snippet shows the problem.  mysql does not correctly provide a replacement for finite() in its headers when HAVE_FINITE is not defined but isfinite is.
Comment 7 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2012-11-16 02:21:06 UTC
(In reply to comment #5)
> embedded:
> mysql-$PV/include/my_global.h contains the following (whitespace added for
> legibility):
> #ifndef isfinite
> #  ifdef HAVE_FINITE
> #    define isfinite(x) finite(x)
> #  else
> #    define finite(x) (1.0 / fabs(x) > 0.0)
> #  endif /* HAVE_FINITE */
> #endif /* isfinite */
> 
> Ergo we do NOT need to change finite() -> isfinite(), and your headers
> should instead not be exporting HAVE_FINITE if it's not available. See also
> the HAVE_ISINF block in the same file.

I've confirmed this is still present on mysql / mariadb 5.5.28, so I assume mysql will still fail to build on uclibc.
Comment 8 Rafał Mużyło 2012-11-16 13:35:38 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > Ergo we do NOT need to change finite() -> isfinite(), and your headers
> > should instead not be exporting HAVE_FINITE if it's not available. See also
> > the HAVE_ISINF block in the same file.
> 
> I've confirmed this is still present on mysql / mariadb 5.5.28, so I assume
> mysql will still fail to build on uclibc.

Actually, the answer lies in data no longer available.
From build log:
checking for finite... no

so config.log would have most likely given the answer, but it's not here and has been most likely long deleted since.
Comment 9 SpanKY gentoo-dev 2012-11-17 08:15:57 UTC
(In reply to comment #8)

you don't need a log to figure this out.  uclibc's libm doesn't provide finite().

$ readelf -sW /lib/libm.so.0  | grep finite
    15: 000081b0    17 FUNC    GLOBAL DEFAULT    8 __finitef
    24: 00008c80    36 FUNC    GLOBAL DEFAULT    8 __finitel
    25: 00006b88    35 FUNC    GLOBAL DEFAULT    8 __finite
Comment 10 Rafał Mużyło 2012-11-17 14:10:51 UTC
Lets change the question then.
For recent glibc, _GNU_SOURCE among other sets (in a way) -std=c99, so isinf/isfinite are defined.
Could is be that uclibc provides a combination of conditions for those two, that my_global.h doesn't cover correctly ?
Comment 11 SpanKY gentoo-dev 2012-11-17 19:06:31 UTC
(In reply to comment #10)

uClibc provides isinf/isfinite in the headers.  but configure is doing a link test for the finite symbols in libm which uClibc doesn't currently provide.

if all the code cares about is isinf/isfinite, then it should do a compile test on that and skip checking for specific finite symbols.