Skip to content

Commit 6a548fb

Browse files
committed
entrypoint clang updated
1 parent a8debd5 commit 6a548fb

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

.github/actions/build-manylinux/entrypoint.sh

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,40 @@ rm -f "$LLVM_TAR"
2828
cd $HOME
2929
curl -L https://github.com/exaloop/seq/releases/download/v0.11.3/seq-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz | tar zxvf - -C .sequre/lib/codon/plugins
3030

31-
# Use LLVM-codon clang on Linux; system clang on macOS (darwin LLVM tarball has no clang)
31+
# Pick the C/C++ compiler:
32+
# - macOS: Apple's system clang. It knows the SDK sysroot for both the plugin
33+
# build and the standalone launcher. (The LLVM-codon darwin tarball now ships
34+
# a clang too, but it has no default sysroot, so system headers like glob.h
35+
# are not found when building the launcher directly.)
36+
# - Linux: the LLVM-codon clang, to match the bundled LLVM toolchain.
37+
case "$(uname -s)" in
38+
Darwin*)
39+
CC=$(command -v clang)
40+
CXX=$(command -v clang++)
41+
;;
42+
*)
43+
if [ -f "$OPT/llvm-codon/bin/clang" ]; then
44+
CC=$OPT/llvm-codon/bin/clang
45+
CXX=$OPT/llvm-codon/bin/clang++
46+
else
47+
CC=$(command -v clang)
48+
CXX=$(command -v clang++)
49+
fi
50+
;;
51+
esac
52+
53+
# On manylinux_2_28 the default toolchain is a gcc-toolset under /opt/rh, which
54+
# the LLVM-codon clang does not auto-detect, so it cannot find libstdc++ (or the
55+
# C++20 headers) when linking the plugin. Point clang at it via a config file,
56+
# matching how Codon builds its own plugins (see exaloop/codon
57+
# .github/build-linux/Dockerfile.linux-x86_64). No-op off manylinux: the glob is
58+
# empty (e.g. on macOS), so no config file is written.
3259
if [ -f "$OPT/llvm-codon/bin/clang" ]; then
33-
CC=$OPT/llvm-codon/bin/clang
34-
CXX=$OPT/llvm-codon/bin/clang++
35-
else
36-
CC=$(command -v clang)
37-
CXX=$(command -v clang++)
60+
GCC_INSTALL_DIR=$(ls -d /opt/rh/gcc-toolset-*/root/usr/lib/gcc/*/* 2>/dev/null | sort -V | tail -1)
61+
if [ -n "$GCC_INSTALL_DIR" ]; then
62+
echo "--gcc-install-dir=$GCC_INSTALL_DIR" > "$OPT/llvm-codon/bin/clang.cfg"
63+
echo "--gcc-install-dir=$GCC_INSTALL_DIR" > "$OPT/llvm-codon/bin/clang++.cfg"
64+
fi
3865
fi
3966

4067
cd $1

0 commit comments

Comments
 (0)