Skip to content

Commit 1e292ef

Browse files
authored
fix(ci): force clang for Linux x86_64 native builds (#1059)
Verified locally: gcc 14.2.0 (Debian Trixie) builds a binary whose tree-sitter-hcl extractor silently drops the 4 HCL fixture files in tests/benchmarks/resolution/fixtures/hcl/. Clang 14 (Debian Bookworm) builds a binary that parses them correctly. Same Rust source, same Cargo.lock — only the C compiler differs (cc-rs uses CC for the bundled parser.c). The drop triggers an engine-parity WASM backfill on every full-build call (#1054), and the v3.10.0 pre-publish gate flagged the resulting ~1.7s overhead per call as a regression vs the v3.9.6 published binary (which evidently was built before this gcc/parser-c interaction manifested). Forces `CC=clang`/`CXX=clang++` in three places that build the host x86_64-unknown-linux-gnu artifact: - publish.yml `build-native` matrix entry for the gate's binary - publish.yml `preflight` job (so npm test parity matches published) - build-native.yml's matching matrix entry (host build for PR checks) - ci.yml `native-host-build` ubuntu-latest leg (so PR test runs match) Cross-compile targets (aarch64-gnu, x86_64-musl) are unaffected — they already pin their own toolchains. macOS and Windows are unaffected. Refs #1054
1 parent bbed2c1 commit 1e292ef

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/build-native.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ jobs:
7272
with:
7373
workspaces: crates/codegraph-core
7474

75+
# Force clang for the host x86_64-linux-gnu build. With gcc (the runner's
76+
# default `cc`) the bundled C parsers in tree-sitter-hcl produce a binary
77+
# whose HCL extractor silently drops files (#1054). Clang produces a
78+
# working binary.
79+
- name: Use clang for x86_64-linux-gnu
80+
if: matrix.target == 'x86_64-unknown-linux-gnu'
81+
run: |
82+
clang --version
83+
echo "CC=clang" >> "$GITHUB_ENV"
84+
echo "CXX=clang++" >> "$GITHUB_ENV"
85+
7586
- name: Install cross-compilation tools (aarch64-gnu)
7687
if: matrix.target == 'aarch64-unknown-linux-gnu'
7788
run: |

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ jobs:
6161
with:
6262
workspaces: crates/codegraph-core
6363

64+
# Force clang on Linux runners. With gcc (the default cc) the bundled
65+
# C parsers in tree-sitter-hcl produce a binary whose HCL extractor
66+
# silently drops files (#1054). Clang produces a working binary.
67+
- name: Use clang on Linux
68+
if: matrix.os == 'ubuntu-latest'
69+
run: |
70+
clang --version
71+
echo "CC=clang" >> "$GITHUB_ENV"
72+
echo "CXX=clang++" >> "$GITHUB_ENV"
73+
6474
- name: Install napi-rs CLI
6575
run: npm install -g @napi-rs/cli@3
6676

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ jobs:
4444
with:
4545
workspaces: crates/codegraph-core
4646

47+
# Match the build-native job: gcc-built tree-sitter parsers drop files
48+
# on Linux x86_64 (#1054). Use clang here too so preflight parity tests
49+
# exercise the same binary characteristics as the published artifact.
50+
- name: Use clang for native build
51+
run: |
52+
clang --version
53+
echo "CC=clang" >> "$GITHUB_ENV"
54+
echo "CXX=clang++" >> "$GITHUB_ENV"
55+
4756
- name: Install napi-rs CLI
4857
run: npm install -g @napi-rs/cli@3
4958

@@ -178,6 +187,18 @@ jobs:
178187
with:
179188
workspaces: crates/codegraph-core
180189

190+
# Force clang for the host x86_64-linux-gnu build. With gcc (the runner's
191+
# default `cc`) the bundled C parsers in tree-sitter-hcl produce a binary
192+
# whose HCL extractor silently drops files (#1054), triggering an
193+
# expensive WASM backfill on every build call. Clang produces a working
194+
# binary. Verified locally: gcc 14.2.0 drops .tf files, clang does not.
195+
- name: Use clang for x86_64-linux-gnu
196+
if: matrix.target == 'x86_64-unknown-linux-gnu'
197+
run: |
198+
clang --version
199+
echo "CC=clang" >> "$GITHUB_ENV"
200+
echo "CXX=clang++" >> "$GITHUB_ENV"
201+
181202
- name: Install cross-compilation tools (aarch64-gnu)
182203
if: matrix.target == 'aarch64-unknown-linux-gnu'
183204
run: |

0 commit comments

Comments
 (0)