undefined reference to `__libc_stack_end@GLIBC_PRIVATE - newbie

John Que qwejohn@hotmail.com
Mon Mar 14 14:32:00 GMT 2005


Hello,
First,thanks a lot; it seems that you are right.

Second, I had googled and researched more on glibc:
I do succeed now in building a program with the new
glibc I had built ; Alas, I cannot run it;
can anybody please help ?
what am I doing wrong ?

What I did is:
my --prefix for configure glibc is /work/src/glibc-2.3.2-prefix;
I ran make install and make check for glibc  (both were OK).

Now I had compiled a little program (named test_printf.c) like thus:

gcc  -I/work/src/glibc-2.3.2-prefix/include -g test_printf.c  -nostdlib 
-nostartfiles 
-Wl,-dynamic-linker=/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 
/work/src/glibc-2.3.2-prefix/lib/crt1.o 
/work/src/glibc-2.3.2-prefix/lib/crti.o  -L/work/src/glibc-2.3.2-prefix/lib 
/work/src/glibc-2.3.2-prefix/lib/libdl.so.2 -lc 
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 
/work/src/glibc-2.3.2-prefix/lib/libc_nonshared.a -lgcc `gcc 
--print-file-name=crtend.o` /work/src/glibc-2.3.2-prefix/lib/crtn.o -o 
test_printf

this build succeed. I had verified that the generated executable file , 
test_print, is linked with the correct new
glibc libraries this:

APPOLO:/work/dev/tests/misc# ldd test_printf
        libdl.so.2 => /work/src/glibc-2.3.2-prefix/lib/libdl.so.2 
(0x40016000)
        libc.so.6 => /work/src/glibc-2.3.2-prefix/lib/libc.so.6 (0x40019000)
        /work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 => 
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 (0x40000000)


and I am trying to run it like thus:

I wrote a script named run.sh with the following 3 lines:

LD_PRELOAD=/work/src/glibc-2.3.2-prefix/lib/ld-2.3.2.so
LD_LIBRARY_PATH=/work/src/glibc-2.3.2-prefix/lib
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 ./test_printf

when I type  ./run.sh I get segmentation fault and a core dump.
with gdb backtracking I get the following:

bt
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x080483ad in __do_global_ctors_aux ()
#2  0x08048274 in _init ()
#3  0x0804833a in __libc_csu_init () at elf-init.c:60
#4  0x40019887 in __libc_start_main (main=0x80482a8 <main>, argc=1,
    ubp_av=0xbfffe068, init=0x8048330 <__libc_csu_init>,
    fini=0x8048360 <__libc_csu_fini>, rtld_fini=0x80013020 <_rtld_local>,
    stack_end=0x8048330) at ../sysdeps/generic/libc-start.c:139

Any idea ? what am I doing wrong here?

Regards,
John


>From: Mike Hearn <mike@navi.cx>
>To: libc-alpha@sources.redhat.com
>Subject: Re: undefined reference to `__libc_stack_end@GLIBC_PRIVATE - 
>newbie
>Date: Mon, 14 Mar 2005 09:55:10 +0000
>
>On Sun, 13 Mar 2005 17:21:51 +0200, John Que wrote:
> > I wrote a simple test.c program which only perform one printf();
> >
> > I run gcc -L /work/my_glibc/lib test.c
>
>That's not how you compile against a new glibc, AFAIK. You would probably
>need to use the new dynamic linker as well at minimum. I think there are
>instructions floating around the web for how to do that.
>
>thanks -mike
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Libc-alpha mailing list