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

undefined reference to `cs_disasm' #1364

Open
hunterbr72 opened this issue Sep 29, 2024 · 2 comments
Open

undefined reference to `cs_disasm' #1364

hunterbr72 opened this issue Sep 29, 2024 · 2 comments

Comments

@hunterbr72
Copy link

Hi, the build process is broken or I am missing some dependency (maybe some libs are too new?) on Ubuntu Server 24.04.01LTS:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"

user@userland:/tools/reveng/Triton/build$ cmake -DCAPSTONE_INCLUDE_DIRS=/usr/lib/capstone/include ..
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiling with Python bindings
-- Found Python3: /usr/bin/python3 (found version "3.12.3") found components: Interpreter Development Development.Module Development.Embed
-- Python3 includes: /usr/include/python3.12
-- Python3 libraries: /usr/lib/x86_64-linux-gnu/libpython3.12.so
-- Compiling with Z3 SMT solver
-- Found Z3 include directory: /usr/include
-- Found Z3 library: /usr/lib/x86_64-linux-gnu/libz3.so
-- Z3 version: 4.8.12.0
-- Compiling with Capstone
-- Capstone includes directory defined: /usr/lib/capstone/include
-- Capstone libraries defined:
-- CAPSTONE version: 5.0.3
-- Compiling with wide-integer headers
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dex/tools/reveng/Triton/build
user@userland:
/tools/reveng/Triton/build$ make -j3
[ 3%] Building CXX object src/libtriton/CMakeFiles/triton.dir/arch/arm/aarch64/aarch64Cpu.cpp.o
[ 3%] Building CXX object src/libtriton/CMakeFiles/triton.dir/arch/arm/aarch64/aarch64Semantics.cpp.o

... snip ...

[ 88%] Linking CXX shared library libtriton.so
[ 88%] Built target triton
[ 90%] Building CXX object src/examples/cpp/CMakeFiles/info_reg.dir/info_reg.cpp.o
[ 90%] Building CXX object src/examples/cpp/CMakeFiles/taint_reg.dir/taint_reg.cpp.o
[ 90%] Built target python-triton
[ 91%] Building CXX object src/examples/cpp/CMakeFiles/ir.dir/ir.cpp.o
[ 91%] Linking CXX executable taint_reg
[ 92%] Linking CXX executable ir
[ 93%] Linking CXX executable info_reg
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_disasm' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_free'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_open' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_option'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_close' collect2: error: ld returned 1 exit status make[2]: *** [src/examples/cpp/CMakeFiles/taint_reg.dir/build.make:99: src/examples/cpp/taint_reg] Error 1 make[1]: *** [CMakeFiles/Makefile2:1070: src/examples/cpp/CMakeFiles/taint_reg.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_disasm'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_free' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_open'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_option' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_close'
collect2: error: ld returned 1 exit status
make[2]: *** [src/examples/cpp/CMakeFiles/ir.dir/build.make:99: src/examples/cpp/ir] Error 1
make[1]: *** [CMakeFiles/Makefile2:1122: src/examples/cpp/CMakeFiles/ir.dir/all] Error 2
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_disasm' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_free'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_open' /usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to cs_option'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `cs_close'
collect2: error: ld returned 1 exit status
make[2]: *** [src/examples/cpp/CMakeFiles/info_reg.dir/build.make:99: src/examples/cpp/info_reg] Error 1
make[1]: *** [CMakeFiles/Makefile2:1096: src/examples/cpp/CMakeFiles/info_reg.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

thx,
Holger

@fadillzzz
Copy link

cs_disasm is a function provided by capstone. Make sure you're linking the output to capstone library.

@hunterbr72
Copy link
Author

hunterbr72 commented Dec 12, 2024 via email

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