On Mon, Apr 7, 2014 at 1:42 PM, Alan Koshy John <[email protected]> wrote:
> Hi,
>
> I would like to dynamically link a shared library file. I used the following
> code
>
> "link_settings":    {
>                 "ldflags":["-L../lib/linux/ia32/","-lLib.so"],
>                  }
>
> I have specified the relative path here and because of which the library is
> not linked at the run time. But this works when I specify the absolute path
> or set ld_library_path with the path to the shared lib. How can I avoid
> using absolute or avoid setting ld_library_path?
> I would like to distribute my application to multiple systems and hence
> setting the absolute path doesn't make sense. For some reason I am not
> allowed to use static libraries in which case I wouldn't have had this
> issue. Any help would be highly appreciated.
>
> thank you,
> Alan

Linking with -rpath,$ORIGIN should do the trick.  Example:

  'ldflags': ['-Wl,-rpath,$ORIGIN/../lib/linux/ia32'],
  'libraries': ['-L../lib/linux/ia32 -llib'],  # no .so suffix

Note that $ORIGIN is the relative path at run-time, not link time.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to