Hi, With some hack in the Busybox-1.14.3/Makefile.flags (please below the code change), i am now able to compile the busybox with uClibc-0.9.30.1
=====Makefile.flag (added CFLAGS to include the include directory of uClibc==== LIBCDIR:=../uClibc-0.9.30 # # For other libraries, you are on your own. But these may (or may not) help... LDFLAGS+=-nostdlib LIBRARIES:=$(LIBCDIR)/lib/libc.a $(LIBCDIR)/lib/crt1.o $(LIBCDIR)/lib/crti.o $(LIBCDIR)/lib/crtn.o -lgcc GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) CROSS_CFLAGS+=-I$(LIBCDIR)/include -I$(GCCINCDIR) CFLAGS += $(CROSS_CFLAGS) ================================================================= With the above change, the code compiles neatly, however, at the time of linking, I get the following error: CC util-linux/losetup.o CC util-linux/mount.o CC util-linux/umount.o AR util-linux/lib.a LD util-linux/volume_id/built-in.o AR util-linux/volume_id/lib.a LINK busybox_unstripped Trying libraries: crypt m Library crypt is not needed, excluding it Library m is not needed, excluding it Final link with: <none> strip: there are no sections to be copied! make: *** [busybox] Error 1 busybox_unstripped file is created but it is definitely a faulty one as its size is too less(499 bytes). The busybox_unstripped.map file has no entry to mapping to uClibc files. >From the error "strip: there are no sections to be copied!", I believe that >the linker is unable to map the code and data sections due to which the binary >generated is not complete. I think I may be missing to add some variable to the linker so that the binary is mapped properly. If anyone of you have come across the same issue, please let me know what other change should be made that busybox compiles with uClibc successfully. Thanks for any help Sushil [[ JUst wanted to add I used buildroot and I successfully compiled the busybox. BUt my req. is without using buildroot ]] --- On Sat, 10/10/09, Sushil Kumar <[email protected]> wrote: From: Sushil Kumar <[email protected]> Subject: Re: busybox-1.14.3 compilation with uClibc To: "Bernhard Reutner-Fischer" <[email protected]> Cc: [email protected] Date: Saturday, October 10, 2009, 12:07 AM Hi Bernhard, Thanks for your help. Though, I did not wanted to go "buildroot" method ( as my requirement is specific : gcc-4.1.1, target arch-i386, busybox-1.14.3, uClibc-0.9.31.1), I thought of giving it a try. However, on configuring buildroot, I could not find gcc-4.1.1 option (yes, it's quite old now but that's my requirement). If you have any "pointers" for me --> what all changes are required in the busybox Makefile to successfully compile with uClibc, it would really help me. I did this in the earlier busybox version and the latest busybox Makefile seems to be too complex. My requirement is to create initrd using busybox (statically linked) and uClib as my C library. Thanks Sushil --- On Fri, 10/9/09, Bernhard Reutner-Fischer <[email protected]> wrote: From: Bernhard Reutner-Fischer <[email protected]> Subject: Re: busybox-1.14.3 compilation with uClibc To: "walter harms" <[email protected]> Cc: "Sushil Kumar" <[email protected]>, [email protected] Date: Friday, October 9, 2009, 9:59 PM On Fri, Oct 09, 2009 at 06:19:18PM +0200, walter harms wrote: > > >Sushil Kumar schrieb: >> Hi Walter Harms/vda, >> >> Thanks for your reply. >> Took the latest uClibc-0.9.30.1 tar and successfully compiled it is using >> the native glibc. >> >> I made some changes in the busybox/Makefile.flags to include uClib library >> path and compiled the busybox using the latest uClibc-0.9.30.1 C library and >> I got lots of erreor as can be seen below. >> Thinking, error in my approach, I wrote a simple "hello world" program and >> tried to compile this using uClibc library. I got the similar error related >> to the uClibc/include headers while compiling the busybox. >> I have used the following command to compile my test program. >> gcc -nostdlib -I../uClibc-0.9.30.1/include >> -I/usr/lib/gcc/i386-redhat-linux/4.1.1/include/ test.c >> >> as suggested I followed the approach given at >> tldp.org/Glibc-HOWTO.html#toc10, to compile a program with C library, other >> than glibc. >> >> Please let me know what I am doing wrong. Further, in the latest busybox >> (1.14.3), the linking of files are done using scripts/trylink. Can we not >> link the program using any direct command. >> Thanks >> Sushil >> >> Included below are some lines of compilation error of my test program >> ========================================== >> >> busybox-1.14.3]#gcc -nostdlib -I../uClibc-0.9.30.1/include >> -I/usr/lib/gcc/i386-redhat-linux/4.1.1/include/ test.c >> In file included from ../uClibc-0.9.30.1/include/pthread.h:21, >> from ../uClibc-0.9.30.1/include/bits/uClibc_mutex.h:15, >> from ../uClibc-0.9.30.1/include/bits/uClibc_stdio.h:119, >> from ../uClibc-0.9.30.1/include/stdio.h:72, >> from test.c:1: >> ../uClibc-0.9.30.1/include/time.h: In function ‘libc_hidden_proto’: >> ../uClibc-0.9.30.1/include/time.h:346: error: storage class specified for >> parameter ‘clock_gettime’ >mmh that look if the header is missing something, no clue what. >it is long time since i last tried uClibc, did you also try the "-muclibc" to >gcc as suggested by bernhard ? that won't work, he tries to use uninstalled headers. Sushil, i'd recommend you build a proper cross-compiler (git clone git://git.uClibc.org/buildroot) && cd buildroot && make menuconfig) That gives you a nice cross-compiler with sysroot support (i.e. easily relocatable) that you can use to build whatever app you like. HTH,
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
