Reputation: 289
I'm trying to run a program in python3 that has Z3 as a dependency (imports z3)
I was able to install the unstable version of Z3 (which is suppose to support Python3), but it install the libraries for python2.7 only.
Here are the instructions at the project:
python scripts/mk_make.py
cd build
make
sudo make install
Does anybody know how to install Z3 work for Python3?
Thanks.
Upvotes: 2
Views: 6453
Reputation: 11838
For anyone who is wondering about this later on.
I created an alias from 'python' to 'python3' and then ran the install command on the z3 git repo.
alias python=python3 #alias for the script to use.
python scripts/mk_make.py --prefix=/home/leo
cd build
make
make install
Upvotes: 1
Reputation: 289
I had to modify scripts/mk_util.py in order to convert a few lines from Python2 to Python3 and also replace tab with spaces in other few lines, after that it worked!.
It seems somebody accidentally introduced changes not compatible with Python3.
I noticed Leonardo de Moura about this and he made a change in z3 git repo.
Here's a path just in case
--- z3-original/scripts/mk_util.py
+++ z3/scripts/mk_util.py
@@ -640,7 +640,7 @@
def is_clang_in_gpp_form(cc):
version_string = subprocess.check_output([cc, '--version'])
- return version_string.find('clang') != -1
+ return str(version_string).find('clang') != -1
def is_CXX_clangpp():
if is_compiler(CXX, 'g++'):
@@ -1485,7 +1485,7 @@
print('Java Compiler: %s' % JAVAC)
else:
global CXX, CC, GMP, FOCI2, CPPFLAGS, CXXFLAGS, LDFLAGS, EXAMP_DEBUG_FLAG
- OS_DEFINES = ""
+ OS_DEFINES = ""
ARITH = "internal"
check_ar()
CXX = find_cxx_compiler()
@@ -1508,7 +1508,7 @@
SLIBEXTRAFLAGS = '%s %s' % (SLIBEXTRAFLAGS,FOCI2LIB)
CPPFLAGS = '%s -D_FOCI2' % CPPFLAGS
else:
- print "FAILED\n"
+ print("FAILED\n")
FOCI2 = False
if GIT_HASH:
CPPFLAGS = '%s -DZ3GITHASH=%s' % (CPPFLAGS, GIT_HASH)
@@ -1536,21 +1536,21 @@
SLIBFLAGS = '-dynamiclib'
elif sysname == 'Linux':
CXXFLAGS = '%s -fno-strict-aliasing -D_LINUX_' % CXXFLAGS
- OS_DEFINES = '-D_LINUX'
+ OS_DEFINES = '-D_LINUX'
SO_EXT = '.so'
LDFLAGS = '%s -lrt' % LDFLAGS
SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
elif sysname == 'FreeBSD':
CXXFLAGS = '%s -fno-strict-aliasing -D_FREEBSD_' % CXXFLAGS
- OS_DEFINES = '-D_FREEBSD_'
+ OS_DEFINES = '-D_FREEBSD_'
SO_EXT = '.so'
LDFLAGS = '%s -lrt' % LDFLAGS
SLIBFLAGS = '-shared'
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
elif sysname[:6] == 'CYGWIN':
CXXFLAGS = '%s -D_CYGWIN -fno-strict-aliasing' % CXXFLAGS
- OS_DEFINES = '-D_CYGWIN'
+ OS_DEFINES = '-D_CYGWIN'
SO_EXT = '.dll'
SLIBFLAGS = '-shared'
else:
@@ -1586,7 +1586,7 @@
config.write('SLINK_FLAGS=%s\n' % SLIBFLAGS)
config.write('SLINK_EXTRA_FLAGS=%s\n' % SLIBEXTRAFLAGS)
config.write('SLINK_OUT_FLAG=-o \n')
- config.write('OS_DEFINES=%s\n' % OS_DEFINES)
+ config.write('OS_DEFINES=%s\n' % OS_DEFINES)
if is_verbose():
print('Host platform: %s' % sysname)
print('C++ Compiler: %s' % CXX)
Upvotes: 1