diff --git a/.changes/1495.json b/.changes/1495.json new file mode 100644 index 000000000..f5c10bb5c --- /dev/null +++ b/.changes/1495.json @@ -0,0 +1,6 @@ +{ + "description": "Fix `*-solaris` targets", + "issues": [1424], + "type": "fixed", + "breaking": true +} diff --git a/.github/ISSUE_TEMPLATE/b_issue_report.yml b/.github/ISSUE_TEMPLATE/b_issue_report.yml index 06801319c..c73e3ad60 100644 --- a/.github/ISSUE_TEMPLATE/b_issue_report.yml +++ b/.github/ISSUE_TEMPLATE/b_issue_report.yml @@ -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 diff --git a/README.md b/README.md index 5201aa9ac..f0992514e 100644 --- a/README.md +++ b/README.md @@ -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 | | diff --git a/docker/Dockerfile.sparcv9-sun-solaris b/docker/Dockerfile.sparcv9-sun-solaris index d5b717b4c..814444b8a 100644 --- a/docker/Dockerfile.sparcv9-sun-solaris +++ b/docker/Dockerfile.sparcv9-sun-solaris @@ -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 diff --git a/docker/Dockerfile.x86_64-pc-solaris b/docker/Dockerfile.x86_64-pc-solaris new file mode 100644 index 000000000..8103d62f8 --- /dev/null +++ b/docker/Dockerfile.x86_64-pc-solaris @@ -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" diff --git a/docker/Dockerfile.x86_64-sun-solaris b/docker/Dockerfile.x86_64-sun-solaris deleted file mode 100644 index e4af431f0..000000000 --- a/docker/Dockerfile.x86_64-sun-solaris +++ /dev/null @@ -1,31 +0,0 @@ -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 - -COPY toolchain.cmake /opt/toolchain.cmake - -ENV CROSS_TOOLCHAIN_PREFIX=x86_64-sun-solaris2.10- -ENV CROSS_SYSROOT=/usr/local/x86_64-sun-solaris2.10 -ENV CARGO_TARGET_X86_64_SUN_SOLARIS_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \ - AR_x86_64_sun_solaris="$CROSS_TOOLCHAIN_PREFIX"ar \ - CC_x86_64_sun_solaris="$CROSS_TOOLCHAIN_PREFIX"gcc \ - CXX_x86_64_sun_solaris="$CROSS_TOOLCHAIN_PREFIX"g++ \ - CMAKE_TOOLCHAIN_FILE_x86_64_sun_solaris=/opt/toolchain.cmake \ - BINDGEN_EXTRA_CLANG_ARGS_x86_64_sun_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" diff --git a/docker/solaris.sh b/docker/solaris.sh index ef1788bda..a7ba0da98 100755 --- a/docker/solaris.sh +++ b/docker/solaris.sh @@ -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 \ @@ -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.. + # 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 \ diff --git a/src/docker/provided_images.rs b/src/docker/provided_images.rs index 6d87ec791..be7f087e7 100644 --- a/src/docker/provided_images.rs +++ b/src/docker/provided_images.rs @@ -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], diff --git a/src/lib.rs b/src/lib.rs index 6624586f3..28d13c519 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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"), diff --git a/targets.toml b/targets.toml index 2ed7123b2..9d46f0a07 100644 --- a/targets.toml +++ b/targets.toml @@ -447,7 +447,6 @@ dylib = true std = true [[target]] -disabled = true # https://github.com/cross-rs/cross/issues/1424 target = "sparcv9-sun-solaris" os = "ubuntu-latest" cpp = true @@ -455,8 +454,7 @@ 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