Skip to content

Commit 14e2f76

Browse files
committed
testing: export CC based on .cargo/config contents
We already need to test cargo about gcc locations so it can perfom linking -- we just parse this information out to tell rust where gcc is for complation (nix-test compiles some C code for testing). Signed-off-by: Paul Osborne <[email protected]>
1 parent 5ddd8b2 commit 14e2f76

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

ci/cargo-config

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
# Configuration of which linkers to call on Travis for various architectures
22

3+
[target.x86_64-unknown-linux-gnu]
4+
linker = "gcc"
5+
6+
[target.x86_64-unknown-linux-musl]
7+
linker = "gcc"
8+
9+
[target.i686-unknown-linux-gnu]
10+
linker = "gcc"
11+
12+
[target.i686-unknown-linux-musl]
13+
linker = "gcc"
14+
315
[target.arm-linux-androideabi]
416
linker = "arm-linux-androideabi-gcc"
517

618
[target.arm-unknown-linux-gnueabihf]
7-
linker = "arm-linux-gnueabihf-gcc-4.7"
19+
linker = "arm-linux-gnueabihf-gcc"
820

921
[target.mips-unknown-linux-gnu]
10-
linker = "mips-linux-gnu-gcc-5"
22+
linker = "mips-linux-gnu-gcc"
1123

1224
[target.aarch64-unknown-linux-gnu]
1325
linker = "aarch64-linux-gnu-gcc"

ci/run.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ configure_cargo() {
2727
cp "${BASE_DIR}/ci/cargo-config" .cargo/config
2828
}
2929

30+
#
31+
# We need to export CC for the tests to build properly (some C code is
32+
# compiled) to work. We already tell Cargo about the compiler in the
33+
# cargo config, so we just parse that info out of the cargo config
34+
#
35+
cc_for_target() {
36+
awk "/\[target\.${TARGET}\]/{getline; print}" .cargo/config |
37+
cut -d '=' -f2 | \
38+
tr -d '"' | tr -d ' '
39+
}
40+
3041
cross_compile_tests() {
3142
case "$TARGET" in
3243
*-apple-ios)
@@ -99,6 +110,8 @@ test_binary() {
99110

100111
configure_cargo
101112

113+
export CC="$(cc_for_target)"
114+
102115
# select the proper version
103116
multirust override ${VERSION}
104117

0 commit comments

Comments
 (0)