Closed NicolasDerumigny closed 1 year ago
Thanks for updating this, and keeping Plugin CPP alive :)
When trying to configure (from d541d07b6b671277d239c483f25466090c106e9c), I ran into this error:
$ ./configure --enable-tcg-plugin-cpp --target-list=x86_64-linux-user,arm-linux-user,aarch64-linux-user,i386-linux-user
...
../meson.build:3254:2: ERROR: Tried to enter directory "tcg/plugins", which has already been visited.
Is it working for you?
Good catch. This is due to multiple targets not being compatible with the current integration of the TCG plugins in the build system. I'll see how this can be fixed.
Indeed, adding a single target allows to pass configure step.
During compilation, I have this error (first time). I think it's a dependency order on generated header.
$ ./configure --enable-tcg-plugin-cpp --target-list=x86_64-linux-user
$ ninja -C build
...
FAILED: tcg/plugins/libtcg-plugin-cpp-x86_64-linux-user.so.p/cpp.c.o
cc -m64 -mcx16 -Itcg/plugins/libtcg-plugin-cpp-x86_64-linux-user.so.p -Itcg/plugins -I../tcg/plugins -Itarget/i386 -I../target/i386 -I../common-user/host/x86_64 -I../linux-user/include/host/x86_64 -I../linux-user/include -Ilinux-user -I../linux-user -Ilinux-user/x86_64 -I../linux-user/x86_64 -Ilibelfin -I../libelfin -I/usr/include/capstone -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -isystem /home/user/qemu/linux-headers -isystem linux-headers -iquote . -iquote /home/user/qemu -iquote /home/user/qemu/include -iquote /home/user/qemu/disas/libvixl -iquote /home/user/qemu/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong '-DEMULATION_MODE="user"' -fPIC -isystem../linux-headers -isystemlinux-headers -O2 -DNEED_CPU_H '-DCONFIG_TARGET="x86_64-linux-user-config-target.h"' '-DCONFIG_DEVICES="x86_64-linux-user-config-devices.h"' -MD -MQ tcg/plugins/libtcg-plugin-cpp-x86_64-linux-user.so.p/cpp.c.o -MF tcg/plugins/libtcg-plugin-cpp-x86_64-linux-user.so.p/cpp.c.o.d -o tcg/plugins/libtcg-plugin-cpp-x86_64-linux-user.so.p/cpp.c.o -c ../tcg/plugins/cpp.c
In file included from /home/user/qemu/include/hw/qdev-core.h:8,
from /home/user/qemu/include/hw/core/cpu.h:23,
from /home/user/qemu/tcg/tcg-plugin.h:38,
from ../tcg/plugins/cpp.c:3:
/home/user/qemu/include/qom/object.h:17:10: fatal error: qapi/qapi-builtin-types.h: No such file or directory
17 | #include "qapi/qapi-builtin-types.h"
|
After recompiling, it fails when linking final qemu-x86_64 binary (adding a dependency on libdl should be enough):
/usr/bin/ld: libqemu-x86_64-linux-user.fa.p/tcg_tcg-plugin.c.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
Is that compiling fine on your side?
I have the same bug as you when using ninja, but the Makefile back-end is working fine. I'll look at the ninja dependency issue once the multiple targets have been fixed.
Only libdl stuff is missing then, to make it work!
The multi-target build should now work, I'm now looking at the ninja / libdl bugs.
I don't reproduce neither the dependency error nor the linking one, do you still encounter it on the last version?
multi target works fine 👍
For libdl, I'm compiling on debian sid. Anyway, it's probably better to explicit dependency on libdl introduced by tcg plugins.
diff --git a/meson.build b/meson.build
index b516e74af7..9cb62c8ae8 100644
--- a/meson.build
+++ b/meson.build
@@ -621,6 +621,7 @@ endif
spice_headers = spice.partial_dependency(compile_args: true, includes: true)
rt = cc.find_library('rt', required: false)
+dl = cc.find_library('libdl', required: true)
libiscsi = not_found
if not get_option('libiscsi').auto() or have_block
@@ -3366,7 +3367,7 @@ foreach target : target_dirs
emulator = executable(exe_name, exe['sources'],
install: true,
c_args: c_args,
- dependencies: arch_deps + deps + exe['dependencies'],
+ dependencies: arch_deps + deps + exe['dependencies'] + dl,
objects: lib.extract_all_objects(recursive: true),
link_language: link_language,
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
With this, it successfully links!
Tested plugins, everything seems ok!
PLUGIN_CPP=coverage ./build/qemu-x86_64 -tcg-plugin build/libtcg-plugin-cpp-x86_64-linux-user.so /bin/true
The build system has been corrected on master
:).
Great! Working fine after testing. Didn't see again the issue with header dependency as well.
Is that PR ready for integration on your side?
I'm still patching it as I'm working on updating a third party project that uses this QEMU-plugins, so I expect a few commits to be pushed next week. You can either merge as is and I may submit debug PRs, or wait a bit until I finish.
Is that to enhance things, or fix broken features?
Mostly broken features. By the way, the interface with GDB is not working anymore, as QEMU's code structure heavily changed on that part (or, at least, enough changes for me not to understand directly where the TCG-plugin patches should be applied).
As long as plugins work correctly, it should be fine to merge this.
@guillon Could you merge that please?
Merging. Some issues persist, I will push additional commits after the merge
Updating QEMU to 7.0. Support for CPP plugins is untested and probably do not even build. TGC C plugins are tested and all examples work on a x86_64 host, x86_64 guest.