* system inc and dynamic linker change
@ 2005-09-15 9:41 KRAJCSOVITS Gyorgy
2005-09-15 9:47 ` Aseem Rastogi
0 siblings, 1 reply; 7+ messages in thread
From: KRAJCSOVITS Gyorgy @ 2005-09-15 9:41 UTC (permalink / raw)
To: gcc-help
Hi,
I'd like to compile a gcc that uses:
- /opt23/usr/include instead of /usr/include
(and similar for other system include dirs)
- instructs linker to use /opt23/lib/ld-linux.so.2 instead of
/lib/ld-linux.so.2
(Maybe this is a binutils issue, but it seems like binutils gets its
deafults from gcc when compiling binutils)
The idea is to be able to compile programs for another glibc, but I'm not
root, so I won't be able to use it in it's normal location. So
/lib/ld-linux.so.2 won't point to the new one.
I tried to create a cross compile toolchain but was unsuccessfull so far.
Is there a way to change the dynamic linker of an existing application ?
From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
bye, krajo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 9:41 system inc and dynamic linker change KRAJCSOVITS Gyorgy
@ 2005-09-15 9:47 ` Aseem Rastogi
2005-09-15 9:56 ` KRAJCSOVITS Gyorgy
0 siblings, 1 reply; 7+ messages in thread
From: Aseem Rastogi @ 2005-09-15 9:47 UTC (permalink / raw)
To: KRAJCSOVITS Gyorgy; +Cc: gcc-help
i am not sure about existing application but for a new program
-Wl,--dynamic-linker option works. i successfully did it for simple
hello world kind of programs but when i created shared libraries using
this option, it didn;t work and they seemed to be linked to default linker.
try compiling gcc with this option to escape --dynamic-linker everytime.
regards,
aseem.
KRAJCSOVITS Gyorgy wrote:
> Hi,
>
> I'd like to compile a gcc that uses:
> - /opt23/usr/include instead of /usr/include
> (and similar for other system include dirs)
>
> - instructs linker to use /opt23/lib/ld-linux.so.2 instead of
> /lib/ld-linux.so.2
> (Maybe this is a binutils issue, but it seems like binutils gets its
> deafults from gcc when compiling binutils)
>
> The idea is to be able to compile programs for another glibc, but I'm
> not root, so I won't be able to use it in it's normal location. So
> /lib/ld-linux.so.2 won't point to the new one. I tried to create a
> cross compile toolchain but was unsuccessfull so far.
>
> Is there a way to change the dynamic linker of an existing application ?
>
>> From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
>
>
> bye, krajo
>
>
--
The end is always good. If it's not good, it's not the end.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 9:47 ` Aseem Rastogi
@ 2005-09-15 9:56 ` KRAJCSOVITS Gyorgy
2005-09-15 10:07 ` Aseem Rastogi
0 siblings, 1 reply; 7+ messages in thread
From: KRAJCSOVITS Gyorgy @ 2005-09-15 9:56 UTC (permalink / raw)
To: Aseem Rastogi; +Cc: gcc-help
Hi, thanks for the reply,
yes -Wl,--dynamic-linker works, but when I'm compiling big programs it
is sometimes impossible (ok, very hard) to change the linker for every
link step. It would be better to have gcc (or ld) automatically do this.
And I need gcc to search other directories for system header files as
well.
bye, krajo
On Thu, 15 Sep 2005, Aseem Rastogi wrote:
> i am not sure about existing application but for a new program
> -Wl,--dynamic-linker option works. i successfully did it for simple hello
> world kind of programs but when i created shared libraries using this option,
> it didn;t work and they seemed to be linked to default linker.
>
> try compiling gcc with this option to escape --dynamic-linker everytime.
>
> regards,
> aseem.
>
> KRAJCSOVITS Gyorgy wrote:
>
>> Hi,
>>
>> I'd like to compile a gcc that uses:
>> - /opt23/usr/include instead of /usr/include
>> (and similar for other system include dirs)
>>
>> - instructs linker to use /opt23/lib/ld-linux.so.2 instead of
>> /lib/ld-linux.so.2
>> (Maybe this is a binutils issue, but it seems like binutils gets its
>> deafults from gcc when compiling binutils)
>>
>> The idea is to be able to compile programs for another glibc, but I'm not
>> root, so I won't be able to use it in it's normal location. So
>> /lib/ld-linux.so.2 won't point to the new one. I tried to create a cross
>> compile toolchain but was unsuccessfull so far.
>>
>> Is there a way to change the dynamic linker of an existing application ?
>>
>>> From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
>>
>>
>> bye, krajo
>>
>>
>
>
> --
> The end is always good. If it's not good, it's not the end.
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 9:56 ` KRAJCSOVITS Gyorgy
@ 2005-09-15 10:07 ` Aseem Rastogi
2005-09-15 12:08 ` KRAJCSOVITS Gyorgy
0 siblings, 1 reply; 7+ messages in thread
From: Aseem Rastogi @ 2005-09-15 10:07 UTC (permalink / raw)
To: KRAJCSOVITS Gyorgy; +Cc: gcc-help
did you try compiling gcc itself with -Wl,--dynamic-linker ? the new gcc
then should then default link to ur custom glibc. also, if you can find
some solution to shared library problem that i mentioned, it would be
very helpful.
aseem.
KRAJCSOVITS Gyorgy wrote:
> Hi, thanks for the reply,
>
> yes -Wl,--dynamic-linker works, but when I'm compiling big programs
> it is sometimes impossible (ok, very hard) to change the linker for
> every link step. It would be better to have gcc (or ld) automatically
> do this.
> And I need gcc to search other directories for system header files
> as well.
>
>
> bye, krajo
>
> On Thu, 15 Sep 2005, Aseem Rastogi wrote:
>
>> i am not sure about existing application but for a new program
>> -Wl,--dynamic-linker option works. i successfully did it for simple
>> hello world kind of programs but when i created shared libraries
>> using this option, it didn;t work and they seemed to be linked to
>> default linker.
>>
>> try compiling gcc with this option to escape --dynamic-linker everytime.
>>
>> regards,
>> aseem.
>>
>> KRAJCSOVITS Gyorgy wrote:
>>
>>> Hi,
>>>
>>> I'd like to compile a gcc that uses:
>>> - /opt23/usr/include instead of /usr/include
>>> (and similar for other system include dirs)
>>>
>>> - instructs linker to use /opt23/lib/ld-linux.so.2 instead of
>>> /lib/ld-linux.so.2
>>> (Maybe this is a binutils issue, but it seems like binutils gets its
>>> deafults from gcc when compiling binutils)
>>>
>>> The idea is to be able to compile programs for another glibc, but
>>> I'm not root, so I won't be able to use it in it's normal location.
>>> So /lib/ld-linux.so.2 won't point to the new one. I tried to create
>>> a cross compile toolchain but was unsuccessfull so far.
>>>
>>> Is there a way to change the dynamic linker of an existing
>>> application ?
>>>
>>>> From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
>>>
>>>
>>>
>>> bye, krajo
>>>
>>>
>>
>>
>> --
>> The end is always good. If it's not good, it's not the end.
>>
>>
>>
>
--
The end is always good. If it's not good, it's not the end.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 10:07 ` Aseem Rastogi
@ 2005-09-15 12:08 ` KRAJCSOVITS Gyorgy
2005-09-15 12:18 ` KRAJCSOVITS Gyorgy
0 siblings, 1 reply; 7+ messages in thread
From: KRAJCSOVITS Gyorgy @ 2005-09-15 12:08 UTC (permalink / raw)
To: Aseem Rastogi; +Cc: gcc-help
Hi,
seems like I got it working the way I wanted it, this is what I did:
(On Suse linux 8 with glibc 2.2)
Configure, compile and install glibc-2.3.5 into /opt23
--------------------------
Configure and compile binutils against glibc-2.3.5 headers, then in the
binutils src dir:
find . -name Makefile -a -exec grep -q "^LDFLAGS[[:space:]]*=" '{}' \; -a
-print | while read i ; do mv $i $i.ori ; cat $i.ori | awk --
'/^LDFLAGS[[:space:]]*=[[:space:]]*$/ { print "LDFLAGS = -B /opt23/lib
-Wl,-rpath-link,/opt23/lib,--dynamic-linker,/opt23/lib/ld-linux.so.2";
}\
! /^LDFLAGS[[:space:]]*=[[:space:]]*$/ { print }' > $i ; done
Now I ran "make" again, then "make install"
This way I got as,ld,ar,... linked with new glibc.
---------------------------
For gcc, first I edited "gcc-3.4.4/gcc/config/i386/linux.h" file in the
gcc source directory and replaced:
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}
with:
%{!dynamic-linker:-dynamic-linker /opt23/lib/ld-linux.so.2}}
Set CFLAGS, CXXFLAGS to:
"-B /opt23/bin -B /opt23/lib -isystem /opt23/usr/include"
In the build directory I ran:
"../gcc-3.4.4/configure --with-sysroot=/opt23
--enable-threads=posix --prefix=/opt23"
Then edited the created Makefile to change:
LDFLAGS =
into
LDFLAGS = -B /opt23/lib
-Wl,-rpath-link,/opt23/lib,--dynamic-linker,/opt23/lib/ld-linux.so.2
Now a quick "make", "make install" and I got myself a gcc in /opt23/bin
(need to put it into first place of $PATH) that creates executables that
are linked against /opt23/lib/ld-linux.so.2 and /opt23/lib/libc.so.6
$ gcc -o test test.c
$ ldd ./test
libc.so.6 => /opt23//lib/libc.so.6 (0x4001b000)
/opt23/lib/ld-linux.so.2 (0x40000000)
I tested moving /opt/include/stdio.h away, gcc cannot find it anymore, so
it searches system headers at the new place.
Of course I need to test it further.
Why is it that the configure script for gcc-3.4.4 creates a Makefile that
destroys the LDFLAGS env variable ?
Now I'm going to try and build some real programs...
bye, krajo
On Thu, 15 Sep 2005, Aseem Rastogi wrote:
> did you try compiling gcc itself with -Wl,--dynamic-linker ? the new gcc then
> should then default link to ur custom glibc. also, if you can find some
> solution to shared library problem that i mentioned, it would be very
> helpful.
>
> aseem.
>
> KRAJCSOVITS Gyorgy wrote:
>
>> Hi, thanks for the reply,
>>
>> yes -Wl,--dynamic-linker works, but when I'm compiling big programs it is
>> sometimes impossible (ok, very hard) to change the linker for every link
>> step. It would be better to have gcc (or ld) automatically do this.
>> And I need gcc to search other directories for system header files as
>> well.
>>
>>
>> bye, krajo
>>
>> On Thu, 15 Sep 2005, Aseem Rastogi wrote:
>>
>>> i am not sure about existing application but for a new program
>>> -Wl,--dynamic-linker option works. i successfully did it for simple hello
>>> world kind of programs but when i created shared libraries using this
>>> option, it didn;t work and they seemed to be linked to default linker.
>>>
>>> try compiling gcc with this option to escape --dynamic-linker everytime.
>>>
>>> regards,
>>> aseem.
>>>
>>> KRAJCSOVITS Gyorgy wrote:
>>>
>>>> Hi,
>>>>
>>>> I'd like to compile a gcc that uses:
>>>> - /opt23/usr/include instead of /usr/include
>>>> (and similar for other system include dirs)
>>>>
>>>> - instructs linker to use /opt23/lib/ld-linux.so.2 instead of
>>>> /lib/ld-linux.so.2
>>>> (Maybe this is a binutils issue, but it seems like binutils gets its
>>>> deafults from gcc when compiling binutils)
>>>>
>>>> The idea is to be able to compile programs for another glibc, but I'm not
>>>> root, so I won't be able to use it in it's normal location. So
>>>> /lib/ld-linux.so.2 won't point to the new one. I tried to create a cross
>>>> compile toolchain but was unsuccessfull so far.
>>>>
>>>> Is there a way to change the dynamic linker of an existing application ?
>>>>
>>>>> From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
>>>>
>>>>
>>>>
>>>> bye, krajo
>>>>
>>>>
>>>
>>>
>>> --
>>> The end is always good. If it's not good, it's not the end.
>>>
>>>
>>>
>>
>
>
> --
> The end is always good. If it's not good, it's not the end.
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 12:08 ` KRAJCSOVITS Gyorgy
@ 2005-09-15 12:18 ` KRAJCSOVITS Gyorgy
2005-09-15 13:53 ` KRAJCSOVITS Gyorgy
0 siblings, 1 reply; 7+ messages in thread
From: KRAJCSOVITS Gyorgy @ 2005-09-15 12:18 UTC (permalink / raw)
To: Aseem Rastogi; +Cc: gcc-help
Hi Aseem,
I just built GNU gettext this way and for the result:
$ ldd libgettextlib-0.14.5.so
libc.so.6 => /opt23//lib/libc.so.6 (0x40016000)
/opt23//lib/ld-linux.so.2 (0x80000000)
I don't know where I got the double // though. Onto bash now :)
bye, krajo
On Thu, 15 Sep 2005, KRAJCSOVITS Gyorgy wrote:
> Hi,
> seems like I got it working the way I wanted it, this is what I did:
>
> (On Suse linux 8 with glibc 2.2)
>
> Configure, compile and install glibc-2.3.5 into /opt23
>
> --------------------------
> Configure and compile binutils against glibc-2.3.5 headers, then in the
> binutils src dir:
>
> find . -name Makefile -a -exec grep -q "^LDFLAGS[[:space:]]*=" '{}' \; -a
> -print | while read i ; do mv $i $i.ori ; cat $i.ori | awk --
> '/^LDFLAGS[[:space:]]*=[[:space:]]*$/ { print "LDFLAGS = -B /opt23/lib
> -Wl,-rpath-link,/opt23/lib,--dynamic-linker,/opt23/lib/ld-linux.so.2"; }\
> ! /^LDFLAGS[[:space:]]*=[[:space:]]*$/ { print }' > $i ; done
>
> Now I ran "make" again, then "make install"
> This way I got as,ld,ar,... linked with new glibc.
>
> ---------------------------
> For gcc, first I edited "gcc-3.4.4/gcc/config/i386/linux.h" file in the gcc
> source directory and replaced:
>
> %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}
>
> with:
>
> %{!dynamic-linker:-dynamic-linker /opt23/lib/ld-linux.so.2}}
>
>
> Set CFLAGS, CXXFLAGS to:
> "-B /opt23/bin -B /opt23/lib -isystem /opt23/usr/include"
>
> In the build directory I ran:
> "../gcc-3.4.4/configure --with-sysroot=/opt23 --enable-threads=posix
> --prefix=/opt23"
>
> Then edited the created Makefile to change:
> LDFLAGS =
>
> into
> LDFLAGS = -B /opt23/lib
> -Wl,-rpath-link,/opt23/lib,--dynamic-linker,/opt23/lib/ld-linux.so.2
>
> Now a quick "make", "make install" and I got myself a gcc in /opt23/bin
> (need to put it into first place of $PATH) that creates executables that are
> linked against /opt23/lib/ld-linux.so.2 and /opt23/lib/libc.so.6
>
> $ gcc -o test test.c
> $ ldd ./test
> libc.so.6 => /opt23//lib/libc.so.6 (0x4001b000)
> /opt23/lib/ld-linux.so.2 (0x40000000)
>
> I tested moving /opt/include/stdio.h away, gcc cannot find it anymore, so it
> searches system headers at the new place.
> Of course I need to test it further.
>
> Why is it that the configure script for gcc-3.4.4 creates a Makefile that
> destroys the LDFLAGS env variable ?
>
> Now I'm going to try and build some real programs...
>
> bye, krajo
>
> On Thu, 15 Sep 2005, Aseem Rastogi wrote:
>
>> did you try compiling gcc itself with -Wl,--dynamic-linker ? the new gcc
>> then should then default link to ur custom glibc. also, if you can find
>> some solution to shared library problem that i mentioned, it would be very
>> helpful.
>>
>> aseem.
>>
>> KRAJCSOVITS Gyorgy wrote:
>>
>>> Hi, thanks for the reply,
>>>
>>> yes -Wl,--dynamic-linker works, but when I'm compiling big programs it
>>> is sometimes impossible (ok, very hard) to change the linker for every
>>> link step. It would be better to have gcc (or ld) automatically do this.
>>> And I need gcc to search other directories for system header files as
>>> well.
>>>
>>>
>>> bye, krajo
>>>
>>> On Thu, 15 Sep 2005, Aseem Rastogi wrote:
>>>
>>>> i am not sure about existing application but for a new program
>>>> -Wl,--dynamic-linker option works. i successfully did it for simple hello
>>>> world kind of programs but when i created shared libraries using this
>>>> option, it didn;t work and they seemed to be linked to default linker.
>>>>
>>>> try compiling gcc with this option to escape --dynamic-linker everytime.
>>>>
>>>> regards,
>>>> aseem.
>>>>
>>>> KRAJCSOVITS Gyorgy wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'd like to compile a gcc that uses:
>>>>> - /opt23/usr/include instead of /usr/include
>>>>> (and similar for other system include dirs)
>>>>>
>>>>> - instructs linker to use /opt23/lib/ld-linux.so.2 instead of
>>>>> /lib/ld-linux.so.2
>>>>> (Maybe this is a binutils issue, but it seems like binutils gets its
>>>>> deafults from gcc when compiling binutils)
>>>>>
>>>>> The idea is to be able to compile programs for another glibc, but I'm
>>>>> not root, so I won't be able to use it in it's normal location. So
>>>>> /lib/ld-linux.so.2 won't point to the new one. I tried to create a cross
>>>>> compile toolchain but was unsuccessfull so far.
>>>>>
>>>>> Is there a way to change the dynamic linker of an existing application ?
>>>>>
>>>>>> From /lib/ld-linux.so.2 to /opt23/lib/ld-linux.so.2 ?
>>>>>
>>>>>
>>>>>
>>>>> bye, krajo
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> The end is always good. If it's not good, it's not the end.
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> The end is always good. If it's not good, it's not the end.
>>
>>
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: system inc and dynamic linker change
2005-09-15 12:18 ` KRAJCSOVITS Gyorgy
@ 2005-09-15 13:53 ` KRAJCSOVITS Gyorgy
0 siblings, 0 replies; 7+ messages in thread
From: KRAJCSOVITS Gyorgy @ 2005-09-15 13:53 UTC (permalink / raw)
To: Aseem Rastogi; +Cc: gcc-help
Hi,
On Thu, 15 Sep 2005, KRAJCSOVITS Gyorgy wrote:
> Hi Aseem,
> I just built GNU gettext this way and for the result:
>
> $ ldd libgettextlib-0.14.5.so
> libc.so.6 => /opt23//lib/libc.so.6 (0x40016000)
> /opt23//lib/ld-linux.so.2 (0x80000000)
>
> I don't know where I got the double // though. Onto bash now :)
>
> bye, krajo
This is great, just to mess things up, the linux kernel that I have to use
(2.4.21 patched to death) doesn't support the option WCONTINUED for
syscall waitpid (wait4 in kernel). The new glibc-2.3.5 I just got
installed doesn't care about this though.
The upshot is that my new bash - compiled with new glibc - tries to use
this to wait for processes. The system call fails with EINVAL in the
kernel, and bash goes into an infinite loop after any program executed :)
Quick fix: in bash-3.0/jobs.c undefine WCONTINUED before it gets used.
bye, krajo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-09-15 13:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-15 9:41 system inc and dynamic linker change KRAJCSOVITS Gyorgy
2005-09-15 9:47 ` Aseem Rastogi
2005-09-15 9:56 ` KRAJCSOVITS Gyorgy
2005-09-15 10:07 ` Aseem Rastogi
2005-09-15 12:08 ` KRAJCSOVITS Gyorgy
2005-09-15 12:18 ` KRAJCSOVITS Gyorgy
2005-09-15 13:53 ` KRAJCSOVITS Gyorgy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).