Skip to content

Commit b58f034

Browse files
committed
workaround for bee
1 parent 418c696 commit b58f034

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
run:
4444
sudo snap install zig --classic --beta
4545

46+
- name: Prepare zig wrapper
47+
if: matrix.target == 'linux'
48+
run: chmod +x zig-cc-wrapper.sh
49+
4650
- name: Build
4751
env:
4852
USE_ZIG: ${{ matrix.target == 'linux' && '1' || '0' }}

make/detect_platform.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ elseif platform.os == 'linux' then
2424
-- Use Zig for Linux builds to ensure glibc 2.17 compatibility
2525
local use_zig = os.getenv("USE_ZIG")
2626
if use_zig and use_zig ~= "0" and use_zig ~= "false" then
27-
-- Set compiler to zig (handles both C and C++)
28-
-- Use a wrapper script to filter out -lstdc++fs which doesn't work with Zig
29-
lm.cc = 'bash -c \'exec zig c++ "${@/#-lstdc++fs/}"\' --'
27+
-- Set compiler to zig wrapper script that filters out -lstdc++fs
28+
-- The wrapper is needed because bee.lua requires stdc++fs but Zig's libc++ already includes it
29+
local wrapper = lm.workdir .. '/zig-cc-wrapper.sh'
30+
lm.cc = wrapper
3031
lm.ar = 'zig ar'
3132

3233
if lm.platform == nil then

zig-cc-wrapper.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Wrapper script for Zig compiler to filter out -lstdc++fs
3+
# Zig's libc++ already includes filesystem support
4+
5+
# Filter out -lstdc++fs from arguments
6+
args=()
7+
for arg in "$@"; do
8+
if [ "$arg" != "-lstdc++fs" ]; then
9+
args+=("$arg")
10+
fi
11+
done
12+
13+
# Call zig c++ with filtered arguments
14+
exec zig c++ "${args[@]}"

0 commit comments

Comments
 (0)