Issue
I'm adding a code in qemu-5.1.0 and this code should use a .so file.
I added -ldl to the QEMU_CFLAGS, QEMU_CXXFLAGS, QEMU_LDFLAGS using the configure --extra-cflags/--extra-cxxflags/--extra-ldflags options and can see they are really set.
But when I actually do "make", it gives me this error and I can't figure out what is wrong.
LINK aarch64-softmmu/qemu-system-aarch64
/usr/bin/ld: ../hw/misc/axpu_if.o: undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:219: qemu-system-aarch64] Error 1
make: *** [Makefile:527: aarch64-softmmu/all] Error 2
Here is the "ldd --version" command output. my system's glibc version seems to be 2.31 (ubuntu 20.04), but I don't know why it's looking for the symbol dlsym from glibc_2.2.5.
ckim@ckim-ubuntu:~/xxx/qemu-5.1.0/build$ ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
Can anyone help me?
Solution
I found out the "-ldl" link option was ignored because it was placed too early in the final c++ link command during make. So if you want to use external .so file and need to use libdl.so, you should configure qemu like this. (under qemu-5.1.0/build directory)
../configure --target-list=aarch64-softmmu --enable-debug --enable-gtk --extra-ldflags="-Wl,--no-as-needed,-ldl"
The -Wl,--no-as-needed,-ldl
part was added. (the others are for my needs). -as-needed is the default and it lists the needed library in the elf file. I tested it with just -ldl but it didn't work, hence the final command.
Answered By - Chan Kim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.