Discussion:
Arch linux: Cannot build Klee , stuck with "Unable to link with libstp"
ThanhVu (Vu) Nguyen
2014-02-12 02:12:15 UTC
Permalink
Hi,

I try to build Klee using the instruction from this page
http://ccadar.github.io/klee/GetStarted.html . I was not able to build
stp-r940.tgz, after doing "make OPTIMIZE=-O2 CFLAGS_M32= install" , I get
error about AssertsQuery not declared in scope (see [1]). So I try the
latest version of stp as suggested from this message
http://www.mail-archive.com/klee-dev-AQ/***@public.gmane.org/msg01315.html . I was
able to build this stp version fine with the make command "make
CFLAGS_M32= -j2".
Next, after building klee-uclibc and get to step 6 configure KLEE, after
issuing the command

./configure --with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtime,

I get the error about -lstp as below

checking for stp/c_interface.h... yes
checking for vc_setInterfaceFlags in -lstp... no
configure: error: Unable to link with libstp

As suggested from this msg
http://keeda.stanford.edu/pipermail/klee-dev/2012-October/000940.html , I
checked and verified the file lib/libstp.a etc are in the STP dir. The
command readelf -h lib/libstp.a gives something like
File: lib/libstp.a(SMTLIBPrinter.cpp.o)

ELF Header:
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
Machine: Advanced Micro Devices X86-64
...

Note that I did build stp with CFLAGS_M32, i.e., make CFLAGS_M32= -j2.


I was able to build KLEE with STP r940 just fine on Debian so it seems
there's some incompatibility problem among Arch Linux, Klee, and STP. I
would appreciate any suggestion on how to get Klee built on my system.
Thanks in advance.



---
Arch system info: uname -a
Linux prime 3.11.6-1-ARCH #1 SMP PREEMPT Fri Oct 18 23:22:36 CEST 2013
x86_64 GNU/Linux

[1] error when building stp-r940
CVC.y:1109.3-1114.1: warning: rule useless in parser due to conflicts
[-Wother]
| Updates WITH_TOK '[' Expr ']' ASSIGN_TOK Expr
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
flex -Cfe -olexCVC.cpp -Pcvc CVC.lex
g++ -O2 -DCRYPTOMINISAT2 -I../../src/ -I../AST -DONLY_MSPACES -DMSPACES
-I../../src/sat/cryptominisat2/mtl -I../../src/sat/cryptominisat2
-DEXT_HASH_MAP -Wno-deprecated -c -o lexCVC.o lexCVC.cpp
g++ -O2 -DCRYPTOMINISAT2 -I../../src/ -I../AST -DONLY_MSPACES -DMSPACES
-I../../src/sat/cryptominisat2/mtl -I../../src/sat/cryptominisat2
-DEXT_HASH_MAP -Wno-deprecated -c -o parseCVC.o parseCVC.cpp
CVC.y: In function ‘int cvcparse()’:
CVC.y:211:13: error: ‘AssertsQuery’ was not declared in this scope
((ASTVec*)AssertsQuery)->push_back(parserInterface->CreateNode(TRUE));
^
CVC.y:217:13: error: ‘AssertsQuery’ was not declared in this scope
((ASTVec*)AssertsQuery)->push_back(parserInterface->CreateNode(TRUE));
^
CVC.y:233:13: error: ‘AssertsQuery’ was not declared in this scope
((ASTVec*)AssertsQuery)->push_back(asserts);
^
<builtin>: recipe for target 'parseCVC.o' failed
make[1]: *** [parseCVC.o] Error 1
make[1]: Leaving directory
'/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp-r940/src/parser'
Makefile:26: recipe for target 'all' failed
make: *** [all] Error 2

Vu,
Daniel Liew
2014-02-12 08:30:21 UTC
Permalink
This post might be inappropriate. Click to display it.
ThanhVu (Vu) Nguyen
2014-02-12 14:57:16 UTC
Permalink
I got a permission denied

git pull git-9UaJU3cA/F/QT0dZR+***@public.gmane.org:delcypher/klee.git feature_support_stp_with_boost
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of
known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.




Vu,
Daniel Liew
2014-02-12 15:04:03 UTC
Permalink
Oops I gave you URL that only works if you have GitHub SSH keys setup...

Try this instead...

git pull https://github.com/delcypher/klee.git feature_support_stp_with_boost
Post by ThanhVu (Vu) Nguyen
I got a permission denied
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of
known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Vu,
ThanhVu (Vu) Nguyen
2014-02-12 15:08:39 UTC
Permalink
That seems to work , but now when running configure I get some other
checking error about LLVM Bitcode. This check passed fine using the klee
original repo. The LLVM2.9 was built as instructed from
http://ccadar.github.io/klee/GetStarted.html


./configure --with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtimechecking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking type of operating system we're going to host on...

checking llvm source dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9

checking llvm obj dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9

checking llvm package version... 2.9

checking llvm version major... 2

checking llvm version minor... 9

checking llvm is release version... 1

checking llvm build mode... Release+Asserts

checking LLVM Bitcode compiler...

checking for llvm-gcc... NOT_FOUND



checking for clang... FOUND

checking for clang++... FOUND

Using C llvm compiler : /usr/bin/clang

Using C++ llvm compiler : /usr/bin/clang++

checking C LLVM Bitcode compiler works...
/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/Release+Asserts/bin/llvm-dis:
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly. Maybe
your LLVM versions do not match?
git pull https://github.com/delcypher/klee.gitfeature_support_stp_with_boost
Vu,
ThanhVu (Vu) Nguyen
2014-02-12 15:15:11 UTC
Permalink
Perhaps you can give me the latest repo of STP that are known to work on
KLEE & Arch ? I.e., the one that passes the libstp check .

Vu,
Post by ThanhVu (Vu) Nguyen
That seems to work , but now when running configure I get some other
checking error about LLVM Bitcode. This check passed fine using the klee
original repo. The LLVM2.9 was built as instructed from
http://ccadar.github.io/klee/GetStarted.html
./configure --with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtimechecking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking type of operating system we're going to host on...
checking llvm source dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
checking llvm obj dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
checking llvm package version... 2.9
checking llvm version major... 2
checking llvm version minor... 9
checking llvm is release version... 1
checking llvm build mode... Release+Asserts
checking LLVM Bitcode compiler...
checking for llvm-gcc... NOT_FOUND
checking for clang... FOUND
checking for clang++... FOUND
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly. Maybe
your LLVM versions do not match?
git pull https://github.com/delcypher/klee.gitfeature_support_stp_with_boost
Vu,
Daniel Liew
2014-02-12 15:34:28 UTC
Permalink
The new issue you are seeing now has nothing to do with STP. It is to
do with your LLVM bitcode compiler. LLVM Bitcode is not stable between
releases of LLVM (i.e. you cannot mix LLVM bitcode generated by
LLVM2.9 and LLVM3.3)

If see the configure output...

Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/Release+Asserts/bin/llvm-dis:
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly.
Maybe your LLVM versions do not match?

Configure is trying to use your system's clang as the LLVM bitcode
compiler (which is probably Clang 3.3 or 3.4, depending on when you
last ran ``pacman -Syuu``). This won't work (if you use LLVM2.9) and
configure rightly stops you from going any further. If you intend to
use LLVM2.9 with KLEE then you need to put the llvm-gcc [1] compiler
in your PATH before running KLEE's configure script.

[1] http://llvm.org/releases/2.9/llvm-gcc4.2-2.9-x86_64-linux.tar.bz2
or http://llvm.org/releases/2.9/llvm-gcc-4.2-2.9-i686-linux.tgz


Hope that helps.
Dan.
Post by ThanhVu (Vu) Nguyen
Perhaps you can give me the latest repo of STP that are known to work on
KLEE & Arch ? I.e., the one that passes the libstp check .
Vu,
Post by ThanhVu (Vu) Nguyen
That seems to work , but now when running configure I get some other
checking error about LLVM Bitcode. This check passed fine using the klee
original repo. The LLVM2.9 was built as instructed from
http://ccadar.github.io/klee/GetStarted.html
./configure --with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtimechecking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking type of operating system we're going to host on...
checking llvm source dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
checking llvm obj dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
checking llvm package version... 2.9
checking llvm version major... 2
checking llvm version minor... 9
checking llvm is release version... 1
checking llvm build mode... Release+Asserts
checking LLVM Bitcode compiler...
checking for llvm-gcc... NOT_FOUND
checking for clang... FOUND
checking for clang++... FOUND
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly. Maybe
your LLVM versions do not match?
Post by Daniel Liew
git pull https://github.com/delcypher/klee.git
feature_support_stp_with_boost
Vu,
ThanhVu (Vu) Nguyen
2014-02-12 15:42:19 UTC
Permalink
The LLVM2.9 bin path is in my PATH. But it *does not* have clang++ or
clang as shown below. The original klee repo configure script apparently
does not check (and use?) clang* that's why I didn't get such errors
before.

prime Wed Feb 12:08:35:58 (4270)
~/Src/Devel/KLEE/llvm-gcc4.2-2.9-x86_64-linux/bin
$ ls
llvm-c++* x86_64-unknown-linux-gnu-cpp-4.2.1*
llvm-cpp* x86_64-unknown-linux-gnu-gcc-4.2.1*
llvm-g++* x86_64-unknown-linux-gnu-llvm-c++*
llvm-gcc* x86_64-unknown-linux-gnu-llvm-cpp*
llvm-gccbug* x86_64-unknown-linux-gnu-llvm-g++*
llvm-gcov* x86_64-unknown-linux-gnu-llvm-gcc*
llvm-gfortran* x86_64-unknown-linux-gnu-llvm-gfortran*


Vu,
Post by Daniel Liew
The new issue you are seeing now has nothing to do with STP. It is to
do with your LLVM bitcode compiler. LLVM Bitcode is not stable between
releases of LLVM (i.e. you cannot mix LLVM bitcode generated by
LLVM2.9 and LLVM3.3)
If see the configure output...
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly.
Maybe your LLVM versions do not match?
Configure is trying to use your system's clang as the LLVM bitcode
compiler (which is probably Clang 3.3 or 3.4, depending on when you
last ran ``pacman -Syuu``). This won't work (if you use LLVM2.9) and
configure rightly stops you from going any further. If you intend to
use LLVM2.9 with KLEE then you need to put the llvm-gcc [1] compiler
in your PATH before running KLEE's configure script.
[1] http://llvm.org/releases/2.9/llvm-gcc4.2-2.9-x86_64-linux.tar.bz2
or http://llvm.org/releases/2.9/llvm-gcc-4.2-2.9-i686-linux.tgz
Hope that helps.
Dan.
Post by ThanhVu (Vu) Nguyen
Perhaps you can give me the latest repo of STP that are known to work on
KLEE & Arch ? I.e., the one that passes the libstp check .
Vu,
Post by ThanhVu (Vu) Nguyen
That seems to work , but now when running configure I get some other
checking error about LLVM Bitcode. This check passed fine using the
klee
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
original repo. The LLVM2.9 was built as instructed from
http://ccadar.github.io/klee/GetStarted.html
./configure --with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtimechecking build system type...
x86_64-unknown-linux-gnu
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking type of operating system we're going to host on...
checking llvm source dir...
/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking llvm obj dir... /nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
checking llvm package version... 2.9
checking llvm version major... 2
checking llvm version minor... 9
checking llvm is release version... 1
checking llvm build mode... Release+Asserts
checking LLVM Bitcode compiler...
checking for llvm-gcc... NOT_FOUND
checking for clang... FOUND
checking for clang++... FOUND
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly. Maybe
your LLVM versions do not match?
On Wed, Feb 12, 2014 at 8:04 AM, Daniel Liew <
Post by Daniel Liew
git pull https://github.com/delcypher/klee.git
feature_support_stp_with_boost
Vu,
Cristian Cadar
2014-02-12 15:46:18 UTC
Permalink
Hi, instead of debugging this on the mailing list, I think it would be
better to open an issue on GitHub.

Thanks,
Cristian
Post by ThanhVu (Vu) Nguyen
The LLVM2.9 bin path is in my PATH. But it *does not* have clang++ or
clang as shown below. The original klee repo configure script
apparently does not check (and use?) clang* that's why I didn't get
such errors before.
prime Wed Feb 12:08:35:58 (4270)
~/Src/Devel/KLEE/llvm-gcc4.2-2.9-x86_64-linux/bin
$ ls
llvm-c++* x86_64-unknown-linux-gnu-cpp-4.2.1*
llvm-cpp* x86_64-unknown-linux-gnu-gcc-4.2.1*
llvm-g++* x86_64-unknown-linux-gnu-llvm-c++*
llvm-gcc* x86_64-unknown-linux-gnu-llvm-cpp*
llvm-gccbug* x86_64-unknown-linux-gnu-llvm-g++*
llvm-gcov* x86_64-unknown-linux-gnu-llvm-gcc*
llvm-gfortran* x86_64-unknown-linux-gnu-llvm-gfortran*
Vu,
The new issue you are seeing now has nothing to do with STP. It is to
do with your LLVM bitcode compiler. LLVM Bitcode is not stable between
releases of LLVM (i.e. you cannot mix LLVM bitcode generated by
LLVM2.9 and LLVM3.3)
If see the configure output...
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM assembly.
Maybe your LLVM versions do not match?
Configure is trying to use your system's clang as the LLVM bitcode
compiler (which is probably Clang 3.3 or 3.4, depending on when you
last ran ``pacman -Syuu``). This won't work (if you use LLVM2.9) and
configure rightly stops you from going any further. If you intend to
use LLVM2.9 with KLEE then you need to put the llvm-gcc [1] compiler
in your PATH before running KLEE's configure script.
[1] http://llvm.org/releases/2.9/llvm-gcc4.2-2.9-x86_64-linux.tar.bz2
or http://llvm.org/releases/2.9/llvm-gcc-4.2-2.9-i686-linux.tgz
Hope that helps.
Dan.
Post by ThanhVu (Vu) Nguyen
Perhaps you can give me the latest repo of STP that are known to
work on
Post by ThanhVu (Vu) Nguyen
KLEE & Arch ? I.e., the one that passes the libstp check .
Vu,
On Wed, Feb 12, 2014 at 8:08 AM, ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
That seems to work , but now when running configure I get some
other
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking error about LLVM Bitcode. This check passed fine using
the klee
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
original repo. The LLVM2.9 was built as instructed from
http://ccadar.github.io/klee/GetStarted.html
./configure
--with-llvm=/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9/
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
--with-stp=/nfs/adaptive/tnguyen/Src/Devel/KLEE/stp/binary-build/
--with-uclibc=/nfs/adaptive/tnguyen/Src/Devel/KLEE/klee-uclibc/
--enable-posix-runtimechecking build system type...
x86_64-unknown-linux-gnu
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking type of operating system we're going to host on...
checking llvm source dir...
/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking llvm obj dir...
/nfs/adaptive/tnguyen/Src/Devel/KLEE/llvm-2.9
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
checking llvm package version... 2.9
checking llvm version major... 2
checking llvm version minor... 9
checking llvm is release version... 1
checking llvm build mode... Release+Asserts
checking LLVM Bitcode compiler...
checking for llvm-gcc... NOT_FOUND
checking for clang... FOUND
checking for clang++... FOUND
Using C llvm compiler : /usr/bin/clang
Using C++ llvm compiler : /usr/bin/clang++
checking C LLVM Bitcode compiler works...
Unknown bitstream version!
configure: error: Failed converting LLVM Bitcode to LLVM
assembly. Maybe
Post by ThanhVu (Vu) Nguyen
Post by ThanhVu (Vu) Nguyen
your LLVM versions do not match?
On Wed, Feb 12, 2014 at 8:04 AM, Daniel Liew
Post by Daniel Liew
git pull https://github.com/delcypher/klee.git
feature_support_stp_with_boost
Vu,
_______________________________________________
klee-dev mailing list
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev
Daniel Liew
2014-02-12 15:56:53 UTC
Permalink
Current upsteam KLEE has the following order of precedence in the
configure script for detecting the bitcode compiler.

1. Clang inside your LLVM build directory
2. llvm-gcc in your PATH environment
3. clang in your PATH environment

If llvm-gcc is in your PATH and you didn't build clang inside your
llvm build directory then llvm-gcc should be picked up. If it really
isn't working for some bizarre reason you can force the bitcode
compiler by doing

$ ./configure --with-llvmcc=/path/to/llvm-gcc
--with-llvmcxx=/path/to/llvm-g++ <other configure options>
The LLVM2.9 bin path is in my PATH. But it *does not* have clang++ or clang as shown below. The original klee repo configure script apparently does not check (and use?) clang* that's why I didn't get such errors before.
I don't know what you mean by "original klee repo".
prime Wed Feb 12:08:35:58 (4270)
~/Src/Devel/KLEE/llvm-gcc4.2-2.9-x86_64-linux/bin
$ ls
llvm-c++* x86_64-unknown-linux-gnu-cpp-4.2.1*
llvm-cpp* x86_64-unknown-linux-gnu-gcc-4.2.1*
llvm-g++* x86_64-unknown-linux-gnu-llvm-c++*
llvm-gcc* x86_64-unknown-linux-gnu-llvm-cpp*
llvm-gccbug* x86_64-unknown-linux-gnu-llvm-g++*
llvm-gcov* x86_64-unknown-linux-gnu-llvm-gcc*
llvm-gfortran* x86_64-unknown-linux-gnu-llvm-gfortran*
This does not actually prove that llvm-gcc is your path...you should
do something like

$ which llvm-gcc
/home/dsl11/dev/klee/llvm-gcc4.2-2.9-x86_64-linux/bin/llvm-gcc

to check. The fact that KLEE's configure script picked up clang as the
bitcode compiler would indicate (unless there's a bug in the configure
script) that llvm-gcc is not in your PATH when you ran configure.


Thanks,
Dan.

Loading...