public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* non standard libs
@ 2000-12-24  6:02 Nicholas Mc Guire
  2000-12-24 10:04 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Mc Guire @ 2000-12-24  6:02 UTC (permalink / raw)
  To: gcc-help

Hi !
 
 I wanted to compile with a old set of libs, so I donwloaded the libs from a
 system they were on and put them in a directory /glibc-2.0.7/ and then tried
 to compile a program for this old system by issuing

    gcc -nostdlib -L/glibc-2.0.7/ -lc -o hello hello.c

 which compiles ok , but does not use the glibc-2.0.7 libs but the normal system
 libs in /lib (blibc-2.1.3) and thus segfaults on the old system.

 could someone point out to me whats wrong with the compiler flags I was using ?
 my understanding was that with -nostdlib the system lisb serach path is not 
 used at all and with the -L/glibc-2.0.7/ and -lc it should actually find the
 glibc-2.0.7 libc . 

any hint or links to docs appreciated !

thx !
hofrat

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: non standard libs
  2000-12-24  6:02 non standard libs Nicholas Mc Guire
@ 2000-12-24 10:04 ` Alexandre Oliva
  2000-12-25  2:54   ` Nicholas Mc Guire
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2000-12-24 10:04 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: gcc-help

On Dec 24, 2000, Nicholas Mc Guire <der.herr@hofr.at> wrote:

>  which compiles ok , but does not use the glibc-2.0.7 libs but the normal system
>  libs in /lib (blibc-2.1.3) and thus segfaults on the old system.

>  could someone point out to me whats wrong with the compiler flags I was using ?

Nothing's wrong with your flags.  You just failed to tell the linker
to add a note in the program that, at run-time, it should look for
libc in this other directory.  Set LD_RUN_PATH or use -rpath to
accomplish that.

An alternative is to create a link in /lib with the libc SONAME
encoded in the program that points to the old version of glibc.

It might be that you'll also have to tell the linker that the program
needs the old dynamic loader (ld.so).  I don't know how to do that,
though.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: non standard libs
  2000-12-24 10:04 ` Alexandre Oliva
@ 2000-12-25  2:54   ` Nicholas Mc Guire
  0 siblings, 0 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2000-12-25  2:54 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Nicholas Mc Guire, gcc-help

> On Dec 24, 2000, Nicholas Mc Guire <der.herr@hofr.at> wrote:
> 
> >  which compiles ok , but does not use the glibc-2.0.7 libs but the normal system
> >  libs in /lib (blibc-2.1.3) and thus segfaults on the old system.
> 
> >  could someone point out to me whats wrong with the compiler flags I was using ?
> 
> Nothing's wrong with your flags.  You just failed to tell the linker
> to add a note in the program that, at run-time, it should look for
> libc in this other directory.  Set LD_RUN_PATH or use -rpath to
> accomplish that.
> 

Hi !


I guess I'm seeing a differnet problem then . It looks like
I need to tell gcc what the default libs are. from the info page
it loooks like libgcc.a is required to fix up a few things so
this also is now copied into the glibc-2.0.7 directory and now used

gcc -nostdlib -nodefaultlibs -L../../glibc-2.0.7/ -lc -lgcc -s -o hello hello.c

which works fine if I DON't use 

   return 0;

at the end of the program but rather put in

    exit(0);

if I use return it will run and then segfault at me . So I guess its not enough
to have -lc (for libc) and -lgcc (for libgcc) in the compiler flags . 

any hint ?

thx !
hofrat

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-12-25  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-24  6:02 non standard libs Nicholas Mc Guire
2000-12-24 10:04 ` Alexandre Oliva
2000-12-25  2:54   ` Nicholas Mc Guire

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).