Skip to content

Commit b929996

Browse files
update to set single threaded
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent f39198d commit b929996

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/api/python/setup.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class LibError(Exception):
2525
SRC_DIR_REPO = os.path.join(ROOT_DIR, '..', '..', '..')
2626
SRC_DIR = SRC_DIR_LOCAL if os.path.exists(SRC_DIR_LOCAL) else SRC_DIR_REPO
2727

28+
IS_SINGLE_THREADED = False
29+
2830
IS_PYODIDE = 'PYODIDE_ROOT' in os.environ and os.environ.get('_PYTHON_HOST_PLATFORM', '').startswith('emscripten')
2931

3032
# determine where binaries are
@@ -37,10 +39,12 @@ class LibError(Exception):
3739
BUILD_PLATFORM = "emscripten"
3840
BUILD_ARCH = "wasm32"
3941
BUILD_OS_VERSION = os.environ['_PYTHON_HOST_PLATFORM'].split('_')[1:-1]
40-
build_env['CFLAGS'] = build_env.get('CFLAGS', '') + " -fexceptions -pthread"
41-
build_env['CXXFLAGS'] = build_env.get('CXXFLAGS', '') + " -fexceptions -pthread"
42-
build_env['LDFLAGS'] = build_env.get('LDFLAGS', '') + " -fexceptions -pthread"
43-
42+
build_env['CFLAGS'] = build_env.get('CFLAGS', '') + " -fexceptions"
43+
build_env['CXXFLAGS'] = build_env.get('CXXFLAGS', '') + " -fexceptions"
44+
build_env['LDFLAGS'] = build_env.get('LDFLAGS', '') + " -fexceptions"
45+
IS_SINGLE_THREADED = True
46+
# build with pthread doesn't work. The WASM bindings are also single threaded.
47+
4448
else:
4549
BUILD_PLATFORM = sys.platform
4650
BUILD_ARCH = os.environ.get("Z3_CROSS_COMPILING", platform.machine())
@@ -117,6 +121,7 @@ def _z3_version():
117121
return version + post
118122

119123
def _configure_z3():
124+
global IS_SINGLE_THREADED
120125
# bail out early if we don't need to do this - it forces a rebuild every time otherwise
121126
if os.path.exists(BUILD_DIR):
122127
return
@@ -125,7 +130,7 @@ def _configure_z3():
125130
# Config options
126131
cmake_options = {
127132
# Config Options
128-
'Z3_SINGLE_THREADED' : False,
133+
'Z3_SINGLE_THREADED' : IS_SINGLE_THREADED,
129134
'Z3_BUILD_PYTHON_BINDINGS' : True,
130135
# Build Options
131136
'CMAKE_BUILD_TYPE' : 'Release',

0 commit comments

Comments
 (0)