I tried to build solidity compiler (solc) from source code, which was cloned from Solidity Git Repository. I followed the instructions in Solidity Documentation, but I ran into an error when execute: cmake .. && make. The cmake error is as follows:

[ 42%] Building CXX object libsolidity/CMakeFiles/solidity.dir/formal/Z3Interface.cpp.o
/my/path/to/solidity/libsolidity/formal/Z3Interface.cpp: In member function ‘z3::expr dev::solidity::smt::Z3Interface::toZ3Expr(const dev::solidity::smt::Expression&)’:
/my/path/to/solidity/libsolidity/formal/Z3Interface.cpp:166:14: error: ‘mod’ is not a member of ‘z3’
   return z3::mod(arguments[0], arguments[1]);
/my/path/to/solidity/libsolidity/formal/Z3Interface.cpp:166:14: note: suggested alternative: ‘cond’
   return z3::mod(arguments[0], arguments[1]);
libsolidity/CMakeFiles/solidity.dir/build.make:1166: recipe for target 'libsolidity/CMakeFiles/solidity.dir/formal/Z3Interface.cpp.o' failed
make[2]: *** [libsolidity/CMakeFiles/solidity.dir/formal/Z3Interface.cpp.o] Error 1
CMakeFiles/Makefile2:389: recipe for target 'libsolidity/CMakeFiles/solidity.dir/all' failed
make[1]: *** [libsolidity/CMakeFiles/solidity.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

I have installed z3 prover with pre-built binaries (version 4.8.4 - 64 bit - build hashcode d6df51951f4c) provided here and z3/bin has been included in my PATH variable.

I was using Ubuntu 18.04.

Did I install z3 in a wrong way? Solidity Documentation mentions that z3 is optional, so I don't think this error is related to my z3 installation.

Can anybody help? Thanks very much!

1 Answer 1


I found the root cause after opening an issue here. I have multiple Z3 versions and cmake is confused.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.