Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6453 > unrolled thread

How to get ruby to find a native lib?

Started byAdam Russell <ac.russell@live.com>
First post2012-02-13 11:35 -0500
Last post2012-02-16 09:54 -0800
Articles 4 — 3 participants

Back to article view | Back to comp.lang.ruby


Contents

  How to get ruby to find a native lib? Adam Russell <ac.russell@live.com> - 2012-02-13 11:35 -0500
    Re: How to get ruby to find a native lib? Robert Klemme <shortcutter@googlemail.com> - 2012-02-13 20:39 +0100
      Re: How to get ruby to find a native lib? Adam Russell <ac.russell@live.com> - 2012-02-13 17:57 -0500
    Re: How to get ruby to find a native lib? xman <cshinyee@gmail.com> - 2012-02-16 09:54 -0800

#6453 — How to get ruby to find a native lib?

FromAdam Russell <ac.russell@live.com>
Date2012-02-13 11:35 -0500
SubjectHow to get ruby to find a native lib?
Message-ID<235d5$4f393be1$84b70406$5935@news.eurofeeds.com>
I have installed some native libraries. They are in /usr/local/lib.
I am now trying to install a ruby gem which needs these in order to
build correctly but the gem build fails as it cannot find these
libraries.
The gem's extconf.rb file tries to confirm it can find the library with
have_library() but this fails for some reason.
I have tried setting a bunch of environment variables (see below for my
tests in irb) but nothing seems to work.
What is the best way to solve this problem?


irb(main):003:0> require 'mkmf'
=> true
irb(main):004:0> have_library('gecodesearch')
checking for main() in -lgecodesearch... no
=> false
irb(main):005:0> ENV['LD_LIBRARY_PATH']='/usr/local/lib'
=> "/usr/local/lib"
irb(main):006:0> have_library('gecodesearch')
checking for main() in -lgecodesearch... no
=> false
irb(main):007:0> ENV['DYLD_LIBRARY_PATH']='/usr/local/lib'
=> "/usr/local/lib"
irb(main):008:0> have_library('gecodesearch')
checking for main() in -lgecodesearch... no
=> false
irb(main):009:0> have_library('libgecodesearch')
checking for main() in -llibgecodesearch... no
=> false
irb(main):010:0> ENV['C_INCLUDE_PATH']='/usr/local/lib'
=> "/usr/local/lib"
irb(main):011:0> have_library('gecodesearch')
checking for main() in -lgecodesearch... no
=> false
irb(main):012:0> ENV['PATH']='/usr/local/lib'
=> "/usr/local/lib"
irb(main):013:0> have_library('gecodesearch')
checking for main() in -lgecodesearch... no
=> false

[toc] | [next] | [standalone]


#6454

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-02-13 20:39 +0100
Message-ID<9pt78gFffaU1@mid.individual.net>
In reply to#6453
On 02/13/2012 05:35 PM, Adam Russell wrote:
> I have installed some native libraries. They are in /usr/local/lib.
> I am now trying to install a ruby gem which needs these in order to
> build correctly but the gem build fails as it cannot find these
> libraries.
> The gem's extconf.rb file tries to confirm it can find the library with
> have_library() but this fails for some reason.
> I have tried setting a bunch of environment variables (see below for my
> tests in irb) but nothing seems to work.
> What is the best way to solve this problem?

Hmm, did you try

$ LD_LIBRARY_PATH=/usr/local/lib gem install XYZ

?  Maybe also export CPPFLAGS=-I/usr/local/include

Kind regards

	robert

[toc] | [prev] | [next] | [standalone]


#6455

FromAdam Russell <ac.russell@live.com>
Date2012-02-13 17:57 -0500
Message-ID<9fcde$4f39955e$84b70406$29399@news.eurofeeds.com>
In reply to#6454
On 2/13/12 2:39 PM, Robert Klemme wrote:
> On 02/13/2012 05:35 PM, Adam Russell wrote:
>> I have installed some native libraries. They are in /usr/local/lib.
>> I am now trying to install a ruby gem which needs these in order to
>> build correctly but the gem build fails as it cannot find these
>> libraries.
>> The gem's extconf.rb file tries to confirm it can find the library with
>> have_library() but this fails for some reason.
>> I have tried setting a bunch of environment variables (see below for my
>> tests in irb) but nothing seems to work.
>> What is the best way to solve this problem?
>
> Hmm, did you try
>
> $ LD_LIBRARY_PATH=/usr/local/lib gem install XYZ
>
> ? Maybe also export CPPFLAGS=-I/usr/local/include

Yes. Unfortunately, I have tried both of those things and neither one helps.

[toc] | [prev] | [next] | [standalone]


#6456

Fromxman <cshinyee@gmail.com>
Date2012-02-16 09:54 -0800
Message-ID<1398056.0.1329414852489.JavaMail.geo-discussion-forums@pbsn6>
In reply to#6453
Try:

    export LIBRARY_PATH=/usr/local/lib

That works for me in Linux + GCC
The LD_LIBRARY_PATH is only effective when executing, not at compile time.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.ruby


csiph-web