rpath???

rpath???

Post by stephen cha » Thu, 05 Aug 1999 04:00:00



Hello:

I am trying to compile my shared lib and program with the
"-rpath" option. They tell me this is suppose to hard code
the location of my shared libs into my program so it can
find the *s at runtime. I checked man gcc, but couldn't
find the "-rpath" option.

gcc -fpic -c -o myobj.o myobj.c
gcc -shared -o mylib.so myobj.o
I placed mylib.so in "usr/local/lib"
"usr/local/lib" path is in my "/etc/ld.so.conf"

Now, how to use -rpath option on my gcc command line?

Thanks
Stephen

 
 
 

rpath???

Post by Paul Kimo » Thu, 05 Aug 1999 04:00:00



> I am trying to compile my shared lib and program with the
> "-rpath" option. They tell me this is suppose to hard code
> the location of my shared libs into my program so it can
> find the *s at runtime. I checked man gcc, but couldn't
> find the "-rpath" option.

> gcc -fpic -c -o myobj.o myobj.c
> gcc -shared -o mylib.so myobj.o
> I placed mylib.so in "usr/local/lib"
> "usr/local/lib" path is in my "/etc/ld.so.conf"

Did you run "ldconfig"?

Quote:> Now, how to use -rpath option on my gcc command line?

As far as I know, "-rpath" should be when you link the _program_,
not the library that is linked to.  It is documented in the "ld"
man and info pages.  (The linker "ld" is invoked when you run
"gcc" to link.)

--


 
 
 

rpath???

Post by Juergen Hein » Thu, 05 Aug 1999 04:00:00



>Hello:

>I am trying to compile my shared lib and program with the
>"-rpath" option. They tell me this is suppose to hard code
>the location of my shared libs into my program so it can
>find the *s at runtime. I checked man gcc, but couldn't
>find the "-rpath" option.
[...]
>Now, how to use -rpath option on my gcc command line?

gcc ... -Wl,-rpath ... it's an ld option and with -Wl you can
pass options to the linker via the compiler driver (if it is
gcc, that is).

Ta',
Juergen

--
\ Real name     : Jrgen Heinzl                 \       no flames      /

 
 
 

1. Compilation error - gcc: unrecognized option `-rpath'

Hi there,

i'm traing to compile apache 1.3.9 on a pentium class machine with
2.2.12 linux kernel.
After execution of configure command with options as follows

# ./configure --prefix=/usr/local/apache
--activate-module=src/modules/php4/libphp4.a \
                         --activate-module=src/modules/perl/libperl.a
--enable-shared=perl \
                         --add-module=/tmp/mod_bandwidth.c
--enable-shared=bandwidth

i do a make command and, at some time during compilation, that's what i
get

# make
.......................
.......................
.......................
===> src/modules/extra
gcc -c  -I../../os/unix -I../../include   -DLINUX=2
-I/usr/local/src/php-4.0b2 -I/usr/loca
l/src/php-4.0b2/libzend -I/usr/local/src/php-4.0b2/libzend
-I/usr/local/src/php-4.0b2 -DMO
D_PERL -DUSE_HSREGEX -DUSE_EXPAT -I../../lib/expat-lite `../../apaci`
-fpic -DSHARED_MODUL
E mod_bandwidth.c && mv mod_bandwidth.o mod_bandwidth.lo

gcc -rpath /usr/lib -shared -o mod_bandwidth.so mod_bandwidth.lo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gcc: unrecognized option `-rpath'
^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib: file not recognized: Is a directory
make[4]: *** [mod_bandwidth.so] Error 1
make[3]: *** [all] Error 1
make[2]: *** [subdirs] Error 1
make[2]: Leaving directory `/usr/local/src/apache_1.3.9/src'
make[1]: *** [build-std] Error 2
make[1]: Leaving directory `/usr/local/src/apache_1.3.9'
make: *** [build] Error 2

If i delete the string "-rpath /usr/lib" from line

LDFLAGS_SHLIB= -rpath /usr/lib -shared

in the file src/modules/extra/Makefile all goes ok!
Anybody knows what's the problem here? The Makefile is automatically
generated
from Configuration script, isn't it?

Thanks in advance.
Bye,
michele

2. Optimizing gcc g77 code?

3. using -rpath with g++

4. XMETER Wanted!!

5. Use of RPATH when creating shared libraries (under Linux)

6. multi-user linux on PC?

7. Changing the rpath (LD_LIBRARY_PATH) of an executable

8. Sendmail config question

9. Changing a shared object's RPATH

10. SUN linker and -rpath

11. Apache 1.3.9 rpath error on RedHat 6

12. Problem in loading the correct shared library (RPATH)

13. "rpath" Trubbs with Apache 1.3.9, PHP 3.0.12, and mySQL 3.22.23b