Bug 55 - Several compile problems due to libm
Summary: Several compile problems due to libm
Status: RESOLVED FIXED
Alias: None
Product: uClibc
Classification: Unclassified
Component: Other (show other bugs)
Version: 0.9.30.1
Hardware: PC Linux
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-15 20:09 UTC by rhabarber1848
Modified: 2009-12-18 23:39 UTC (History)
4 users (show)

See Also:
Host: x86
Target: ppc
Build:


Attachments
Complete readelf output for libm-0.9.30-svn.so (23.70 KB, application/octet-stream)
2009-01-19 15:02 UTC, rhabarber1848
Details
Patch to fix this bug (822 bytes, patch)
2009-01-19 17:44 UTC, rhabarber1848
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rhabarber1848 2009-01-15 20:09:02 UTC
I guess this patch produces some bugs:
http://sources.busybox.net/index.py?view=rev&sortby=file&revision=24487

UCLIBC_HAS_LONG_DOUBLE_MATH and DO_C99_MATH are both activated, gcc-3.4.6

All of the following packages compile with uClibc 0.9.30,
but not with uClibc SVN HEAD:

Busybox 1.7.2, libsndfile-1.0.17, libxml2-2.4.30

/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference to `__GI___finitel'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference to `__GI___isnanl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference to `__GI___signbitl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference to `__GI___fpclassifyl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference to `__GI___isinfl'
===========================================================================
libpng-1.2.16 configure produces this error message:

checking for pow... (cached) no
checking for pow in -lm... (cached) no
configure: error: cannot find pow

Here the corresponding config.log snippet
conftest.c:(.text+0xc): undefined reference to `pow'
===========================================================================
liboil-0.3.15

powerpc-tuxbox-linux-uclibc-gcc -pipe -Os -fPIC -Wl,-O1 -o .libs/build_prototypes build_prototypes-build_prototypes.o  ../liboil/.libs/liboil-0.3.so -lrt
../liboil/.libs/liboil-0.3.so: undefined reference to `sqrt'
../liboil/.libs/liboil-0.3.so: undefined reference to `floor'
../liboil/.libs/liboil-0.3.so: undefined reference to `rint'
../liboil/.libs/liboil-0.3.so: undefined reference to `cos'
../liboil/.libs/liboil-0.3.so: undefined reference to `sin'
../liboil/.libs/liboil-0.3.so: undefined reference to `floorf'
Comment 1 rhabarber1848 2009-01-16 17:57:54 UTC
I can confirm that the last working SVN revision is 24486,
revision 24487 is the first one producing the compile errors.
Comment 2 rhabarber1848 2009-01-17 11:12:46 UTC
My uClibc .config can be found here:
https://bugs.busybox.net/show_bug.cgi?id=53#c2
Comment 3 Denys Vlasenko 2009-01-19 03:18:16 UTC
Can you dump libm-0.9.30-svn.so and look whether pow() is in there?

powerpc-tuxbox-linux-uclibc-readelf -a -W libm-0.9.30-svn.so

I see this:

Symbol table '.dynsym' contains 215 entries:
...
   105: 000092f0    18 FUNC    GLOBAL DEFAULT    6 lrintf
   106: 000092ba    27 FUNC    GLOBAL DEFAULT    6 logbf
   107: 000092d5    27 FUNC    GLOBAL DEFAULT    6 logf
   108: 00004d12  1947 FUNC    GLOBAL DEFAULT    6 pow  <===
   109: 00009054    27 FUNC    GLOBAL DEFAULT    6 atanf
   110: 00009c95    28 FUNC    GLOBAL DEFAULT    6 sqrtl
   111: 00009ad8    45 FUNC    GLOBAL DEFAULT    6 modfl
   112: 00002624   216 FUNC    GLOBAL DEFAULT    6 atanh
...

Regarding this:

> checking for pow in -lm... (cached) no

Can you find out which example program configure runs here?
Comment 4 rhabarber1848 2009-01-19 15:01:45 UTC
libpng config.log shows this:

configure:20136: checking for pow in -lm
configure:20171: powerpc-tuxbox-linux-uclibc-gcc -o conftest -pipe -Os -fPIC  -Wl,-O1 conftest.c -lm   >&5
conftest.c:33: warning: conflicting types for built-in function 'pow'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference
to `__GI___finitel'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference
to `__GI___isnanl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference
to `__GI___signbitl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference
to `__GI___fpclassifyl'
/root/tuxbox/work_uclibc/image/cdk/lib/gcc/powerpc-tuxbox-linux-uclibc/3.4.6/../../../../powerpc-tuxbox-linux-uclibc/lib/nof/libm.so: undefined reference
to `__GI___isinfl'
collect2: ld returned 1 exit status


pow is part of libm here:
# ../../image/cdk/bin/powerpc-tuxbox-linux-uclibc-readelf -a -W ../../image/cdkroot/lib/libm-0.9.30-svn.so | grep pow
    24: 00010f64    84 FUNC    GLOBAL DEFAULT    6 powf
   114: 000088c0  4232 FUNC    GLOBAL DEFAULT    6 pow
   183: 000114dc    12 FUNC    GLOBAL DEFAULT    6 powl

The error in libpng configure seems related to the busybox/libsndfile/libxml2 problems, here is some other data from libm:

# ../../image/cdk/bin/powerpc-tuxbox-linux-uclibc-readelf -a -W ../../image/cdkroot/lib/libm-0.9.30-svn.so | grep "finitel\|isnanl\|signbitl\|fpclassifyl\|isinfl"
     3: 00011390    12 FUNC    GLOBAL DEFAULT    6 __isnanl
    25: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___finitel
    40: 00011338    12 FUNC    GLOBAL DEFAULT    6 __fpclassifyl
    52: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___isnanl
    68: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___signbitl
   139: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___fpclassifyl
   142: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___isinfl
   143: 00011530     8 FUNC    GLOBAL DEFAULT    6 __signbitl
   186: 00011384    12 FUNC    GLOBAL DEFAULT    6 __isinfl
   221: 000112e4    12 FUNC    GLOBAL DEFAULT    6 __finitel

# ../../image/cdk/bin/powerpc-tuxbox-linux-uclibc-readelf --version
GNU readelf 2.17.50.0.9 20070103
Comment 5 rhabarber1848 2009-01-19 15:02:55 UTC
Created attachment 31 [details]
Complete readelf output for libm-0.9.30-svn.so
Comment 6 rhabarber1848 2009-01-19 17:44:15 UTC
Comparing uClibc 0.9.30 and uClibc SVN HEAD

# cdk/bin/powerpc-tuxbox-linux-uclibc-readelf -a -W cdkroot/lib/libm-0.9.30.so | grep signbit
    75: 000107c0    16 FUNC    GLOBAL DEFAULT    6 __signbit
   194: 000107d0    16 FUNC    GLOBAL DEFAULT    6 __signbitf

# cdk/bin/powerpc-tuxbox-linux-uclibc-readelf -a -W cdkroot/lib/libm-0.9.30-svn.so | grep signbit
    68: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __GI___signbitl
    77: 00010594    16 FUNC    GLOBAL DEFAULT    6 __signbit
   143: 00011530     8 FUNC    GLOBAL DEFAULT    6 __signbitl
   197: 000105a4    16 FUNC    GLOBAL DEFAULT    6 __signbitf

lead me to try the attached patch which removes libm_hidden_def for the problematic functions. libm now looks like this:

# cdk/bin/powerpc-tuxbox-linux-uclibc-readelf -a -W cdkroot/lib/libm-0.9.30-svn.so | grep signbit
    74: 00010518    16 FUNC    GLOBAL DEFAULT    6 __signbit
   138: 000114b4     8 FUNC    GLOBAL DEFAULT    6 __signbitl
   192: 00010528    16 FUNC    GLOBAL DEFAULT    6 __signbitf

Well, thats better, isn't it? libpng compiles now:

checking for pow... no
checking for pow in -lm... yes
Comment 7 rhabarber1848 2009-01-19 17:44:54 UTC
Created attachment 33 [details]
Patch to fix this bug
Comment 9 Denys Vlasenko 2009-01-20 00:50:09 UTC
Applied, thanks!

Please try svn and confirm that it works for you.
Comment 10 rhabarber1848 2009-01-20 11:45:31 UTC
Thanks, this bug is solved.
Comment 11 rhabarber1848 2009-01-21 21:27:02 UTC
I think this patch should also be applied to branches/uClibc_0_9_30 as well
because the broken code also made it into that branch:
http://sources.busybox.net/index.py/branches/uClibc_0_9_30/libm/ldouble_wrappers.c?r1=24011&r2=24489&pathrev=24489
Comment 12 rhabarber1848 2009-01-22 19:43:14 UTC
Fixed in rev 24963
http://lists.uclibc.org/pipermail/uclibc-cvs/2009-January/025891.html
Comment 13 Milos Jakubicek 2009-04-18 12:46:33 UTC
Unfortunately I'm still getting the following error (with 0.9.30.1) on ppc:

gcc -c libm/ldouble_wrappers.c -o libm/finitel.o -include ./include/libc-symbols.h -Wall -Wstrict-prototypes -fno-strict-aliasing -DHAVE_ASM_PPC_REL16 -fno-stack-protector -fno-builtin -nostdinc -I./include -I. -I./libc/sysdeps/linux/powerpc -fno-asm -DUCLIBC_INTERNAL -DSTATIC -std=gnu99 -Os -funit-at-a-time -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -I./kernel-include/ -I/usr/lib/gcc/ppc64-redhat-linux/4.4.0//include-fixed -I/usr/lib/gcc/ppc64-redhat-linux/4.4.0/include -DNDEBUG -DNOT_IN_libc -DIS_IN_libm -D_IEEE_LIBM -MT libm/finitel.o -MD -MP -MF libm/.finitel.o.dep -DL_finitel
libm/ldouble_wrappers.c:561: error: '__EI___finitel' aliased to undefined symbol '__GI___finitel'

(Disabling C99 math is a workaround.)
Comment 14 Denys Vlasenko 2009-04-21 01:51:05 UTC
Milos, does this happen to you on current svn?

Also, please attach your .config
Comment 15 Bernhard Reutner-Fischer 2009-12-18 23:39:07 UTC
Fixed in 0.9.30.2