undefined reference to symbol 'dlsym@@GLIBC_2.2.5' during qemu build

Jeffrey Walton noloader@gmail.com
Wed May 26 01:48:44 GMT 2021


On Tue, May 25, 2021 at 9:29 PM Chan Kim via Libc-help
<libc-help@sourceware.org> wrote:
>
> Hi, Florian
>
> Yes,as you said, the '-ldl' option was being ignored I guess.
> I copied the last link command and in it, moved the -ldl option to the end.
> When I separately run this modified last command, the final target
> qemu-system-aarch64 is built without error message.
> Now I have to figure out how to make '-Wl,as-needed' as not default or
> automatically place the -ld option to the last in qemu-5.1.0 build system.
> (And the debugger(ddd with gdb inside) prompt is a wait pointer. I can see
> prints when the program runs))
> Anyway thanks a lot for the help.

The make recipe is off a bit.

Ld is a single pass linker. -ldl needs to be near the end of the list
of object files and libraries, not the beginning. I.e., it should be
something like:

foo: <objs>
    $(CC) $(CFLAGS) <objs> $(LDFLAGS) $(LDLIBS) -ldl

Jeff


More information about the Libc-help mailing list