[uClibc]Dynamic Linking uClibc.0.9.12 ?

Trilok trilok_soni at tectonas.com
Sat Jul 27 05:29:33 UTC 2002


Hi All,    
    First of all I want to ask you that Is it possible to use Dynamic Linking with uClibc.0.9.12?. I had tried static linking and it is working, sacrificing size of executable on target. Well, I had successfully created ARM Linux toolchain for CDB89712 using Roland Seuhs' page. You can also refer this page from my site http://www.tectonas.com -> Articles section.

After creation of toolchain I wanted to execute simple Hello,World program using Dynamic Linking. So Here is my program:

------hello.c-------------
#include <stdio.h>
int main( void ){
    printf("Hello, World\n");
    return 0;
}
----end of hello.c------

and here is the Makefile I am using for static / dynamic linking. But I am failed in dynamic linking so just verify what's wrong in dyna linking with uClibc.0.9.12/
----------------------Makefile----------------------------
#
#set compiler
#
CC=arm-linux-gcc

#
#set uclibc path
#
ifndef UCLIBC_DEVEL
 UCLIBC_DEVEL = $(ARM_ROOT)/arm-linux-uclibc
endif

#
#set include header files
#
INCLUDEDIR=$(ARM_ROOT)/arm-linux-uclibc/include

#
#set library path
#
LIBDIR=$(UCLIBC_DEVEL)/lib

#
#Explicitly list libraries required
#
LIBRARIES = -L$(shell arm-linux-gcc --print-libgcc) -lgcc -lc $(LIBDIR)/libuClibc-0.9.12.so $(LIBDIR)/libc.a -ldl $(LIBDIR)/libdl-0.9.12.so

#set extra flags
#LDFLAGS += -nostdlib -Wl,--dynamic-linker $(ARM_ROOT)/arm-linux-uclibc/lib/crt0.o $(ARM_ROOT)/arm-linux-uclibc/lib/crti.o $(ARM_ROOT)/arm-linux-uclibc/lib/crtn.o

#
#search path arm-linux-gcc
#
GCCINCDIR=$(shell arm-linux-gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")

#
#uClibc CFLAGS
#
UCLIBC_CFLAGS += -nostdinc -I$(UCLIBC_DEVEL)/include -I$(GCCINCDIR) -s 

#set extra ld flags
LDFLAGS += -nodefaultlibs -nostdlib\
    -L$(LIBDIR) \
    -Wl,--rpath-link,$(LIBDIR) \
    -Wl,--dynamic-linker $(LIBDIR)/crt0.o $(LIBDIR)/crti.o $(LIBDIR)/crtn.o \
    $(LIBRARIES)  

hello-static: 
     $(CC) -I$(INCLUDEDIR) --static -L$(LIBDIR) -v -o hello hello.c -lgcc -lc
hello-dynamic:
     $(CC) $(UCLIBC_CFLAGS) $(LDFLAGS) -v -o hello hello.c 

----------- End of Makefile----------------------------

Regards,

Trilok Soni.
trilok_soni at tectonas.com
Sr. Software Enginer.
Tectona SoftSolutions(P) Ltd.
http://www.tectonas.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20020727/fa7a887b/attachment-0001.htm 


More information about the uClibc mailing list