Reputation: 368
I have the following:
g++ $(LD_OPTS) -o lib/foo.so lib/bar.o lib/qaz.o ../path/to/foodependency.so
It and foo
are both being built here (assume foodependency has already been built by the makefile previously). The end result looks something like this, during build:
project
---libFoo
------lib
---------foo.so
---libFooDependency
------lib
---------foodependency.so
However, during runtime, both foo.so and foodependency.so are in the same directory, bar
:
bar
---foo.so
---foodependency.so
This layout during runtime cannot be changed. But now as a result, ldd foo.so
returns the following:
../path/to/foodependency.so => not found
How can I resolve this difference?
Upvotes: 1
Views: 170
Reputation: 213456
How can I resolve this
There are several ways.
foodependency.so
to libfoodependency.so
, and use -L../path/to -lfoodependency
when linking, or-L../path/to -l:foodependency.so
when linking, orfoodependency.so
, add -Wl,--soname=foodependency.so
and use your original link line.Upvotes: 1