File tree Expand file tree Collapse file tree 5 files changed +43
-1
lines changed
Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "type" : " changed" ,
4+ "description" : " changed musl targets to use static-pie linkage by default, consistent with Alpine." ,
5+ "breaking" : true
6+ },
7+ {
8+ "type" : " fixed" ,
9+ "description" : " fixed C++ support for musl targets." ,
10+ "issues" : [902 ],
11+ "breaking" : true
12+ }
13+ ]
Original file line number Diff line number Diff line change @@ -182,6 +182,21 @@ main() {
182182
183183 rm -rf " ${td} "
184184 fi
185+
186+ # special tests for a shared C runtime, since we disable the shared c++ runtime
187+ # https://github.com/cross-rs/cross/issues/902
188+ if [[ " ${TARGET} " == * -linux-musl* ]]; then
189+ td=$( mkcargotemp -d)
190+
191+ pushd " ${td} "
192+ cargo init --bin --name hello .
193+ retry cargo fetch
194+ RUSTFLAGS=" -C target-feature=-crt-static" \
195+ " ${CROSS[@]} " build --target " ${TARGET} " ${CROSS_FLAGS}
196+ popd
197+
198+ rm -rf " ${td} "
199+ fi
185200}
186201
187202cross_run () {
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ main() {
4949 fi
5050 done
5151
52+ # ensure we statically link libstdc++, so avoid segfaults with c++
53+ # https://github.com/cross-rs/cross/issues/902
54+ rm " ${sysroot} " /lib/libstdc++.so* || true
55+
5256 echo " ${sysroot} /lib" >> " /etc/ld-musl-${arch} .path"
5357
5458 rm -rf " ${0} "
Original file line number Diff line number Diff line change @@ -36,13 +36,20 @@ main() {
3636 # Don't depend on the mirrors of sabotage linux that musl-cross-make uses.
3737 local linux_headers_site=https://ci-mirrors.rust-lang.org/rustc/sabotage-linux-tarballs
3838
39+ # alpine GCC is built with `--enable-default-pie`, so we want to
40+ # ensure we use that. we want support for shared runtimes except for
41+ # libstdc++, however, the only way to do that is to simply remove
42+ # the shared libraries later. on alpine, binaries use static-pie
43+ # linked, so our behavior has maximum portability, and is consistent
44+ # with popular musl distros.
3945 hide_output make install " -j$( nproc) " \
4046 GCC_VER=9.2.0 \
4147 MUSL_VER=1.1.24 \
4248 BINUTILS_VER=2.33.1 \
4349 DL_CMD=' curl --retry 3 -sSfL -C - -o' \
44- LINUX_HEADERS_SITE=$ linux_headers_site \
50+ LINUX_HEADERS_SITE=" ${ linux_headers_site} " \
4551 OUTPUT=/usr/local/ \
52+ " GCC_CONFIG += --enable-default-pie" \
4653 " ${@ } "
4754
4855 purge_packages
Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ deploy = true
2222[[target ]]
2323target = " x86_64-unknown-linux-musl"
2424os = " ubuntu-latest"
25+ cpp = true
26+ dylib = true
2527std = true
2628run = true
29+ runners = " native qemu-user"
2730deploy = true
2831
2932[[target ]]
You can’t perform that action at this time.
0 commit comments