File tree 5 files changed +43
-1
lines changed
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() {
182
182
183
183
rm -rf " ${td} "
184
184
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
185
200
}
186
201
187
202
cross_run () {
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ main() {
49
49
fi
50
50
done
51
51
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
+
52
56
echo " ${sysroot} /lib" >> " /etc/ld-musl-${arch} .path"
53
57
54
58
rm -rf " ${0} "
Original file line number Diff line number Diff line change @@ -36,13 +36,20 @@ main() {
36
36
# Don't depend on the mirrors of sabotage linux that musl-cross-make uses.
37
37
local linux_headers_site=https://ci-mirrors.rust-lang.org/rustc/sabotage-linux-tarballs
38
38
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.
39
45
hide_output make install " -j$( nproc) " \
40
46
GCC_VER=9.2.0 \
41
47
MUSL_VER=1.1.24 \
42
48
BINUTILS_VER=2.33.1 \
43
49
DL_CMD=' curl --retry 3 -sSfL -C - -o' \
44
- LINUX_HEADERS_SITE=$ linux_headers_site \
50
+ LINUX_HEADERS_SITE=" ${ linux_headers_site} " \
45
51
OUTPUT=/usr/local/ \
52
+ " GCC_CONFIG += --enable-default-pie" \
46
53
" ${@ } "
47
54
48
55
purge_packages
Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ deploy = true
22
22
[[target ]]
23
23
target = " x86_64-unknown-linux-musl"
24
24
os = " ubuntu-latest"
25
+ cpp = true
26
+ dylib = true
25
27
std = true
26
28
run = true
29
+ runners = " native qemu-user"
27
30
deploy = true
28
31
29
32
[[target ]]
You can’t perform that action at this time.
0 commit comments