libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q: Forcing a -Wl,-rpath arg to static lib users


From: Oleg Smolsky
Subject: Q: Forcing a -Wl,-rpath arg to static lib users
Date: Mon, 14 Nov 2022 20:36:32 -0800

Hello folks! I've been using libtool (via autotools) for a while, but have been unable to find a clean solution to the following problem:

I have a static `liblocal.la` (built in my build system) that links to a third-party shared lib. Obviously I can use my own lib to express that dependency:

liblocal_la_LIBADD = -lexternal -L/somewhere/lib

The missing bit of functionality is -Wl,-rpath,/somewhere/lib that I need to impose onto the leaf-level executables that link my local lib. Unfortunately these attempts do not work:
 1. Cannot add that flag to _LIBADD as libtool complains: "...belong in 'liblocal_la_LDFLAGS"
 2. Cannot add that flag to _LDFLAGS as it does not carry all the way to the leaf-level executable

I have found that I can manually jam the flag into the `inherited_linker_flags` variable inside the .la file and that gives me the desired result... but I don't know how to do that via Makefile.am.

I'd appreciate any and all hints/suggestions.

Thanks!
Oleg.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]