google / souper

A superoptimizer for LLVM IR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLVM unable to find Z3

tfeng opened this issue · comments

While building with build_docker.sh, I observed the following error:

...
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Z3: Found unsuitable version "/usr/src/souper/third_party/llvm/Release-build/CMakeFiles/CMakeTmp/cmTC_ddcb5: error while loading shared libraries: libz3.so: cannot open shared object file: No such file or directory
", but required is at least "4.7.1" (found /usr/src/souper/third_party/z3-install/lib/libz3.a)
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
...

On checking build_deps.sh and contents in the container, I found Z3 was built and installed into /usr/src/souper/third_party/z3-install. Its include and lib directories were properly set in LLVM's cmake command. However, libz3.so was not found because it was not in LD_LIBRARY_PATH.

Adding the following line in build_deps.sh leads to a successful message.

export LD_LIBRARY_PATH=$z3_installdir/lib:$LD_LIBRARY_PATH

The message is now this.

...
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Z3: /usr/src/souper/third_party/z3-install/lib/libz3.a (found suitable version "4.8.6", minimum required is "4.7.1") 
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
...