Problems building with uClibc

May 18, 2004 5 Replies

I'm having problems building against uClibc.. It seems that it always wants to link in gcc-lib too. How can I stop it ? Here are some examples



Starting with Busybox, I get a lot of duplicate definitions



$ make gcc -s -Wl,-warn-common --static -o busybox ash.o basename.o cat.o chgrp.o chmod .o chown.o chroot.o chvt.o clear.o cmdedit.o cp.o cut.o date.o dd.o df.o dirname .o dmesg.o du.o echo.o env.o find.o free.o grep.o gunzip.o gzip.o halt.o head.o id.o init.o kill.o klogd.o ln.o logger.o ls.o lsmod.o mkdir.o mknod.o mkswap.o m odprobe.o more.o mount.o mv.o pidof.o poweroff.o ps.o pwd.o reboot.o reset.o rm. o rmdir.o sed.o sleep.o sort.o swaponoff.o sync.o syslogd.o tail.o tar.o test.o touch.o true_false.o tty.o umount.o uname.o uniq.o uptime.o wc.o which.o whoami. o xargs.o yes.o busybox.o usage.o applets.o libbb.a /usr/src/uClibc-0.9.26/lib/libc.a /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libc.a(open.o): In function `__libc_open': __libc_open(.text+0x0): multiple definition of `__libc_open' /usr/src/uClibc-0.9.26/lib/libc.a(__syscall_open.o)(.text+0x0): first defined here /usr/bin/ld: Warning: size of symbol `__libc_open' changed from 61 to 33 in open .o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libc.a(close.o): In function `__libc_close': __libc_close(.text+0x0): multiple definition of `__libc_close' /usr/src/uClibc-0.9.26/lib/libc.a(__libc_close.o)(.text+0x0): first defined here /usr/bin/ld: Warning: size of symbol `__libc_close' changed from 45 to



27 in close.o . . and so on.

If I try to build the classis printf("hello, world") it builds OK, but it doesn't seem to have used uClibc at all



$ gcc -Wall hello.c -L/usr/src/uClibc-0.9.26/lib/libc.a -o hello $ ldd hello libc.so.6 => /lib/libc.so.6 (0x40020000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)



Where am I going wrong ?


Hello noreply,

You probabaly need -nostdlib and -nostdinc options to gcc

gcc -Wall -nostdlib -nostdinc -I/usr/src/uClibc-0.9.26/include hello.c

-L/usr/src/uClibc-0.9.26/lib/libc.a -o hello

or something similar.

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Damion de Soto - Software Engineer email: snipped-for-privacy@snapgear.com SnapGear - A CyberGuard Company --- ph: +61 7 3435 2809 | Custom Embedded Solutions fax: +61 7 3891 3630 | and Security Appliances web:

formatting link
--- Free Embedded Linux Distro at
formatting link
---

Thanks for the reply.

As hinted in your reply, my include path was also wrong.

Problems now fixed.. Many thanks.

Dami> Hello noreply,

Did you use the uclibc toolchain? This is a whole set of compiler, linker etc that is patched to use the uclibc rather than the glibc. see

formatting link

For some reason my system is incompatible with gcc3.3 . So I had to refrain to the special gcc2.95 toolchain build script available at

formatting link

Hope that helps, ------

Kai-Martin Knaak kmkn@tem-messtechnik.de gpg-key: http://pgp.mit.edu:11371/pks/lookup?search=kai-martin&op=index&exact=on
[ Please don't post your reply before the text you're replying to, and delete irrelevant bits of the text you're replying to. ]

cross

You used a toolchain. The word "toolchain", in an embedded context, means a compiler, linker, debugger, and library set used to generate executable programs.

Based on the error message you're getting, you used the wrong toolchain, or one that isn't configured to use uclibc.

Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.8" / 37N 20' 14.9" Internet: steve @ Watt.COM Whois: SW32 Free time? There's no such thing. It just comes in varying prices...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required