about summary refs log tree commit diff
path: root/src/ci
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-01 14:34:19 +0000
committerbors <bors@rust-lang.org>2021-03-01 14:34:19 +0000
commit5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d (patch)
treeb7e0a8ab549acd56fe34cd90eac7c289b59b8bc8 /src/ci
parent09db05762b283bed62d4f92729cfee4646519833 (diff)
parent47f291ec2d9d6e4820cca517e69b3efddec40c20 (diff)
downloadrust-5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d.tar.gz
rust-5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d.zip
Auto merge of #82216 - kulikjak:fix-solaris-target, r=nagisa,Mark-Simulacrum
make x86_64-pc-solaris the default target for x86-64 Solaris

This change makes `x86_64-pc-solaris` the default compilation target for x86-64 Solaris/Illumos (based on [this exchange](https://github.com/rust-lang/rust/issues/68214#issuecomment-748042054) with `@varkor).`

I tried several ways of doing this (leveraging the alias support added with #61761 and improved/fixed with #80073) and found out that cross-compilation to the new one is by far the simplest way of doing this. It can be achieved by adding the following arguments: `--build x86_64-sun-solaris --host x86_64-pc-solaris --target x86_64-pc-solaris` and enabling the cross compilation with `PKG_CONFIG_ALLOW_CROSS=1` environment variable.

I also removed alias support altogether - `x86_64-pc-solaris` and `x86_64-sun-solaris` are now two separate targets. The problem with aliases is that even if rust internally knows that two are the same, other tools building with rust don't know that, resulting in build issues like the one with firefox mentioned [here](https://github.com/rust-lang/rust/issues/68214#issuecomment-746144229). I think that once the dust settles and `x86_64-pc-solaris` becomes the default, `x86_64-sun-solaris` can be removed.

If you agree with the above, I have two subsequent questions:
1. Is there a preferred way to display deprecation warnings when `x86_64-sun-solaris` is passed into the compiler as an argument? I am not sure whether target deprecation was done before.
2. Where would be the best way to document this change for those using rust on Solaris? Without the cross-compilation arguments (used once to build a new version), the build won't work. Should I add it into [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md)?

Thanks!
Diffstat (limited to 'src/ci')
-rw-r--r--src/ci/docker/host-x86_64/dist-various-2/Dockerfile8
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh29
-rw-r--r--src/ci/docker/scripts/illumos-toolchain.sh2
3 files changed, 26 insertions, 13 deletions
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
index 6cfacc3b8ce..7bb3cb14516 100644
--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
@@ -39,9 +39,9 @@ ENV \
     AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
     CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
     CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
-    AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
-    CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
-    CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
+    AR_x86_64_pc_solaris=x86_64-pc-solaris2.10-ar \
+    CC_x86_64_pc_solaris=x86_64-pc-solaris2.10-gcc \
+    CXX_x86_64_pc_solaris=x86_64-pc-solaris2.10-g++ \
     CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-8 \
     CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-8 \
     AR_x86_64_fortanix_unknown_sgx=ar \
@@ -100,7 +100,7 @@ ENV TARGETS=$TARGETS,aarch64-fuchsia
 ENV TARGETS=$TARGETS,wasm32-unknown-unknown
 ENV TARGETS=$TARGETS,wasm32-wasi
 ENV TARGETS=$TARGETS,sparcv9-sun-solaris
-ENV TARGETS=$TARGETS,x86_64-sun-solaris
+ENV TARGETS=$TARGETS,x86_64-pc-solaris
 ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
 ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
 ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
index 14fb399aff5..ee76fafb1f9 100755
--- a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
+++ b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
@@ -9,6 +9,19 @@ APT_ARCH=$3
 BINUTILS=2.28.1
 GCC=6.5.0
 
+# Choose correct target based on the $ARCH
+case "$ARCH" in
+x86_64)
+  TARGET=x86_64-pc-solaris2.10
+  ;;
+sparcv9)
+  TARGET=sparcv9-sun-solaris2.10
+  ;;
+*)
+  printf 'ERROR: unknown architecture: %s\n' "$ARCH"
+  exit 1
+esac
+
 # First up, build binutils
 mkdir binutils
 cd binutils
@@ -16,7 +29,7 @@ cd binutils
 curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
 mkdir binutils-build
 cd binutils-build
-hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10
+hide_output ../binutils-$BINUTILS/configure --target=$TARGET
 hide_output make -j10
 hide_output make install
 
@@ -62,13 +75,13 @@ patch -p0  << 'EOF'
 -extern size_t strnlen(const char *, size_t);
 EOF
 
-mkdir                  /usr/local/$ARCH-sun-solaris2.10/usr
-mv usr/include         /usr/local/$ARCH-sun-solaris2.10/usr/include
-mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
-mv     lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
+mkdir                  /usr/local/$TARGET/usr
+mv usr/include         /usr/local/$TARGET/usr/include
+mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
+mv     lib/$LIB_ARCH/* /usr/local/$TARGET/lib
 
-ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/sys-include
-ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/include
+ln -s usr/include /usr/local/$TARGET/sys-include
+ln -s usr/include /usr/local/$TARGET/include
 
 cd ..
 rm -rf solaris
@@ -84,7 +97,7 @@ mkdir ../gcc-build
 cd ../gcc-build
 hide_output ../gcc-$GCC/configure \
   --enable-languages=c,c++        \
-  --target=$ARCH-sun-solaris2.10  \
+  --target=$TARGET                \
   --with-gnu-as                   \
   --with-gnu-ld                   \
   --disable-multilib              \
diff --git a/src/ci/docker/scripts/illumos-toolchain.sh b/src/ci/docker/scripts/illumos-toolchain.sh
index 8cb57126579..3f1d5f3426a 100644
--- a/src/ci/docker/scripts/illumos-toolchain.sh
+++ b/src/ci/docker/scripts/illumos-toolchain.sh
@@ -18,7 +18,7 @@ x86_64)
         exit 1
 esac
 
-BUILD_TARGET="$ARCH-sun-solaris2.10"
+BUILD_TARGET="$ARCH-pc-solaris2.10"
 
 #
 # The illumos and the Solaris build both use the same GCC-level host triple,