From: Joe Van Dyk Date: 2005-08-03T10:39:13+09:00 Subject: Re: extconf.rb search path On 8/1/05, Ara.T.Howard wrote: > On Tue, 2 Aug 2005, Joe Van Dyk wrote: > > > On 8/1/05, Ara.T.Howard wrote: > >> On Tue, 2 Aug 2005, Joe Van Dyk wrote: > >> > >>> Hi, > >>> > >>> Whenever I run extconf.rb for gnome2, it compiles against the gnome > >>> libraries found in /usr. I want it to compile against the gnome > >>> libraries found in /usr/local. Isn't that what it should do by > >>> default? > >>> > >>> Anyways, how can I get the gnome2 Ruby extensions to compile against > >>> the headers/libraries in /usr/local? > >>> > >>> Thanks, > >>> Joe > >> > >> try this > >> > >> ~ > LD_LIBRARY_PATH=/usr/local:$LD_LIBRARY_PATH LD_RUN_PATH=/usr/local:$LD_RUN_PATH ruby extconf.rb > >> > >> perhaps your compiler will like this... > >> > >> probably there is also a > >> > >> --with-gnome-dir=/usr/local > >> > >> option for that extconf. > >> > >> -a > >> -- > > > > Weirdly, if I run /usr/local/bin/ruby (and not /usr/bin/ruby) on > > extconf.rb, it uses libraries/headers in /usr/local (and not /usr). > > > > So, part of it seems to depend on where Ruby is installed. > > > absolutely - you should always be aware of which ruby you are using to compile > extensions. basically ruby caches tons of stuff when it's compiled itself. > it stores all this info and this is the foundation of 'mkmf', which extconf.rb > uses. this should be illuminating: > > ruby -r rbconfig -r yaml -e 'y Config::CONFIG' > > if you're using the 'right' ruby you should see a /usr/local or two in there. > > another rule of thumb: unless you understand why you wouldn't do so - always > set LD_RUN_PATH to your system libdir (for example /usr/local/lib) when > compiling extensions. this is __very__ important in the case of ruby libs > which themselves require libs : for example sqlite or gnome. if you don't set > this you'll have issues at runtime with the gnome-ruby libs loading gnome libs > from /usr/lib/ vs. /usr/local/lib. run ldd on the ruby-gnome extension to see > what i mean. if you re-compile with LD_RUN_PATH set to /usr/local you'll see > a difference. > > btw my command above should have been > > ~ > LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH LD_RUN_PATH=/usr/local/lib:$LD_RUN_PATH ruby extconf.rb I have new libraries installed in /opt/lib. LD_LIBRARY_PATH and LD_RUN_PATH include /opt/lib. When I run extconf.rb, it generates Makefiles that don't include -L/opt/lib. And running ldd on the resulting shared library shows no libraries from /opt/lib. Ideas? Joe