Skip to content

Commit

Permalink
Fix *-solaris targets (#1495)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Emilgardis committed May 17, 2024
2 parents 7d75864 c81946b commit 19be834
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .changes/1495.json
Original file line number Diff line number Diff line change
@@ -0,0 1,6 @@
{
"description": "Fix `*-solaris` targets",
"issues": [1424],
"type": "fixed",
"breaking": true
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/b_issue_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 75,7 @@ body:
- wasm32-unknown-emscripten
- x86_64-linux-android
- x86_64-pc-windows-gnu
- x86_64-sun-solaris
- x86_64-pc-solaris
- x86_64-unknown-freebsd
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 252,7 @@ terminate.
| `wasm32-unknown-emscripten` [6] | 3.1.14 | 15.0.0 || N/A ||
| `x86_64-linux-android` [1] | 9.0.8 | 9.0.8 || 6.1.0 ||
| `x86_64-pc-windows-gnu` | N/A | 9.3 || N/A ||
| `x86_64-sun-solaris` | 1.22.7 | 8.4.0 || N/A | |
| `x86_64-pc-solaris` | 1.22.7 | 8.4.0 || N/A | |
| `x86_64-unknown-freebsd` | 1.5 | 6.4.0 || N/A | |
| `x86_64-unknown-dragonfly` [2] [3] | 6.0.1 | 10.3.0 || N/A | |
| `x86_64-unknown-illumos` | 1.20.4 | 8.4.0 || N/A | |
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.sparcv9-sun-solaris
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,7 @@ RUN /xargo.sh
FROM cross-base as build

COPY solaris.sh /
RUN /solaris.sh sparcv9
RUN /solaris.sh sparcv9 sun

COPY toolchain.cmake /opt/toolchain.cmake

Expand Down
31 changes: 31 additions & 0 deletions docker/Dockerfile.x86_64-pc-solaris
Original file line number Diff line number Diff line change
@@ -0,0 1,31 @@
FROM ubuntu:20.04 as cross-base
ENV DEBIAN_FRONTEND=noninteractive

COPY common.sh lib.sh /
RUN /common.sh

COPY cmake.sh /
RUN /cmake.sh

COPY xargo.sh /
RUN /xargo.sh

FROM cross-base as build

COPY solaris.sh /
RUN /solaris.sh x86_64 pc

COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=x86_64-pc-solaris2.10-
ENV CROSS_SYSROOT=/usr/local/x86_64-pc-solaris2.10
ENV CARGO_TARGET_X86_64_PC_SOLARIS_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
AR_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_x86_64_pc_solaris="$CROSS_TOOLCHAIN_PREFIX"g \
CMAKE_TOOLCHAIN_FILE_x86_64_pc_solaris=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_solaris="--sysroot=$CROSS_SYSROOT" \
CROSS_CMAKE_SYSTEM_NAME=SunOS \
CROSS_CMAKE_SYSTEM_PROCESSOR=x86_64 \
CROSS_CMAKE_CRT=solaris \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64"
31 changes: 0 additions & 31 deletions docker/Dockerfile.x86_64-sun-solaris

This file was deleted.

24 changes: 15 additions & 9 deletions docker/solaris.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 8,11 @@ set -euo pipefail

main() {
local arch="${1}"
local manufacturer="${2}"

local binutils=2.28.1 \
gcc=8.4.0 \
target="${arch}-sun-solaris2.10"
target="${arch}-${manufacturer}-solaris2.10"

install_packages bzip2 \
ca-certificates \
Expand Down Expand Up @@ -56,28 57,33 @@ main() {
esac

apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2-testing main'
add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
dpkg --add-architecture "${apt_arch}"
apt-get update
# shellcheck disable=SC2046
apt-get download $(apt-cache depends --recurse --no-replaces \
apt-get install -y --download-only \
"libc:${apt_arch}" \
"liblgrp-dev:${apt_arch}" \
"liblgrp:${apt_arch}" \
"libm-dev:${apt_arch}" \
"libpthread:${apt_arch}" \
"libresolv:${apt_arch}" \
"librt:${apt_arch}" \
"libsendfile-dev:${apt_arch}" \
"libsendfile:${apt_arch}" \
"libsocket:${apt_arch}" \
"system-crt:${apt_arch}" \
"system-header:${apt_arch}" \
| grep "^\w")
"system-header:${apt_arch}"

for deb in *"${apt_arch}.deb"; do
for deb in /var/cache/apt/archives/*"${apt_arch}.deb"; do
dpkg -x "${deb}" "${td}/solaris"
done
apt-get clean

# The -dev packages are not available from the apt repository we're using.
# However, those packages are just symlinks from *.so to *.so.<version>.
# This makes all those symlinks.
while IFS= read -r -d '' lib; do
link_name=${lib%.so.*}.so
[ -e "$link_name" ] || ln -sf "${lib##*/}" "$link_name"
done < <(find . -name '*.so.*' -print0)

cd binutils-build
../binutils/configure \
Expand Down
10 changes: 10 additions & 0 deletions src/docker/provided_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 228,16 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
sub: None
},
ProvidedImage {
name: "sparcv9-sun-solaris",
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
sub: None
},
ProvidedImage {
name: "x86_64-pc-solaris",
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
sub: None
},
ProvidedImage {
name: "x86_64-unknown-illumos",
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 160,7 @@ impl TargetTriple {
"aarch64-unknown-freebsd" => Some("freebsd-arm64"),
"x86_64-unknown-netbsd" => Some("netbsd-amd64"),
"sparcv9-sun-solaris" => Some("solaris-sparc"),
"x86_64-sun-solaris" => Some("solaris-amd64"),
"x86_64-pc-solaris" => Some("solaris-amd64"),
"thumbv6m-none-eabi" => Some("arm"),
"thumbv7em-none-eabi" => Some("arm"),
"thumbv7em-none-eabihf" => Some("armhf"),
Expand Down
4 changes: 1 addition & 3 deletions targets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 447,14 @@ dylib = true
std = true

[[target]]
disabled = true # https://github.com/cross-rs/cross/issues/1424
target = "sparcv9-sun-solaris"
os = "ubuntu-latest"
cpp = true
dylib = true
std = true

[[target]]
disabled = true # https://github.com/cross-rs/cross/issues/1424
target = "x86_64-sun-solaris"
target = "x86_64-pc-solaris"
os = "ubuntu-latest"
cpp = true
dylib = true
Expand Down

0 comments on commit 19be834

Please sign in to comment.