Skip to content

Commit 28230e8

Browse files
committed
fix(ci): remove --sdk, add system sysroot paths for xlings gcc
The xlings gcc is built without system headers/CRT (like musl-gcc). Unlike the xlings project which uses musl-gcc (self-contained libc), mcpplibs-index needs system glibc. Fix by: - Remove --sdk/--cc/--cxx flags (--sdk overrides sysroot) - Put gcc/llvm bin dir on PATH for auto-detection - Set LIBRARY_PATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH to system paths so xlings gcc can find crt1.o, stdio.h, etc.
1 parent 0f6a9e1 commit 28230e8

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,29 @@ jobs:
9191
working-directory: tests
9292
run: |
9393
GCC_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['gcc']['linux'])")
94-
GCC_SDK="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}"
95-
echo "Using gcc ${GCC_VERSION} from ${GCC_SDK}"
96-
"${GCC_SDK}/bin/gcc" --version | head -1
97-
xmake f -P . -y -vv \
98-
--sdk="${GCC_SDK}" \
99-
--cc="${GCC_SDK}/bin/gcc" \
100-
--cxx="${GCC_SDK}/bin/g++"
94+
GCC_BIN="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}/bin"
95+
echo "Using gcc ${GCC_VERSION} from ${GCC_BIN}"
96+
"${GCC_BIN}/gcc" --version | head -1
97+
98+
# xlings gcc needs system sysroot for headers and CRT files
99+
export LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib:/lib/x86_64-linux-gnu"
100+
export C_INCLUDE_PATH="/usr/include:/usr/include/x86_64-linux-gnu"
101+
export CPLUS_INCLUDE_PATH="/usr/include:/usr/include/x86_64-linux-gnu"
102+
export PATH="${GCC_BIN}:$PATH"
103+
104+
xmake f -P . -y -vv
101105
102106
- name: Configure (macos)
103107
if: runner.os == 'macOS'
104108
working-directory: tests
105109
run: |
106110
LLVM_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['llvm']['macosx'])")
107-
LLVM_SDK="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}"
108-
echo "Using llvm ${LLVM_VERSION} from ${LLVM_SDK}"
109-
"${LLVM_SDK}/bin/clang" --version | head -1
110-
xmake f -P . -y -vv \
111-
--toolchain=llvm \
112-
--sdk="${LLVM_SDK}" \
113-
--cc="${LLVM_SDK}/bin/clang" \
114-
--cxx="${LLVM_SDK}/bin/clang++"
111+
LLVM_BIN="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}/bin"
112+
echo "Using llvm ${LLVM_VERSION} from ${LLVM_BIN}"
113+
"${LLVM_BIN}/clang" --version | head -1
114+
115+
export PATH="${LLVM_BIN}:$PATH"
116+
xmake f -P . -y -vv --toolchain=llvm
115117
116118
- name: Configure (windows)
117119
if: runner.os == 'Windows'
@@ -125,10 +127,13 @@ jobs:
125127
BUILD_ALL: ${{ needs.detect-changes.outputs.build_all }}
126128
CHANGED_PACKAGES: ${{ needs.detect-changes.outputs.packages }}
127129
run: |
128-
# Put correct compiler on PATH for xmake build subprocesses
130+
# Put correct compiler on PATH and set system paths for xmake subprocesses
129131
if [ "$(uname)" = "Linux" ]; then
130132
GCC_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['gcc']['linux'])")
131133
export PATH="$HOME/.xlings/data/xpkgs/xim-x-gcc/${GCC_VERSION}/bin:$PATH"
134+
export LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib:/lib/x86_64-linux-gnu"
135+
export C_INCLUDE_PATH="/usr/include:/usr/include/x86_64-linux-gnu"
136+
export CPLUS_INCLUDE_PATH="/usr/include:/usr/include/x86_64-linux-gnu"
132137
else
133138
LLVM_VERSION=$(python3 -c "import json; d=json.load(open('../.xlings.json')); print(d['workspace']['llvm']['macosx'])")
134139
export PATH="$HOME/.xlings/data/xpkgs/xim-x-llvm/${LLVM_VERSION}/bin:$PATH"

0 commit comments

Comments
 (0)