Hello,


a-ha. so you refuse to talk, do you? well, we have methods that'll make
you sing!

I am willing to sing as needed , and in fact in this reply (and in future, if needed; there's nothing to hide) I will sing as needed, and I hope
that I will be able to burst in a song when the problem is solved.


I want to clarify myself:
I simply made many tests (more than 10), and it seems to me pointless to
post them all; I used flags like -nostdinc and -Wl,-dynamic-linker; also set LD_PRELOAD
and LD_LIBRARY_PATH; Tried static and non-static build; In in case
when compilation succeeded in non-static build, the ldd pointed to the new libraries; but running it
gave a core dump ; But it seems
less important now.


I tried to follow your suggestion and help somebody can help as I spent quite a time
on it .


I do not have , under /usr/lib/gcc-lib/, a crt1.o (also not a symlink to /usr/lib).
So I used the /usr/lib/crt1.o.


I use gcc (GCC) 3.2.2 on Red Hat 9 ; the new glibc libs I had built is in /work/myglibc/lib
when trying, as I understoof from your suggestion,to compile with
gcc -static -nostdlib -L/work/myglibc/lib -lc /usr/lib/crt1.o test.c -o test
I got:
usr/lib/crt1.o(.text+0xc): In function `_start':
./sysdeps/i386/elf/start.S:71: undefined reference to `__libc_csu_fini'
/usr/lib/crt1.o(.text+0x11):../sysdeps/i386/elf/start.S:72: undefined reference
to `__libc_csu_init'
/usr/lib/crt1.o(.text+0x1d):../sysdeps/i386/elf/start.S:81: undefined reference
to `__libc_start_main'
collect2: ld returned 1 exit status



Probing and Googling a bit showed that maybe it should get these symbol from
libc_nonshared , so I tried
gcc -static -nostdlib -L/work/myglibc/lib -lc -lc_nonshared /usr/lib/crt1.o test.c


and (strangely) got the same error.

(BTW, in my tests I did verified by ldd (in cases when compilation succeeded) that it pointed
to the new glibc)



Any idea?

Regards,
Amir







From: guy keren <[EMAIL PROTECTED]>
To: Amir Binyamini <[EMAIL PROTECTED]>
CC: linux-il@linux.org.il
Subject: Re: A second glibc on Linux
Date: Tue, 29 Mar 2005 18:20:51 +0200 (IST)


On Tue, 29 Mar 2005, Amir Binyamini wrote:

> I made some tests with setting LD_LIBRARY_PATH and LD_PRELOAD (before
> sending my fisrt post
> in this thread) and they failed; (I had a crash in run time).Again , I
> don't think the details are important because I made many tries and I am not
> an expert in glibc;
> Hpwever,If somebody have success in compiling and running hello_world with a
> new glibc which is installed
> in a private (non-system) folder, I will appreciate telling us how.


a-ha. so you refuse to talk, do you? well, we haev methods that'll make
you sing!

first thing - you need to make sure gcc does not link in the system's
standard C library. it has a flag named '-nostdlib', which excludes
linking of these files.

second, you need to tell it to do link the private copy of the standard C
library that you've compiled.

third, you'll need to link in gcc's 'crt1.o' object file, which contains
the code that performs runtime initialization of a C source file. on my
(very very old) system, it is found at
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o, which is
actually /usr/lib/crt1.o .

after you get this done, run 'ldd' on the resulting binary - see where it
points to. if it points to the wrong glibc, set LD_LIBRARY_PATH to have
the privave glibc's 'lib' library at the front, and check again with
'ldd'. tweak it until finally ldd points to the right glibc.

as for 'ld.so' - you can avoid using it, by compiling with the '-static'
flag. don't say "but i need it linked dynamically" - you'll get that
solved later, after you solve the static linking issues, first.

finally, if you still don't manage to get these things done, and you come
here with "i don't want to write what i tried, because i tried many things
and it must be a straightforward thing to do" - we'll send ScsiMan after
you, and then you'll be bound to talk - you have been warned...

do note that last i did such things was several years ago, and i have no
intentions of compiling a glibc library here now just because _you_ are
too lazy to give the details and to make the experimentation.

--
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]


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



================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to