From 141eaf0e405ad009e276d5c3d22edde6f8ac8e22 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 27 Aug 2020 06:53:14 +0000 Subject: [PATCH] _toolchain.cxx: work around PyPy missing LDCXXSHARED sysconfig variable. --- nmigen/_toolchain/cxx.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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: -- 2.30.2