S.Richmond
S.Richmond

Reputation: 11558

How do I link a library to be loaded from the local directory?

I am trying to compile and bundle an application I have for Linux that requires a couple of external libs such as libgdiplus. When I try to run the application in an environment that doesn't have GDIPlus installed it fails to find the local copy of libgdiplus.so I have in the next directory as my application.

If I use strace to see what's going on I clearly see it checking a number of locations such as /lib/ /usr/lib/ etc, but never the local directory.

How can I tell my application to search for external libs in the local directory?

Upvotes: 2

Views: 140

Answers (1)

S.Richmond
S.Richmond

Reputation: 11558

I found the answer. I needed to specify the search path with rpath in the linker like so:

-Wl,-rpath,.

Upvotes: 2

Related Questions