Skip to content

Commit 19be834

Browse files
authored
Fix *-solaris targets (#1495)
Fixes #1424. Adapted from rust-lang/rust#108951 and rust-lang/rust#81229 (with some minor changes to satisfy ShellCheck and account for broken symlinks). This PR also renames `x86_64-sun-solaris` to `x86_64-pc-solaris`, as the former was [deprecated](rust-lang/rust#82216) in Rust 1.52.0 and [removed](rust-lang/rust#118091) in Rust 1.76.0, making this a breaking change.
2 parents 7d75864 + c81946b commit 19be834

10 files changed

+67
-47
lines changed

Diff for: .changes/1495.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"description": "Fix `*-solaris` targets",
3+
"issues": [1424],
4+
"type": "fixed",
5+
"breaking": true
6+
}

Diff for: .github/ISSUE_TEMPLATE/b_issue_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ body:
7575
- wasm32-unknown-emscripten
7676
- x86_64-linux-android
7777
- x86_64-pc-windows-gnu
78-
- x86_64-sun-solaris
78+
- x86_64-pc-solaris
7979
- x86_64-unknown-freebsd
8080
- x86_64-unknown-linux-gnu
8181
- x86_64-unknown-linux-musl

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ terminate.
252252
| `wasm32-unknown-emscripten` [6] | 3.1.14 | 15.0.0 || N/A ||
253253
| `x86_64-linux-android` [1] | 9.0.8 | 9.0.8 || 6.1.0 ||
254254
| `x86_64-pc-windows-gnu` | N/A | 9.3 || N/A ||
255-
| `x86_64-sun-solaris` | 1.22.7 | 8.4.0 || N/A | |
255+
| `x86_64-pc-solaris` | 1.22.7 | 8.4.0 || N/A | |
256256
| `x86_64-unknown-freebsd` | 1.5 | 6.4.0 || N/A | |
257257
| `x86_64-unknown-dragonfly` [2] [3] | 6.0.1 | 10.3.0 || N/A | |
258258
| `x86_64-unknown-illumos` | 1.20.4 | 8.4.0 || N/A | |

Diff for: docker/Dockerfile.sparcv9-sun-solaris

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN /xargo.sh
1313
FROM cross-base as build
1414

1515
COPY solaris.sh /
16-
RUN /solaris.sh sparcv9
16+
RUN /solaris.sh sparcv9 sun
1717

1818
COPY toolchain.cmake /opt/toolchain.cmake
1919

Diff for: docker/Dockerfile.x86_64-pc-solaris

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ubuntu:20.04 as cross-base
2+
ENV DEBIAN_FRONTEND=noninteractive
3+
4+
COPY common.sh lib.sh /
5+
RUN /common.sh
6+
7+
COPY cmake.sh /
8+
RUN /cmake.sh
9+
10+
COPY xargo.sh /
11+
RUN /xargo.sh
12+
13+
FROM cross-base as build
14+
15+
COPY solaris.sh /
16+
RUN /solaris.sh x86_64 pc
17+
18+
COPY toolchain.cmake /opt/toolchain.cmake
19+
20+
ENV CROSS_TOOLCHAIN_PREFIX=x86_64-pc-solaris2.10-
21+
ENV CROSS_SYSROOT=/usr/local/x86_64-pc-solaris2.10
22+
ENV CARGO_TARGET_X86_64_PC_SOLARIS_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
23+
AR_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"ar \
24+
CC_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"gcc \
25+
CXX_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"g++ \
26+
CMAKE_TOOLCHAIN_FILE_x86_64_pc_solaris=/opt/toolchain.cmake \
27+
BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_solaris="--sysroot=$CROSS_SYSROOT" \
28+
CROSS_CMAKE_SYSTEM_NAME=SunOS \
29+
CROSS_CMAKE_SYSTEM_PROCESSOR=x86_64 \
30+
CROSS_CMAKE_CRT=solaris \
31+
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64"

Diff for: docker/Dockerfile.x86_64-sun-solaris

-31
This file was deleted.

Diff for: docker/solaris.sh

+15-9
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ set -euo pipefail
88

99
main() {
1010
local arch="${1}"
11+
local manufacturer="${2}"
1112

1213
local binutils=2.28.1 \
1314
gcc=8.4.0 \
14-
target="${arch}-sun-solaris2.10"
15+
target="${arch}-${manufacturer}-solaris2.10"
1516

1617
install_packages bzip2 \
1718
ca-certificates \
@@ -56,28 +57,33 @@ main() {
5657
esac
5758

5859
apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
59-
add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2-testing main'
60+
add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
6061
dpkg --add-architecture "${apt_arch}"
6162
apt-get update
62-
# shellcheck disable=SC2046
63-
apt-get download $(apt-cache depends --recurse --no-replaces \
63+
apt-get install -y --download-only \
6464
"libc:${apt_arch}" \
65-
"liblgrp-dev:${apt_arch}" \
6665
"liblgrp:${apt_arch}" \
6766
"libm-dev:${apt_arch}" \
6867
"libpthread:${apt_arch}" \
6968
"libresolv:${apt_arch}" \
7069
"librt:${apt_arch}" \
71-
"libsendfile-dev:${apt_arch}" \
7270
"libsendfile:${apt_arch}" \
7371
"libsocket:${apt_arch}" \
7472
"system-crt:${apt_arch}" \
75-
"system-header:${apt_arch}" \
76-
| grep "^\w")
73+
"system-header:${apt_arch}"
7774

78-
for deb in *"${apt_arch}.deb"; do
75+
for deb in /var/cache/apt/archives/*"${apt_arch}.deb"; do
7976
dpkg -x "${deb}" "${td}/solaris"
8077
done
78+
apt-get clean
79+
80+
# The -dev packages are not available from the apt repository we're using.
81+
# However, those packages are just symlinks from *.so to *.so.<version>.
82+
# This makes all those symlinks.
83+
while IFS= read -r -d '' lib; do
84+
link_name=${lib%.so.*}.so
85+
[ -e "$link_name" ] || ln -sf "${lib##*/}" "$link_name"
86+
done < <(find . -name '*.so.*' -print0)
8187

8288
cd binutils-build
8389
../binutils/configure \

Diff for: src/docker/provided_images.rs

+10
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
228228
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
229229
sub: None
230230
},
231+
ProvidedImage {
232+
name: "sparcv9-sun-solaris",
233+
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
234+
sub: None
235+
},
236+
ProvidedImage {
237+
name: "x86_64-pc-solaris",
238+
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
239+
sub: None
240+
},
231241
ProvidedImage {
232242
name: "x86_64-unknown-illumos",
233243
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],

Diff for: src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl TargetTriple {
160160
"aarch64-unknown-freebsd" => Some("freebsd-arm64"),
161161
"x86_64-unknown-netbsd" => Some("netbsd-amd64"),
162162
"sparcv9-sun-solaris" => Some("solaris-sparc"),
163-
"x86_64-sun-solaris" => Some("solaris-amd64"),
163+
"x86_64-pc-solaris" => Some("solaris-amd64"),
164164
"thumbv6m-none-eabi" => Some("arm"),
165165
"thumbv7em-none-eabi" => Some("arm"),
166166
"thumbv7em-none-eabihf" => Some("armhf"),

Diff for: targets.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,14 @@ dylib = true
447447
std = true
448448

449449
[[target]]
450-
disabled = true # https://github.com/cross-rs/cross/issues/1424
451450
target = "sparcv9-sun-solaris"
452451
os = "ubuntu-latest"
453452
cpp = true
454453
dylib = true
455454
std = true
456455

457456
[[target]]
458-
disabled = true # https://github.com/cross-rs/cross/issues/1424
459-
target = "x86_64-sun-solaris"
457+
target = "x86_64-pc-solaris"
460458
os = "ubuntu-latest"
461459
cpp = true
462460
dylib = true

0 commit comments

Comments
 (0)