public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* g++, RH 2.1 and rpath
@ 2003-07-02 14:52 Ajay Bansal
  2003-07-02 15:20 ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: Ajay Bansal @ 2003-07-02 14:52 UTC (permalink / raw)
  To: gcc-help; +Cc: Pankaj Garg

Hi All

I am compiling a program which links with a certain library. 

g++ -o test test.cpp -L/home/thirdparty/lib -llib1

/usr/bin/ld: warning: liblib2.so, needed by
/home/thirdparty/lib/liblib1.so, not found (try using -rpath or
-rpath-link)
/home/thirdparty/lib/liblib1.so: undefined reference to `funcGetString'
collect2: ld returned 1 exit status

So I use rpath. But then I get following error

g++ -o test test.cpp -rpath /home/thirdparty/lib -llib1
g++: unrecognized option `-rpath'
/home/thirdparty/lib: file not recognized: Invalid argument
collect2: ld returned 1 exit status


Then I use ld instead of rpath (But in my actual program I HAVE to use
g++ for linking)

ld -o test test.cpp -rpath /home/thirdparty/lib  -L/home/thirdparty/lib
-llib1
ld: warning: cannot find entry symbol _start; defaulting to 080483a8
ldap.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'



What should I do????? Please note that this is just a sample output. I
link to many thirdpaty libs. Some of them has 10 or more dependent libs
so I can not link against all of them. Linker should find the dependent
libs by itself.

Regards
Ajay


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

* Re: g++, RH 2.1 and rpath
  2003-07-02 14:52 g++, RH 2.1 and rpath Ajay Bansal
@ 2003-07-02 15:20 ` Alexandre Oliva
  2003-07-02 17:14   ` John Love-Jensen
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Oliva @ 2003-07-02 15:20 UTC (permalink / raw)
  To: Ajay Bansal; +Cc: gcc-help, Pankaj Garg

On Jul  2, 2003, "Ajay Bansal" <Ajay_Bansal@infosys.com> wrote:

> /usr/bin/ld: warning: liblib2.so, needed by
> /home/thirdparty/lib/liblib1.so, not found (try using -rpath or
> -rpath-link)

> So I use rpath. But then I get following error

-rpath, as you found out, is a flag to the linker, not to the
compiler.  You can get the compiler to pass flags to the linker using
the -Wl, option: -Wl,-rpath,/home/thirdparty/lib, or -Xlinker -rpath
-Xlinker /home/thirdparth/lib.

BTW, what's RH 2.1?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: g++, RH 2.1 and rpath
  2003-07-02 15:20 ` Alexandre Oliva
@ 2003-07-02 17:14   ` John Love-Jensen
  2003-07-03 19:07     ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: John Love-Jensen @ 2003-07-02 17:14 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-help

RH 2.1 is the commercial (i.e., for money, comes with technical support)
release of Red Hat.

--Eljay

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

* Re: g++, RH 2.1 and rpath
  2003-07-02 17:14   ` John Love-Jensen
@ 2003-07-03 19:07     ` Alexandre Oliva
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 2003-07-03 19:07 UTC (permalink / raw)
  To: John Love-Jensen; +Cc: gcc-help

On Jul  2, 2003, John Love-Jensen <eljay@adobe.com> wrote:

> RH 2.1 is the commercial (i.e., for money, comes with technical support)
> release of Red Hat.

Red Hat has no product named RH 2.1.  I suppose you mean Red Hat
Enterprise Linux AS 2.1, formerly known as Red Hat Advanced Server
2.1.  Also, it's as commercial as Red Hat Linux 9, the difference is
the amount and level of support you get.  But we're way off topic now
:-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: g++, RH 2.1 and rpath
  2003-07-02 15:24 Ajay Bansal
@ 2003-07-03 19:09 ` Alexandre Oliva
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 2003-07-03 19:09 UTC (permalink / raw)
  To: Ajay Bansal; +Cc: gcc-help, Pankaj Garg

On Jul  2, 2003, "Ajay Bansal" <Ajay_Bansal@infosys.com> wrote:

> If I use rpath, do I still need to use -L for specifying library search
> paths? 

-rpath encodes directories in the run-time search path of an
executable, that the dynamic linker (ld.so) uses to find shared
libraries.  -L tells the linker (ld) where to look for libraries
specified in the command line, at link time.  -rpath-link tells the
linker (ld) where to look for dynamic libraries that are mentioned as
dependencies of other dynamic libraries that are linked.  IIRC, -rpath
is the default for -rpath-link, but definitely not for -L.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* RE: g++, RH 2.1 and rpath
@ 2003-07-02 15:24 Ajay Bansal
  2003-07-03 19:09 ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: Ajay Bansal @ 2003-07-02 15:24 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-help, Pankaj Garg

If I use rpath, do I still need to use -L for specifying library search
paths? 


-----Original Message-----
From: Alexandre Oliva [mailto:aoliva@redhat.com] 
Sent: Wednesday, July 02, 2003 8:50 PM
To: Ajay Bansal
Cc: gcc-help@gcc.gnu.org; Pankaj Garg

On Jul  2, 2003, "Ajay Bansal" <Ajay_Bansal@infosys.com> wrote:

> /usr/bin/ld: warning: liblib2.so, needed by 
> /home/thirdparty/lib/liblib1.so, not found (try using -rpath or
> -rpath-link)

> So I use rpath. But then I get following error

-rpath, as you found out, is a flag to the linker, not to the compiler.
You can get the compiler to pass flags to the linker using the -Wl,
option: -Wl,-rpath,/home/thirdparty/lib, or -Xlinker -rpath -Xlinker
/home/thirdparth/lib.

BTW, what's RH 2.1?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

end of thread, other threads:[~2003-07-03 19:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02 14:52 g++, RH 2.1 and rpath Ajay Bansal
2003-07-02 15:20 ` Alexandre Oliva
2003-07-02 17:14   ` John Love-Jensen
2003-07-03 19:07     ` Alexandre Oliva
2003-07-02 15:24 Ajay Bansal
2003-07-03 19:09 ` Alexandre Oliva

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