diff --git a/site_scons/buildutils.py b/site_scons/buildutils.py index 82c7ee24b5..c1b2a1748e 100644 --- a/site_scons/buildutils.py +++ b/site_scons/buildutils.py @@ -1260,11 +1260,13 @@ def setup_python_env(env): import numpy import json import site + import sys vars = get_config_vars() vars["plat"] = get_platform() vars["numpy_include"] = numpy.get_include() vars["site_packages"] = [d for d in site.getsitepackages() if d.endswith("-packages")] vars["user_site_packages"] = site.getusersitepackages() + vars["abiflags"] = getattr(sys, "abiflags", "") print(json.dumps(vars)) """) _python_info = json.loads(get_command_output(env["python_cmd"], "-c", script)) @@ -1298,10 +1300,13 @@ def setup_python_env(env): env["site_packages"] = info["site_packages"] env["user_site_packages"] = info["user_site_packages"] if env["OS"] != "Windows": - env["py_libpl"] = info["LIBPL"] + env["py_libpath"] = info["LIBPL"] + py_lib = "python" + info["py_version_short"] + info["abiflags"] else: - env["py_libpl"] = info["installed_base"] + "\\libs" - env["py_libs"] = info.get("LIBS", "") + env["py_libpath"] = info["installed_base"] + "\\libs" + py_lib = "python" + py_version_nodot + env["py_libs"] = [py_lib] + [lib[2:] for lib in info.get("LIBS", "").split() + if lib.startswith("-l")] # Don't print deprecation warnings for internal Python changes. # Only applies to Python 3.8. The field that is deprecated in Python 3.8 diff --git a/src/SConscript b/src/SConscript index 0d0e9165a7..f43f4722ad 100644 --- a/src/SConscript +++ b/src/SConscript @@ -75,6 +75,7 @@ for subdir, extensions, setup in libs: if env["python_package"] == "full": pyenv = setup_python_env(localenv.Clone()) pyenv.PrependENVPath('PYTHONPATH', Dir('#interfaces/cython').abspath) + pyenv['PCH'] = '' # ignore precompiled header here build_dir = Path(Dir('#build').abspath).as_posix() cythonized = pyenv.Command( ["extensions/pythonExtensions.cpp", "extensions/pythonExtensions.h"], @@ -90,10 +91,10 @@ if env["python_package"] == "full": Copy('$TARGET', '$SOURCE')) libraryTargets.append(obj) libraryTargets.append(pyenv.SharedObject("extensions/PythonExtensionManager.cpp")) - libpython = pyenv.subst("python${py_version_short}") - localenv.Append(LIBS=libpython, LIBPATH=pyenv["py_libpl"], LDFLAGS=pyenv["py_libs"]) - env["cantera_libs"].append(libpython) - + localenv.Append(LIBS=pyenv["py_libs"], LIBPATH=pyenv["py_libpath"]) + env["cantera_libs"].extend(pyenv["py_libs"]) + env.Append(LIBPATH=pyenv["py_libpath"]) + env["extra_lib_dirs"].append(pyenv["py_libpath"]) # build the Cantera static library lib = build(localenv.StaticLibrary('../lib/cantera', libraryTargets,