]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't link a shared library without a -rpath option
authorTony Finch <dot@dotat.at>
Wed, 10 Aug 2022 12:16:24 +0000 (13:16 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 15 Aug 2022 19:50:25 +0000 (15:50 -0400)
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.

scripts/jlibtool.c

index 88c7dfb132bf676827eed85243203b08efcecffc..21b4ba59e06afe0a81146dee6f8c64c329e4bf9d 100644 (file)
@@ -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 ||