Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > LD_RUN_PATH

Reply
Thread Tools

LD_RUN_PATH

 
 
Ara.T.Howard
Guest
Posts: n/a
 
      04-16-2004

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
================================================== =============================

 
Reply With Quote
 
 
 
 
nobu.nokada@softhome.net
Guest
Posts: n/a
 
      04-16-2004
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?

--
Nobu Nakada


 
Reply With Quote
 
 
 
 
nobu.nokada@softhome.net
Guest
Posts: n/a
 
      04-16-2004
Hi,

At Fri, 16 Apr 2004 16:51:28 +0900,
wrote in [ruby-talk:97330]:
> $ sudo env LD_RUN_PATH=/runpath/ruby make ruby


$ make LD_RUN_PATH=/runpath/ruby ruby

also seems to work.

--
Nobu Nakada


 
Reply With Quote
 
Ara.T.Howard
Guest
Posts: n/a
 
      04-16-2004
On Fri, 16 Apr 2004 wrote:

> Hi,
>
> At Fri, 16 Apr 2004 16:51:28 +0900,
> wrote in [ruby-talk:97330]:
> > $ sudo env LD_RUN_PATH=/runpath/ruby make ruby

>
> $ 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
================================================== =============================

 
Reply With Quote
 
Ceri Storey
Guest
Posts: n/a
 
      04-17-2004
On Fri, Apr 16, 2004 at 04:04:19PM +0900, Ara.T.Howard wrote:
> 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).

--
Ceri Storey <>


 
Reply With Quote
 
Ara.T.Howard
Guest
Posts: n/a
 
      04-17-2004
On Sat, 17 Apr 2004, Ceri Storey wrote:

> On Fri, Apr 16, 2004 at 04:04:19PM +0900, Ara.T.Howard wrote:
> > 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).


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
================================================== =============================

 
Reply With Quote
 
nobu.nokada@softhome.net
Guest
Posts: n/a
 
      04-19-2004
Hi,

At Fri, 16 Apr 2004 22:54:17 +0900,
Ara.T.Howard wrote in [ruby-talk:97356]:
> > At Fri, 16 Apr 2004 16:51:28 +0900,
> > wrote in [ruby-talk:97330]:
> > > $ sudo env LD_RUN_PATH=/runpath/ruby make ruby

> >
> > $ 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?


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.

--
Nobu Nakada


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby and LD_RUN_PATH Lennon Day-Reynolds Ruby 3 09-15-2004 06:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57