wmkhoo / taintgrind

A taint-tracking plugin for the Valgrind memory checking tool
GNU General Public License v2.0
249 stars 42 forks source link

Error in building taintgrind: Skipping incompatible libcapstone.a #25

Closed yasaminmahmoodi closed 6 years ago

yasaminmahmoodi commented 6 years ago

Hello, I am trying to build taintgrind, but in the last part (after make check) it gives me 2 errors:

/usr/bin/ld: cannot find -lcapstone collect2: error: ld returned 1 exit status Makefile:1002: recipe for target 'taintgrind-x86-linux' failed make[2]: [taintgrind-x86-linux] Error 1 make[2]: Leaving directory ~/valgrind-3.14.0/taintgrind' Makefile:1236: recipe for target 'all-recursive' failed make[1]: [all-recursive] Error 1 make[1]: Leaving directory ~/valgrind-3.14.0/taintgrind' Makefile:940: recipe for target 'all' failed make: *** [all] Error 2

vanhauser-thc commented 6 years ago

as you can see you in your output is that libcapstone.so is not found.

did you compile and install capstone? is -L/usr/local/lib in your Makefile?

yasaminmahmoodi commented 6 years ago

for capstone i just followed the instruction you mentioned (# build capstone cd taintgrind && \ wget https://github.com/aquynh/capstone/archive/3.0.4.tar.gz -O capstone.tar.gz && \ tar xf capstone.tar.gz && \ sh configure_capstone.sh pwd/../build && \ cd capstone-3.0.4 && \ sh make_capstone.sh)

-L/usr/local/lib in not in the makefile of capstone

wmkhoo commented 6 years ago

If you look inside the capstone-3.0.4 directory, do you see a binary called libcapstone.a?

yasaminmahmoodi commented 6 years ago

There is an Archive file called libcapstone.a in capstone-3.0.4 directory.

yasaminmahmoodi commented 6 years ago

I installed libcapstone but still have that error.

libcapstone-dev/xenial,now 3.0.4-0.2 amd64 [installed] libcapstone3/xenial,now 3.0.4-0.2 amd64 [installed,automatic]

yasaminmahmoodi commented 6 years ago

The first errir is like that : /usr/bin/ld: skipping incompatible ./capstone-3.0.4//libcapstone.a when searching for -lcapstone /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../libcapstone.a when searching for -lcapstone /usr/bin/ld: skipping incompatible //usr/lib/libcapstone.a when searching for -lcapstone /usr/bin/ld: cannot find -lcapstone collect2: error: ld returned 1 exit status

wmkhoo commented 6 years ago

Ok great. When you run 'make' in the taintgrind directory, what is the last compiler command (containing 'gcc'), before the error message?

yasaminmahmoodi commented 6 years ago

gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVGPV_x86_linux_vanilla=1 -m32 -mpreferred-stack-boundary=2 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin -fomit-frame-pointer -O2 -MT taintgrind_x86_linux-tnt_asm.o -MD -MP -MF .deps/taintgrind_x86_linux-tnt_asm.Tpo -c -o taintgrind_x86_linux-tnt_asm.o test -f 'tnt_asm.c' || echo './'tnt_asm.c

wmkhoo commented 6 years ago

/usr/bin/ld: skipping incompatible ./capstone-3.0.4//libcapstone.a when searching for -lcapstone

Ok this seems to be a problem. Are you trying to compile 32-bit taintgrind on a 64-bit OS?

yasaminmahmoodi commented 6 years ago

I use Ubuntu 16.04.5, 64bit. And the taintgrind says that Support for Valgrind 3.14.0, x86_linux, amd64_linux, arm_linux

wmkhoo commented 6 years ago

Please see if this patch works

yasaminmahmoodi commented 6 years ago

Perfect! Now it works.

Thank you.

wmkhoo commented 6 years ago

Ok closing this issue