[Top][All Lists]

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

Re: /usr/lib/gcc/x86_64-alpine-linux-musl: libgettextlib.so: undefined r

From: Jeffrey Walton
Subject: Re: /usr/lib/gcc/x86_64-alpine-linux-musl: libgettextlib.so: undefined reference to `libiconv'
Date: Mon, 15 Jun 2020 20:42:16 -0400

On Mon, Jun 15, 2020 at 8:35 PM Bruno Haible <bruno@clisp.org> wrote:
> I wrote:
> > So evidently, gcc and the linker find libiconv.so (most likely due to the
> > -L option that you gave). But the runtime loader does not find it.
> > You did not pass an -rpath option to the linker, but you gave a -R option
> > which - according to the documentation - ought to be equivalent.
> To determine whether it's a linker or a dynamic linker problem, look at the
> ELF dynamic header.
>   $ readelf -d libgettextlib.so
>   $ objdump -p libgettextlib.so

OK, so this interesting....

I use -Wl,-R,'$$ORIGIN/../lib' so $ORIGIN passes through the makefile
properly. However, conftest uses the double dollar sign version which
causes the failure.

When I switch to the single dollar sign version for conftest,
everything works as expected:

$ gcc -o conftest -g2 -O2 -march=native -fPIC -pthread
-I/home/jwalton/tmp/ok2delete/include -DNDEBUG
-L/home/jwalton/tmp/ok2delete/lib -Wl,-R,'$ORIGIN/../lib'
-Wl,-R,/home/jwalton/tmp/ok2delete/lib -Wl,--enable-new-dtags
iconv-test.c  -liconv -ldl -lpthread

$ objdump -x conftest  |grep RUNPATH
  RUNPATH              $ORIGIN/../lib:/home/jwalton/tmp/ok2delete/lib
alpine3-x64:~/Build-Scripts$ objdump -x conftest  |grep RUNPATH
  RUNPATH              $ORIGIN/../lib:/home/jwalton/tmp/ok2delete/lib

$ ldd conftest
        /lib/ld-musl-x86_64.so.1 (0x7fd46b9a8000)
        libiconv.so.2 => /home/jwalton/tmp/ok2delete/lib/libiconv.so.2
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fd46b9a8000)


reply via email to

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