This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Build a program using a custom glibc
- From: Amittai Aviram <amittai dot aviram at yale dot edu>
- To: libc-help at sourceware dot org
- Date: Fri, 25 May 2012 23:28:08 -0400
- Subject: Build a program using a custom glibc
I have managed to build glibc 2.14 and install it in directory ~/glibc/glibc_install. So now I want to build and run programs using this C library instead of my system's default C library. First, to be sure that I was using my custom glibc, I added a call to puts into glibc/stdio-common/printf.c:__printf to print a message. Then I rebuilt and reinstalled glibc. Then I wrote a "Hello, World" program and built (compiled and linked) it as follows:
gcc -nodefaultlibs -static -libgcc -L~/GLIBC/glibc_install/lib -o myprog myprog.c
But I get the following linker error report:
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
(.text+0x25): undefined reference to `__libc_start_main'
/tmp/ccACTQEp.o: In function `main':
c1.c:(.text+0xa): undefined reference to `puts'
collect2: ld returned 1 exit status
What am I doing wrong? Thanks!
Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com