Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drakvuf meson and ninja-injector linking build errors #1753

Closed
cvcachagua opened this issue Dec 8, 2023 · 4 comments
Closed

drakvuf meson and ninja-injector linking build errors #1753

cvcachagua opened this issue Dec 8, 2023 · 4 comments

Comments

@cvcachagua
Copy link

$ meson setup build --native-file llvm.ini
The Meson build system
Version: 0.53.2
Source dir: /home/usr1/git/drakvuf
Build dir: /home/usr1/git/drakvuf/build
Build type: native build
Project name: DRAKVUF (C) Tamas K Lengyel 2014-2023
Project version: 1.1
WARNING: Env var CC seems to point to the cross compiler.
This is probably wrong, it should always point to the native compiler.

meson.build:1:0: ERROR: Unable to determine dynamic linker

A full log can be found at /home/usr1/git/drakvuf/build/meson-logs/meson-log.txt

***RESULTED IN linking ERROR

I then tried meson differently:
$ meson ./build
$ ninja -C build
ninja: Entering directory `build'
[122/126] Linking target injector.
FAILED: injector
clang++ -o injector 'injector@exe/src_injector.cpp.o' -flto -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -pie -Wl,--start-group src/libdrakvuf/libdrakvuf.a src/xen_helper/libxen_helper.a src/libinjector/libinjector.a -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/local/lib/libvmi.so /usr/lib/x86_64-linux-gnu/libjson-c.so -pthread -ldl -Wl,--end-group '-Wl,-rpath,$ORIGIN/src/libdrakvuf:$ORIGIN/src/xen_helper:$ORIGIN/src/libinjector:/usr/local/lib' -Wl,-rpath-link,/home/usr1/git/drakvuf/build/src/libdrakvuf -Wl,-rpath-link,/home/usr1/git/drakvuf/build/src/xen_helper -Wl,-rpath-link,/usr/local/lib -Wl,-rpath-link,/home/usr1/git/drakvuf/build/src/libinjector
/usr/bin/ld: src/libdrakvuf/libdrakvuf.a: error adding symbols: archive has no index; run ranlib to add one
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[123/126] Compiling C++ object 'drakvuf@exe/src_drakvuf.cpp.o'.
ninja: build stopped: subcommand failed.

***problem linking:
/usr/bin/ld: src/libdrakvuf/libdrakvuf.a: error adding symbols: archive has no index; run ranlib to add one
clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ git log -1
commit 30fa531 (HEAD -> main, origin/main, origin/HEAD)
Author: Pavel 41573188+archercreat@users.noreply.github.com
Date: Wed Nov 29 22:10:30 2023 +0300

   add Bitness and FromParentModule field (#1750)

$ git submodule update --init

@xhf:~/git/drakvuf$ git submodule update --init
Submodule 'dwarf2json' (https://github.com/tklengyel/dwarf2json) registered for path 'dwarf2json'
Submodule 'libvmi' (https://github.com/libvmi/libvmi) registered for path 'libvmi'
Submodule 'volatility3' (https://github.com/volatilityfoundation/volatility3) registered for path 'volatility3'
Submodule 'xen' (https://github.com/xen-project/xen) registered for path 'xen'
Cloning into '/home/usr1/git/drakvuf/dwarf2json'...
Cloning into '/home/usr1/git/drakvuf/libvmi'...
Cloning into '/home/usr1/git/drakvuf/volatility3'...
Cloning into '/home/usr1/git/drakvuf/xen'...
Submodule path 'dwarf2json': checked out 'edee6cc49823599c524b6750cb85e3e864aee893'
Submodule path 'libvmi': checked out '12d3a8cc4d81033ff0b5c737ca35f54bcaf0264b'
Submodule path 'volatility3': checked out 'cb6d6e3a8e5ceb31ef71311e8a63220be055dee5'
Submodule path 'xen': checked out 'd75f1e9b74314cea91ce435730d4e3539ecca77d'

using:
export CC=clang
export CXX=clang++
Oddly if I use drakvuf git version 95d1759, the two previous env variables along with:
meson ./build
ninja -C ./build
...builds drakvuf.
I wonder if the variable dynamic_linker is supposed to be in the meson config file.

$ uname -a
Linux xhf 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I am not knowledgable with meson, yet. This looks like a setup error, but I am not sure how to solve it.
Any help would be appreciated.

@tklengyel
Copy link
Owner

You can use autotools to build as a fallback.

@cvcachagua
Copy link
Author

fantistic... using the old method works, thanks.

/autogen.sh
./configure
make
sudo make install

@cvcachagua
Copy link
Author

The instructions for the old build method should be put in the drakvuf.com site.
Really we need an instructions file in the top level drakvuf repo, because the build has changed over time and the instructions are needed for an old version to try and build that old git version -- IMHO.
However, I do appreciate the everyones effort!

@tklengyel
Copy link
Owner

I think this was something weird about your environment because the meson system works on a variety of CI environments. So perhaps need to check how you installed clang. As for the build commands, yea, it would have been good to have them in the repo itself but alas it's too late for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants