LD_RUN_PATH

A

Ara.T.Howard

i just had something weird crop up when intalling ruby as root in a
non-standard place: compiling with LD_RUN_PATH=/non/standard/place/lib doesn't
work since the linker doesn't seem to take the env setting when user==root.
what else would be the preferred methods of encoding lib paths in ruby
extensions? DLDFLAGS?

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================
 
N

nobu.nokada

Hi,

At Fri, 16 Apr 2004 16:04:19 +0900,
Ara.T.Howard wrote in [ruby-talk:97329]:
i just had something weird crop up when intalling ruby as root in a
non-standard place: compiling with LD_RUN_PATH=/non/standard/place/lib doesn't
work since the linker doesn't seem to take the env setting when user==root.
what else would be the preferred methods of encoding lib paths in ruby
extensions? DLDFLAGS?

XLDFLAGS is for linking main program.
But LD_RUN_PATH seems to be embedded.

$ LD_RUN_PATH=/runpath/ruby make ruby
gcc -ggdb -g3 -Os -fPIC -rdynamic -L. main.o -lruby-1.9 -ldl -lcrypt -lm -o ruby
$ strings ruby | grep runpath
/runpath/ruby
$ mv ruby ruby-with-runpath
$ sudo env LD_RUN_PATH=/runpath/ruby make ruby
gcc -ggdb -g3 -Os -fPIC -rdynamic -L. main.o -lruby-1.9 -ldl -lcrypt -lm -o ruby
$ strings ruby | grep runpath
/runpath/ruby
$ cmp ruby ruby-with-runpath

And, basically, do you really need to compile by root, not to
just install?
 
A

Ara.T.Howard

Hi,

At Fri, 16 Apr 2004 16:51:28 +0900,


$ make LD_RUN_PATH=/runpath/ruby ruby

also seems to work.

neither do on our machine? very weird. i've found some things on google
about this - that env settings are ignored when linking if euid!=uid or
something like that - and people having similar probs.... perhaps it is unique
to this os... what are you on?

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================
 
C

Ceri Storey

i just had something weird crop up when intalling ruby as root in a
non-standard place: compiling with LD_RUN_PATH=/non/standard/place/lib doesn't
work since the linker doesn't seem to take the env setting when user==root.
what else would be the preferred methods of encoding lib paths in ruby
extensions? DLDFLAGS?

By far the best way to do this, is to use RPATHs. That is, hardcode the
location into the extension binary. Although exactly how to do this
depends on your compiler OS combination.

If you're using the typical gcc / gnu binutils combination, then you can
do this by adding -Wl,-R,/path/to/shlibs to the LDFLAGS variable (or
just manually add it to the linker command line).
 
A

Ara.T.Howard

By far the best way to do this, is to use RPATHs. That is, hardcode the
location into the extension binary. Although exactly how to do this
depends on your compiler OS combination.

If you're using the typical gcc / gnu binutils combination, then you can
do this by adding -Wl,-R,/path/to/shlibs to the LDFLAGS variable (or
just manually add it to the linker command line).

isn't this what setting LD_RUN_PATH does anyhow? seems safer to set the env
and let gcc figure out the flags...

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
===============================================================================
 
N

nobu.nokada

Hi,

At Fri, 16 Apr 2004 22:54:17 +0900,
Ara.T.Howard wrote in [ruby-talk:97356]:
neither do on our machine? very weird. i've found some things on google
about this - that env settings are ignored when linking if euid!=uid or
something like that - and people having similar probs.... perhaps it is unique
to this os... what are you on?

Linux 2.4.20, and
$ LANG=C gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
$ ld -v
GNU ld version 2.13.90.0.18 20030206

How are you doing? euid!=uid means that you use suid program?

Rather, why do you compile as root? Basically, you don't need
to be root to compile/link.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

idiot's guide to druby using ssh tunnels 4
narray on windows? 1
parent of TrueClass, FalseClass 9
Class::name 0
pthread 2
pretty exceptions 0
drb with udp 1
pthread masters (that's you guy) 1

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top