jburnim / crest

CREST is a concolic test generation tool for C.
http://jburnim.github.io/crest/
BSD 2-Clause "Simplified" License
159 stars 50 forks source link

Error while compiling CREST : base/basic_types.cc #5

Open uwevil opened 7 years ago

uwevil commented 7 years ago

Hello, I'am starting using CREST but as subject, I have a problem of "narrowing conversion" as follow

vagrant@vagrant:~/vagrant_data/tools/jburnim-crest-f5ff7fc/src$ make g++ -I. -I../../yices-1.0.40/include -Wall -O2 -c -o base/basic_types.o base/basic_types.cc base/basic_types.cc:96:1: error: narrowing conversion of '18446744073709551615u' from 'long unsigned int' to 'crest::value_t {aka long long int}' inside { } [-Wnarrowing] }; ^ base/basic_types.cc:96:1: error: narrowing conversion of '18446744073709551615ull' from 'long long unsigned int' to 'crest::value_t {aka long long int}' inside { } [-Wnarrowing]

: recipe for target 'base/basic_types.o' failed make: *** [base/basic_types.o] Error 1

How is it? Does anyone have same problem?

I'm using Lubuntu 16.10, running on VM.

Thank you for your help. uwevil

jburnim commented 7 years ago

What version of g++ are you using? In particular, what is the output of running g++ --version?

It looks like gcc6 now treats "narrowing conversions" as an error rather than a warning. You should be able to work around this issue by either using an earlier version of gcc or by adding -std=gnu++98 to CFLAGS in crest/src/Makefile.

liartist commented 6 years ago

I encountered same problem with uwevil, and solved it. But as I proceed,

`g++ -I. -I/home/Desktop/yices-1.0.40/include -Wall -O2 -std=gnu++98 -c -o base/yices_solver.o base/yices_solver.cc base/yices_solver.cc:18:10: fatal error: yices_c.h: No such file or directory

include

      ^~~~~~~~~~~

compilation terminated.

: recipe for target 'base/yices_solver.o' failed make: *** [base/yices_solver.o] Error 1` this error came out, so I edited the location of **yices_c.h** in **yices_solver.cc** to my yices directory. then, `/usr/bin/x86_64-linux-gnu-ld: cannot find -lyices collect2: error: ld returned 1 exit status : recipe for target 'run_crest/run_crest' failed make: *** [run_crest/run_crest] Error 1` this new error came out and I can't solve it since there's not enough info. Can you suggest some solutions for me? Since I just made new VM environment, some essential materials are not installed so it could be a problem. I'm using Ubuntu 18.04.1 +. I tested same routine with Ubuntu 16.04.4, and same things happened.
jburnim commented 6 years ago

this error came out, so I edited the location of yices_c.h in yices_solver.cc to my yices directory. then

Have you set YICES_DIR in crest/src/Makefile to point to the directory containing Yices on your machine?

What version of Yices have you downloaded?

liartist commented 6 years ago

Thank you for the reply! I downloaded last release of Yices1(version 1.0.40) tar file and extracted at the VM, and edited YICES_DIR in crest/src/Makefile to be connected with my extracted Yices directory. I also downloaded and installed GMP(GNU Multiprecision library) as Yices download page says, but I'm not sure it solved any problems I have.

liartist commented 6 years ago

here's the full error message

`lartist@ubuntu:~/Desktop/crest-master/src$ make g++ -I. -I/home/lartist/Desktop/yices-1.0.40-x86_64-unknown-linux-gnu-static-gmp/yices-1.0.40/include -Wall -O2 -Wno-deprecated -L/home/lartist/Desktop/yices-1.0.40-x86_64-unknown-linux-gnu-static-gmp/yices-1.0.40/lib run_crest/run_crest.cc run_crest/concolic_search.o base/basic_types.o base/symbolic_execution.o base/symbolic_interpreter.o base/symbolic_path.o base/symbolic_predicate.o base/symbolic_expression.o base/yices_solver.o -lyices -o run_crest/run_crest /usr/bin/x86_64-linux-gnu-ld: /home/lartist/Desktop/yices-1.0.40-x86_64-unknown-linux-gnu-static-gmp/yices-1.0.40/lib/libyices.a(yices.o): relocation R_X86_64_32 against symbol '_ZNSt8detail12prime_listE' can not be used when making a PIE object; recompile with -fPIC /usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status

: recipe for target 'run_crest/run_crest' failed make: *** [run_crest/run_crest] Error 1`
liartist commented 6 years ago

I added -no-pie option to src/makefile and it seems working! I can proceed now. Thanks!

+. Ubuntu version 18 has package crush issue. 16 was fine

++. I found silly situation. I installed many things like GMP, updated every packages so that the installation process encountered many problems. However, when I re-installed with simple guidelines(extract yices, edit YICES_DIR, installed ocaml and g++-multilib), not much errors came out and CREST running process was fine.

quinzio commented 5 years ago

Yep, -no-pie is the cure.