From: Tony Finch Date: Wed, 10 Aug 2022 12:16:24 +0000 (+0100) Subject: Don't link a shared library without a -rpath option X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5360a31a2f7bc2b17a28e0b59c87217f8ede4a9;p=thirdparty%2Ffreeradius-server.git Don't link a shared library without a -rpath option A few of the BIND9 programs have common code that is statically linked. For example `dighost.c` is used by both `dig` and `host`. `libdighost.la` is specified to automake in noinst_LTLIBRARIES, which eventually becomes a libtool --mode=link invocation without a -rpath argument. GNU libtool interprets a link invocation without -rpath this as an instruction to make a static library only, which agrees with the comment in `link_fixup()` in jlibtool. But when cmd->output == OUT_LIB, jlibtool still tries to build a dynamic library. This fails on my Mac; if I remove ERROR("Installation mode requires -rpath") it links dynamically and fails at runtime. I am not sure if jlibtool should have worked out the correct cmd->output mode earlier, but if so the comment would be in the wrong place. --- diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index 88c7dfb132b..21b4ba59e06 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -2344,6 +2344,9 @@ static void link_fixup(command_t *cmd) if (cmd->options.shared == SHARE_SHARED) { cmd->install_path = LIBDIR; } + if (cmd->output == OUT_LIB) { + cmd->output = OUT_STATIC_LIB_ONLY; + } } if (cmd->output == OUT_DYNAMIC_LIB_ONLY ||