Statically linked shared library
Andrew Haley
aph@redhat.com
Mon Mar 16 18:48:00 GMT 2009
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.
>>
>>
>
More information about the Gcc-help
mailing list