public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Kolesar <asim.husanovic@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Statically linked shared library
Date: Mon, 16 Mar 2009 18:48:00 -0000	[thread overview]
Message-ID: <49BE9F09.8020206@redhat.com> (raw)
In-Reply-To: <22541475.post@talk.nabble.com>

Kolesar wrote:
> I use full path for sysnfop1s.so, but sysnfop1s.so have dependencies fod
> libdrm.so
> ldd sysnfop1s.so
> libdrm.so => /my/path/to/libdrm.so

Please don't top-post, it's very confusing.

You have to set LD_LIBRARY_PATH before execution starts, so the easiest
way to solve this problem is with a wrapper script:

#!/bin/sh
LD_LIBRARY_PATH= ...
exec foo

The alternatives are using execv(3) in your program after setting the path
or using -rpath when linking your program.

Andrew.


> Andrew Haley wrote:
>> Kolesar wrote:
>>> Thanks for answer
>>>
>>> I'm gave up from statically linked ldrmod :)
>>>
>>> But, now i have new problem :)
>>>
>>> Before dlopen(), i set LD_LIBRARY_PATH with putenv(), but i get error:
>>> dlopen(sysnfop1s.so) error [2]: libdrmod.so: cannot open shared object
>>> file:
>>> No such file or directory.
>>>
>>> How i can set library path where is located my library (libdrmod)?
>> dlopen() takes a full pathname.  dlopen("/lib/foo/bar.so");
>>
>> Andrew.
>>
>>
> 

  reply	other threads:[~2009-03-16 18:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 15:39 Kolesar
2009-03-13 17:21 ` Axel Freyn
2009-03-14 20:49 ` Michael Haubenwallner
2009-03-16 14:35   ` Kolesar
2009-03-16 15:20     ` Andrew Haley
2009-03-16 18:42       ` Kolesar
2009-03-16 18:48         ` Andrew Haley [this message]
2009-04-14 12:32           ` Kolesar
2009-04-14 13:05             ` Andrew Haley
2009-03-12 15:39 Kolesar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49BE9F09.8020206@redhat.com \
    --to=aph@redhat.com \
    --cc=asim.husanovic@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).