@@ -17,18 +17,54 @@ jobs:
1717 edriver :
1818 name : " Build and test edriver / ${{ matrix.arch }}"
1919 runs-on : ${{ matrix.runner }}
20+ container :
21+ image : ${{ matrix.container }}
2022 strategy :
2123 fail-fast : false
2224 matrix :
2325 include :
2426 - arch : x86_64
2527 runner : ubuntu-latest
2628 target : x86_64-unknown-linux-musl
29+ # Ubuntu + musl-gcc + vendored-libelf (--without-zstd).
30+ # elfutils ./configure needs argp/fts/obstack, which are absent from
31+ # musl libc. We pre-build them (argp-standalone, musl-fts,
32+ # musl-obstack) using musl-gcc and install to /usr/lib/x86_64-linux-musl
33+ # before running `cargo build`, so configure finds them.
34+ container : ubuntu:24.04
35+ cc : musl-gcc
36+ lib_path : " "
37+ extra_cflags : " -idirafter /usr/include -idirafter /usr/include/x86_64-linux-gnu"
38+ cargo_extra_features : " ,vendored-libelf"
39+ rustflags : " -C target-feature=+crt-static"
2740 - arch : aarch64
2841 runner : ubuntu-24.04-arm
2942 target : aarch64-unknown-linux-musl
43+ # Same approach as x86_64. ubuntu:24.04 on arm64 supports JS
44+ # actions; Alpine ARM64 does not (no Node.js ARM64 in Alpine).
45+ container : ubuntu:24.04
46+ cc : musl-gcc
47+ lib_path : " "
48+ extra_cflags : " -idirafter /usr/include -idirafter /usr/include/aarch64-linux-gnu"
49+ cargo_extra_features : " ,vendored-libelf"
50+ rustflags : " -C target-feature=+crt-static"
3051 steps :
31- - name : " Git checkout"
52+ - name : Install build dependencies
53+ env :
54+ DEBIAN_FRONTEND : noninteractive
55+ run : |
56+ apt-get update -qq
57+ apt-get install -y --no-install-recommends \
58+ bash curl git ca-certificates \
59+ build-essential linux-headers-generic \
60+ clang llvm \
61+ libelf-dev zlib1g-dev \
62+ musl-tools musl-dev \
63+ protobuf-compiler \
64+ pkg-config \
65+ autoconf automake libtool autopoint gettext flex bison gawk
66+
67+ - name : Git checkout
3268 uses : actions/checkout@v4
3369 with :
3470 submodules : true
@@ -37,33 +73,104 @@ jobs:
3773 uses : dtolnay/rust-toolchain@stable
3874 with :
3975 targets : ${{ matrix.target }}
76+ components : rustfmt
4077
41- - name : Cache cargo registry & build
78+ - name : Cache cargo registry
4279 uses : actions/cache@v4
4380 with :
4481 path : |
4582 ~/.cargo/registry
4683 ~/.cargo/git
47- plugins/edriver/target
48- key : ${{ runner.os }}-${{ matrix.arch }}-cargo-edriver-${{ hashFiles('plugins/edriver/Cargo.lock') }}
49- restore-keys : ${{ runner.os }}-${{ matrix.arch }}-cargo-edriver-
84+ key : ${{ matrix.arch }}-cargo-edriver-v10-${{ hashFiles('plugins/edriver/Cargo.lock') }}
85+ restore-keys : ${{ matrix.arch }}-cargo-edriver-v10-
5086
51- - name : Install build dependencies
87+ # elfutils ./configure (invoked by libbpf-sys vendored-libelf build.rs)
88+ # runs with CC=musl-gcc. musl libc lacks argp_parse, fts_close, and
89+ # _obstack_free, causing configure to abort. We pre-build the three
90+ # void-linux musl-compat shims (identical to Alpine's argp-standalone,
91+ # musl-fts-dev, musl-obstack-dev packages) and install the .a + headers
92+ # into musl-gcc's default sysroot search path so configure finds them.
93+ - name : Build musl compat libs (argp / fts / obstack)
5294 run : |
53- sudo apt-get update -qq
54- sudo apt-get install -y --no-install-recommends build-essential pkgconf libelf-dev libzstd-dev musl-tools llvm-14 clang-14 protobuf-compiler
55- for tool in clang llc llvm-strip
56- do
57- sudo rm -f /usr/bin/$tool
58- sudo ln -s /usr/bin/${tool}-14 /usr/bin/$tool
59- done
95+ set -eux
96+ ARCH=$(uname -m) # x86_64 or aarch64
97+ MUSL_LIB=/usr/lib/${ARCH}-linux-musl
98+ MUSL_INC=/usr/include/${ARCH}-linux-musl
99+
100+ # 1. argp-standalone – provides argp_parse
101+ # NOTE: Makefile.am uses noinst_LIBRARIES so `make install` does NOT
102+ # install libargp.a. We build and copy manually.
103+ git clone --depth=1 https://github.com/ericonr/argp-standalone /tmp/argp-standalone
104+ cd /tmp/argp-standalone
105+ autoreconf -fiv
106+ CC=musl-gcc ./configure --prefix=/usr
107+ make -j$(nproc)
108+ cp libargp.a ${MUSL_LIB}/
109+ cp argp.h ${MUSL_INC}/
110+
111+ # 2. musl-fts – provides fts_close (NetBSD implementation)
112+ git clone --depth=1 https://github.com/void-linux/musl-fts /tmp/musl-fts
113+ cd /tmp/musl-fts
114+ ./bootstrap.sh
115+ CC=musl-gcc ./configure --enable-static --disable-shared \
116+ --prefix=/usr --libdir=${MUSL_LIB} --includedir=${MUSL_INC}
117+ make -j$(nproc) && make install
118+
119+ # 3. musl-obstack – provides _obstack_free (from gcc libiberty)
120+ git clone --depth=1 https://github.com/void-linux/musl-obstack /tmp/musl-obstack
121+ cd /tmp/musl-obstack
122+ ./bootstrap.sh
123+ CC=musl-gcc ./configure --enable-static --disable-shared \
124+ --prefix=/usr --libdir=${MUSL_LIB} --includedir=${MUSL_INC}
125+ make -j$(nproc) && make install
126+
127+ # Verify all three libs landed in the musl sysroot
128+ ls -la ${MUSL_LIB}/libargp.a ${MUSL_LIB}/libfts.a ${MUSL_LIB}/libobstack.a
129+
130+ - name : Verify toolchain
131+ run : |
132+ which protoc && protoc --version
133+ which clang && clang --version | head -1
60134
61135 - name : Build
62- run : cd plugins/edriver && make build
136+ run : |
137+ export PROTOC=$(which protoc)
138+ # Capture full output; write to job summary on failure for debugging.
139+ BUILD_LOG=/tmp/edriver-build.log
140+ set +e
141+ cd plugins/edriver && make build 2>&1 | tee "$BUILD_LOG"
142+ RC=${PIPESTATUS[0]}
143+ if [ $RC -ne 0 ]; then
144+ echo "## Build failure (exit $RC)" >> "$GITHUB_STEP_SUMMARY"
145+ echo '```' >> "$GITHUB_STEP_SUMMARY"
146+ tail -150 "$BUILD_LOG" >> "$GITHUB_STEP_SUMMARY"
147+ echo '```' >> "$GITHUB_STEP_SUMMARY"
148+ exit $RC
149+ fi
63150 env :
64151 PLATFORM : ${{ matrix.arch }}
152+ LIBBPF_SYS_LIBRARY_PATH : ${{ matrix.lib_path }}
153+ # Use -idirafter (not -I) so musl sysroot headers keep priority;
154+ # linux/bpf.h etc. are still found via /usr/include as last resort.
155+ LIBBPF_SYS_EXTRA_CFLAGS : ${{ matrix.extra_cflags }}
156+ CC_x86_64_unknown_linux_musl : ${{ matrix.cc }}
157+ CC_aarch64_unknown_linux_musl : ${{ matrix.cc }}
158+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER : ${{ matrix.cc }}
159+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER : ${{ matrix.cc }}
160+ RUSTFLAGS : ${{ matrix.rustflags }}
161+ CARGO_EXTRA_FEATURES : ${{ matrix.cargo_extra_features }}
65162
66163 - name : Test
67- run : cd plugins/edriver && make test
164+ run : |
165+ export PROTOC=$(which protoc)
166+ cd plugins/edriver && make test
68167 env :
69168 PLATFORM : ${{ matrix.arch }}
169+ LIBBPF_SYS_LIBRARY_PATH : ${{ matrix.lib_path }}
170+ LIBBPF_SYS_EXTRA_CFLAGS : ${{ matrix.extra_cflags }}
171+ CC_x86_64_unknown_linux_musl : ${{ matrix.cc }}
172+ CC_aarch64_unknown_linux_musl : ${{ matrix.cc }}
173+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER : ${{ matrix.cc }}
174+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER : ${{ matrix.cc }}
175+ RUSTFLAGS : ${{ matrix.rustflags }}
176+ CARGO_EXTRA_FEATURES : ${{ matrix.cargo_extra_features }}
0 commit comments