lang/rust-bootstrap: Add option that doesn't depend on freebsd-sysroot
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 28 Aug 2024 05:16:11 UTC
Hello. rust-1.79.0 is the last version we can build with 12.4-STABLE (and also 13.2?). Because the bootstrap compiler cannot be used due to the following output. ===> Building for rust-1.80.1 Building bootstrap running: /wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/cargo build --manifest-path /wrkdirs/usr/ports/lang/rust/work/rustc-1.80.1-src/src/bootstrap/Cargo.toml --verbose --verbose --frozen error: process didn't exit successfully: `/wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/rustc -vV` (exit status: 1) --- stderr ld-elf.so.1: /wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/../lib/librustc_driver-46295f53743f17e0.so: Undefined symbol "_ZNSt3__122__libcpp_verbose_abortEPKcz" However, I succeeded in building rust-1.80.1 on 12.4-STABLE in roughly the following way. mkdir -p -- /usr/local/freebsd-sysroot/amd64/bin ln -s /usr/bin/cc /usr/local/freebsd-sysroot/amd64/bin/cc ln -s /usr/bin/c++ /usr/local/freebsd-sysroot/amd64/bin/c++ Edit lang/rust-bootstrap/Makefile so that it does not depend on devel/freebsd-sysroot. make -C /usr/ports/lang/rust-bootstrap/ install FLAVOR=amd64 cp -f /usr/local/rust-bootstrap/amd64/* ${DISTDIR}/rust/2024-06-13/ Edit sha256 and size of lang/rust/distinfo to regenerated ones. Start building rust-1.80.1. This is not a request for continued support for versions that are no longer supported. This means that I need a way to get a bootstrap compiler that is made in the same environment as the one we are currently using. It may make it easier to find a solution to a problem that is rare these days, where rust doesn't work depending on the architecture. So, I'm going to paste the patch I made below :) I also feel like I'm doing something wrong about it, so please make it without using it directly. Regards. Here's the patch: diff --git a/lang/rust-bootstrap/Makefile b/lang/rust-bootstrap/Makefile index 3846aa32ffe..88c1c5028e3 100644 --- a/lang/rust-bootstrap/Makefile +++ b/lang/rust-bootstrap/Makefile @@ -22,8 +22,7 @@ LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT ONLY_FOR_ARCHS= amd64 powerpc64 powerpc64le ONLY_FOR_ARCHS_REASON= untested on other architectures -BUILD_DEPENDS= ${FLAVOR:S/_/-/g}-freebsd-sysroot>=a2021.09.14:devel/freebsd-sysroot@${FLAVOR} \ - cmake:devel/cmake-core \ +BUILD_DEPENDS= cmake:devel/cmake-core \ gmake:devel/gmake \ rust>=${PORTVERSION}:lang/rust @@ -43,6 +42,12 @@ TMPDIR?= ${WRKDIR} # Resulting packages are not specific to amd64 NO_ARCH= yes +OPTIONS_DEFINE= SYSROOT +OPTIONS_DEFAULT= SYSROOT +SYSROOT_DESC= Depend on freebsd-sysroot +SYSROOT_BUILD_DEPENDS= ${FLAVOR:S/_/-/g}-freebsd-sysroot>=a2021.09.14:devel/freebsd-sysroot@${FLAVOR} +SYSROOT_VARS_OFF= ONLY_FOR_ARCHS+="aarch64" + _CARGO_VENDOR_DIR= ${WRKSRC}/vendor _RUST_ARCH_amd64= x86_64 _RUST_ARCH_i386= i686 @@ -70,6 +75,10 @@ IGNORE= is only for FreeBSD EXTRA_PATCHES+= ${PATCHDIR}/${FLAVOR:S/_/-/} .endif +.if ! ${PORT_OPTIONS:MSYSROOT} && ${_RUST_HOST} != ${_RUST_TARGET} +BROKEN= The behavior of this condition is not implemented. +.endif + post-patch: # Disable vendor checksums @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \ @@ -110,9 +119,15 @@ do-configure: # host compiler that can build the host->target compiler @${ECHO_CMD} 'targets="${_RUST_LLVM_TARGET};${_RUST_LLVM_TARGET_${ARCH}}"' >> ${WRKSRC}/config.toml @${ECHO_CMD} '[target.${_RUST_TARGET}]' >> ${WRKSRC}/config.toml +.if ${PORT_OPTIONS:MSYSROOT} @${ECHO_CMD} 'cc="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/cc"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'cxx="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/c++"' >> ${WRKSRC}/config.toml @${ECHO_CMD} 'linker="${LOCALBASE}/freebsd-sysroot/${FLAVOR:S/_/-/g}/bin/cc"' >> ${WRKSRC}/config.toml +.else + @${ECHO_CMD} 'cc="${CC}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'cxx="${CXX}"' >> ${WRKSRC}/config.toml + @${ECHO_CMD} 'linker="${CC}"' >> ${WRKSRC}/config.toml +.endif .for _key _util in ar ${AR} ranlib ${RANLIB} @bin="$$(which ${_util})"; \ ${ECHO_CMD} "${_key}=\"$$bin\"" >> ${WRKSRC}/config.toml