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

When building pintool: error: missing binary operator before token "(" #935

Closed
moyix opened this issue Aug 6, 2020 · 4 comments
Closed

Comments

@moyix
Copy link

moyix commented Aug 6, 2020

When building the PinTool on Ubuntu 18.04 and Pin 3.15-98253-gb56e429b1, I get:

[ 80%] Building CXX object src/tracer/pin/CMakeFiles/pintool.dir/api.cpp.o
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533:0,
                 from /usr/include/c++/7/bits/stl_algobase.h:59,
                 from /usr/include/c++/7/bits/stl_tree.h:63,
                 from /usr/include/c++/7/set:60,
                 from /home/moyix/pintmp/pin-3.15-98253-gb56e429b1-gcc-linux/source/tools/Triton/src/libtriton/includes/triton/architecture.hpp:11,
                 from /home/moyix/pintmp/pin-3.15-98253-gb56e429b1-gcc-linux/source/tools/Triton/src/libtriton/includes/triton/api.hpp:11,
                 from /home/moyix/pintmp/pin-3.15-98253-gb56e429b1-gcc-linux/source/tools/Triton/src/tracer/pin/api.cpp:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:44:19: error: missing binary operator before token "("
 #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
                   ^

From other issues I found it seems this might be due to glibc being too new and Pin monkeying with the standard headers somehow.

As a side question, is there a particular distribution/version and kernel version that Triton is known to work well with?

Note: I also had to add a couple other include paths to src/tracer/pin/CMakeLists.txt to get it to find XED and the Pin CRT:

diff --git a/src/tracer/pin/CMakeLists.txt b/src/tracer/pin/CMakeLists.txt
index 5209af3a..6dc7202a 100644
--- a/src/tracer/pin/CMakeLists.txt
+++ b/src/tracer/pin/CMakeLists.txt
@@ -59,16 +59,19 @@ endif()
 # Includes directories (Pin)
 if(${ARCHITECTURE} STREQUAL "i386")
     include_directories("${PIN_ROOT}/extras/xed-ia32/include")
+    include_directories("${PIN_ROOT}/extras/xed-ia32/include/xed")
 endif()
 
 if(${ARCHITECTURE} STREQUAL "amd64")
     include_directories("${PIN_ROOT}/extras/xed-intel64/include")
+    include_directories("${PIN_ROOT}/extras/xed-intel64/include/xed")
 endif()
 
 include_directories("${PIN_ROOT}/source/include/pin")
 include_directories("${PIN_ROOT}/source/include/pin/gen")
 include_directories("${PIN_ROOT}/extras/components/include")
 include_directories("${PIN_ROOT}/source/tools/InstLib")
+include_directories("${PIN_ROOT}/extras/crt/include")
 
 
 # Libs directories (Pin)
@XVilka
Copy link
Contributor

XVilka commented Aug 7, 2020

@JonathanSalwan
Copy link
Owner

Hey Brendan,

The only difference between Pin 2.14 and pin 3 is their CRT. As far as I tested, using their CRT implies several issues when linking with other libs (e.g: libpython, libtriton). So, if you want to the use the Pin tracer and the libTriton, I recommend to use Pin 2.14 (which is maintained only for Python 2.7).

The compile:

$ mkdir build ; cd build
$ cmake -DPINTOOL=on -DPYTHON36=off ..
$ ./triton ../src/examples/pin/ir.py /usr/bin/id

@JonathanSalwan
Copy link
Owner

I've also made a QBDI+Triton tracer.

@moyix
Copy link
Author

moyix commented Aug 7, 2020

Nice, this works quite well! :) Thanks!

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

No branches or pull requests

3 participants