From: whitequark Date: Thu, 27 Aug 2020 06:53:14 +0000 (+0000) Subject: _toolchain.cxx: work around PyPy missing LDCXXSHARED sysconfig variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=88c00a04855bd5a38883b6d3571d99bceac1f026;p=nmigen.git _toolchain.cxx: work around PyPy missing LDCXXSHARED sysconfig variable. --- diff --git a/nmigen/_toolchain/cxx.py b/nmigen/_toolchain/cxx.py index 32f1256..107cdab 100644 --- a/nmigen/_toolchain/cxx.py +++ b/nmigen/_toolchain/cxx.py @@ -23,12 +23,17 @@ def build_cxx(*, cxx_sources, output_name, include_dirs, macros): cc = sysconfig.get_config_var("CC") cxx = sysconfig.get_config_var("CXX") cflags = sysconfig.get_config_var("CCSHARED") - ld_ldflags = sysconfig.get_config_var("LDCXXSHARED") + ld_flags = sysconfig.get_config_var("LDSHARED") + ld_cxxflags = sysconfig.get_config_var("LDCXXSHARED") + if ld_cxxflags is None: + # PyPy doesn't have LDCXXSHARED. Glue it together from CXX and LDSHARED and hope that + # the result actually works; not many good options here. + ld_cxxflags = " ".join([cxx.split()[0], *ld_flags.split()[1:]]) cc_driver.set_executables( compiler=f"{cc} {cflags}", compiler_so=f"{cc} {cflags}", compiler_cxx=f"{cxx} {cflags}", - linker_so=ld_ldflags, + linker_so=ld_cxxflags, ) for include_dir in include_dirs: