Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Mar 2014 16:45:32 GMT
From:      Oleksii Tsai <oleksii.tsai@googlemail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/187962: [lang/rust] Fix the compilation on FreeBSD 10
Message-ID:  <201403261645.s2QGjW25024191@cgiserv.freebsd.org>
Resent-Message-ID: <201403261650.s2QGo1j5075564@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         187962
>Category:       ports
>Synopsis:       [lang/rust] Fix the compilation on FreeBSD 10
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 26 16:50:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Oleksii Tsai
>Release:        amd64/10
>Organization:
>Environment:
10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260975: Mon Jan 20 23:05:19 PST 2014 amd64
>Description:
With 0.9 release of rust the compilation on FreeBSD 10 was broken due to the dependency of rust's bootstrap compiler on libkvm.so.5 which was bumped to libkvm.so.6 in FreeBSD 10. Requested a change from rust's maintainers to update the bootstrap so it no longer depends on libkvm. This required a new release of bootstrap snapshot which was released on March 19th.

Since rust is still in development, by the time this new snapshot was released rust language has changed so that the latest bootstrap snapshot is no longer able to compiler rust 0.9 release. Therefore, decided to build stable snapshot from git repo.

Rust repo uses git submodules and because their source is not included in snapshots downloadable from github had to manually checkout 4 dependencies once source extract is complete.

Another reason to use git snapshot is that rust had a bug on FreeBSD when it was not linking against libm. Communicated with rust's developer to come up with a fix (git commit: d1f8fb2).
>How-To-Repeat:
# cd /usr/ports/lang/rust
# make
>Fix:
Attached a patch.

Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 349228)
+++ Makefile	(working copy)
@@ -4,15 +4,43 @@
 PORTNAME=	rust
 PORTVERSION=	0.9
 CATEGORIES=	lang
-MASTER_SITES=	http://static.rust-lang.org/dist/:src \
-		http://static.rust-lang.org/stage0-snapshots/:boot
-DISTFILES=	${RUST_SOURCE}:src \
-		${RUST_BOOT}:boot
+MASTER_SITES= 	http://static.rust-lang.org/stage0-snapshots/:boot \
+		GH
+
+DISTFILES=	${RUST_BOOT}:boot \
+		${RUST_SOURCE}
+
 EXTRACT_ONLY=	${RUST_SOURCE}
 
 MAINTAINER=	jyyou@cs.nctu.edu.tw
 COMMENT=	A language with a focus on memory safety and concurrency
 
+USE_GITHUB=	yes
+GH_ACCOUNT=	mozilla
+GH_PROJECT=	rust
+GH_COMMIT=	0908ffa
+GH_TAGNAME=	${GH_COMMIT}
+DISTVERSION=	2000
+
+DISTNAME=    	${GH_ACCOUNT}-${GH_PROJECT}-${PORTVERSION}-${DISTVERSION}-g${GH_COMMIT}
+
+RUST_SOURCE=		${DISTNAME}${EXTRACT_SUFX}
+
+
+GH_DEP_ACCOUNT=		rust-lang
+GH_DEP_REPO_BASE=	http://github.com/$GH_DEP_ACCOUNT
+
+
+LLVM_REPO=		${GH_DEP_REPO_BASE}/llvm.git
+LLVM_COMMIT=		263c617
+LIBUV_REPO=		${GH_DEP_REPO_BASE}/libuv.gi
+LIBUV_COMMIT=		800b56f
+GYP_REPO=		${GH_DEP_REPO_BASE}/gyp.git
+GYP_COMMIT=		1e46da1
+COMPILER_RT_REPO=	${GH_DEP_REPO_BASE}/compiler-rt.git
+COMPILER_RT_COMMIT=	f4b2215
+
+
 LICENSE=	APACHE20 \
 		MIT
 LICENSE_COMB=	dual
@@ -19,9 +47,8 @@
 LICENSE_FILE=	${WRKSRC}/LICENSE-APACHE \
 		${WRKSRC}/LICENSE-MIT
 
-RUST_SOURCE=	${DISTNAME}${EXTRACT_SUFX}
 RUST_BOOT=	rust-stage0-${RUST_BOOT_SIG}.tar.bz2
-RUST_BOOT_SIG=	2014-01-05-a6d3e57-freebsd-x86_64-ac21ea9537da2aaee35b7f3d2698b651dc3e8bd9
+RUST_BOOT_SIG=	2014-03-22-94e4e91-freebsd-x86_64-7793127e1b9ad22cb2e020f9bb01f34526cc4656
 RUST_TARGET=	x86_64-unknown-freebsd
 
 ONLY_FOR_ARCHS=	amd64
@@ -42,17 +69,15 @@
 LLNEXTGEN_DESC=		Build with grammar verification
 OPTIONS_DEFAULT=	RUSTPKG
 OPTIONS_SUB=		yes
+BUILD_DEPEDS+=		{LOCALBASE}/bin/git:${PORTSDIR}/devel/git
+MAKE_JOBS_UNSAFE=	yes
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} < 900044 || ${OSVERSION} >= 1000000
-BROKEN=		Only compiles on FreeBSD 9
-.endif
-
 CC=		clang
 CXX=		clang++
 CONFIGURE_ARGS+=	--disable-valgrind --disable-docs \
-			--enable-clang
+			--enable-clang --disable-manage-submodules
 MAKE_ARGS+=		CC=${CC} CXX=${CXX} ARCH=x86_64
 
 .if ${PORT_OPTIONS:MRUSTPKG}
@@ -69,7 +94,15 @@
 	${MKDIR} ${WRKSRC}/${RUST_TARGET} && \
 	cd ${WRKSRC}/${RUST_TARGET} && \
 	${TAR} -xf ${DISTDIR}/${RUST_BOOT} && \
-	${MV} rust-stage0 stage0
+	${MV} rust-stage0 stage0 && \
+	${LOCALBASE}/bin/git clone http://github.com/rust-lang/llvm.git ${WRKSRC}/src/llvm && \
+	cd ${WRKSRC}/src/llvm && ${LOCALBASE}/bin/git checkout -b build ${LLVM_COMMIT} && \
+	${LOCALBASE}/bin/git clone http://github.com/rust-lang/libuv.git ${WRKSRC}/src/libuv && \
+	cd ${WRKSRC}/src/libuv && ${LOCALBASE}/bin/git checkout -b build ${LIBUV_COMMIT} && \
+	${LOCALBASE}/bin/git clone http://github.com/rust-lang/gyp.git ${WRKSRC}/src/gyp && \
+	cd ${WRKSRC}/src/gyp && ${LOCALBASE}/bin/git checkout -b build ${GYP_COMMIT} && \
+	${LOCALBASE}/bin/git clone http://github.com/rust-lang/compiler-rt.git ${WRKSRC}/src/compiler-rt && \
+	cd ${WRKSRC}/src/compiler-rt && ${LOCALBASE}/bin/git checkout -b build ${COMPILER_RT_COMMIT}
 
 post-patch:
 	${REINPLACE_CMD} \
Index: distinfo
===================================================================
--- distinfo	(revision 349228)
+++ distinfo	(working copy)
@@ -1,4 +1,12 @@
-SHA256 (rust-0.9.tar.gz) = c0911c3545b797a1ca16f3d76bf5ed234754b828efd1e22c182c7300ac7dd5d1
-SIZE (rust-0.9.tar.gz) = 17152912
-SHA256 (rust-stage0-2014-01-05-a6d3e57-freebsd-x86_64-ac21ea9537da2aaee35b7f3d2698b651dc3e8bd9.tar.bz2) = 1caf47fddfef62d97d6d31970a4193d60ef24cc0e5b9f23067970a6b18eb79de
-SIZE (rust-stage0-2014-01-05-a6d3e57-freebsd-x86_64-ac21ea9537da2aaee35b7f3d2698b651dc3e8bd9.tar.bz2) = 12048052
+SHA256 (mozilla-rust-0.9-2000-g0908ffa.tar.gz) = 2e5af460ea32abd736c08abbd1b4b33906a21e82edfddd057a73ff3f2b296398
+SIZE (mozilla-rust-0.9-2000-g0908ffa.tar.gz) = 4763884
+SHA256 (rust-lang-llvm-2e9f0d2.tar.gz) = fc139f6a2d1bebbfb0a63a93073a2c216773c8410ff14c54c65e8abd7b729e0c
+SIZE (rust-lang-llvm-2e9f0d2.tar.gz) = 12971836
+SHA256 (rust-lang-libuv-v0.11.7-19-g389fc44.tar.gz) = 2b4626b979917cb375a6eb8eb9f0dd6fc117f86d5c043e6f0993f3682fef31cb
+SIZE (rust-lang-libuv-v0.11.7-19-g389fc44.tar.gz) = 331762
+SHA256 (rust-lang-gyp-1e46da1.tar.gz) = 05e990c9d2621458f069fbca80ea82db20cb965557e366dcf002ec314a5c876d
+SIZE (rust-lang-gyp-1e46da1.tar.gz) = 544343
+SHA256 (rust-lang-compiler-rt-46081ed.tar.gz) = 931236e205a079938cc3c47a4fa27c36081a77cfe1a860cb4abacb14eee4527d
+SIZE (rust-lang-compiler-rt-46081ed.tar.gz) = 1846093
+SHA256 (rust-stage0-2014-03-22-94e4e91-freebsd-x86_64-7793127e1b9ad22cb2e020f9bb01f34526cc4656.tar.bz2) = 3a191c1c3773d7650554cbf141ce36b66137280e084cb9870f734df6034edba2
+SIZE (rust-stage0-2014-03-22-94e4e91-freebsd-x86_64-7793127e1b9ad22cb2e020f9bb01f34526cc4656.tar.bz2) = 11743466
Index: files/patch-configure
===================================================================
--- files/patch-configure	(revision 349228)
+++ files/patch-configure	(working copy)
@@ -8,18 +8,3 @@
  probe_need CFG_PYTHON      python2.7 python2.6 python2 python
  
  python_version=$($CFG_PYTHON -V 2>&1)
-@@ -547,14 +546,6 @@
-     fi
- fi
- 
--# Force freebsd to build with clang; gcc doesn't like us there
--if [ $CFG_OSTYPE = unknown-freebsd ]
--then
--    step_msg "on FreeBSD, forcing use of clang"
--    CFG_ENABLE_CLANG=1
--    putvar CFG_ENABLE_CLANG
--fi
--
- if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
- then
-     err "either clang or gcc is required"
Index: pkg-plist
===================================================================
--- pkg-plist	(revision 349228)
+++ pkg-plist	(working copy)
@@ -1,29 +1,73 @@
 bin/rustc
 bin/rustdoc
 %%RUSTPKG%%bin/rustpkg
-lib/libextra-fd30a1b1-0.9.so
-lib/libgreen-83b1c0e5-0.9.so
-lib/librustc-8b28e8d8-0.9.so
-lib/librustdoc-f0f95988-0.9.so
-lib/librustpkg-7b329bae-0.9.so
-lib/librustuv-2ba3695a-0.9.so
-lib/libstd-3e5aeb83-0.9.so
-lib/libsyntax-9be99726-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/libextra-fd30a1b1-0.9.rlib
-lib/rustlib/x86_64-unknown-freebsd/lib/libextra-fd30a1b1-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/libgreen-83b1c0e5-0.9.rlib
-lib/rustlib/x86_64-unknown-freebsd/lib/libgreen-83b1c0e5-0.9.so
+lib/libstd-31b43f22-0.10-pre.so
+lib/librand-413a5926-0.10-pre.so
+lib/libcollections-c0316c39-0.10-pre.so
+lib/libterm-4fb63b95-0.10-pre.so
+lib/libsync-192b1459-0.10-pre.so
+lib/liblog-fbd5e9b3-0.10-pre.so
+lib/libserialize-d024e1f3-0.10-pre.so
+lib/libsyntax-d4b01541-0.10-pre.so
+lib/libflate-dae8ef21-0.10-pre.so
+lib/libarena-07510a78-0.10-pre.so
+lib/libgetopts-302f586c-0.10-pre.so
+lib/libtime-1998f6fa-0.10-pre.so
+lib/librustc-6ccece0c-0.10-pre.so
+lib/libtest-c7a393b8-0.10-pre.so
+lib/librustdoc-4d54da8d-0.10-pre.so
+lib/libnative-0915f5d5-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libstd-31b43f22-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libstd-31b43f22-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libgreen-2892ff35-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libgreen-2892ff35-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/librustuv-0d450bab-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/librustuv-0d450bab-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libnative-0915f5d5-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libnative-0915f5d5-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libflate-dae8ef21-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libflate-dae8ef21-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libarena-07510a78-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libarena-07510a78-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libglob-91b25e1f-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libglob-91b25e1f-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libterm-4fb63b95-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libterm-4fb63b95-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libsemver-a75b5f9b-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libsemver-a75b5f9b-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libuuid-2ebb16f9-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libuuid-2ebb16f9-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libserialize-d024e1f3-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libserialize-d024e1f3-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libsync-192b1459-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libsync-192b1459-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libgetopts-302f586c-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libgetopts-302f586c-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libcollections-c0316c39-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libcollections-c0316c39-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libnum-118823d0-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libnum-118823d0-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libtest-c7a393b8-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libtest-c7a393b8-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libtime-1998f6fa-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libtime-1998f6fa-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/librand-413a5926-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/librand-413a5926-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libworkcache-dfc76720-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libworkcache-dfc76720-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/liburl-91e29dd6-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/liburl-91e29dd6-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/liblog-fbd5e9b3-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/liblog-fbd5e9b3-0.10-pre.rlib
+lib/rustlib/x86_64-unknown-freebsd/lib/libsyntax-d4b01541-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/librustc-6ccece0c-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/librustdoc-4d54da8d-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libfourcc-90db3ea1-0.10-pre.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libhexfloat-188570f7-0.10-pre.so
 lib/rustlib/x86_64-unknown-freebsd/lib/libmorestack.a
-lib/rustlib/x86_64-unknown-freebsd/lib/libnative-cf55a53a-0.9.rlib
-lib/rustlib/x86_64-unknown-freebsd/lib/libnative-cf55a53a-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/librustc-8b28e8d8-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/librustdoc-f0f95988-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/librustpkg-7b329bae-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/librustuv-2ba3695a-0.9.rlib
-lib/rustlib/x86_64-unknown-freebsd/lib/librustuv-2ba3695a-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/libstd-3e5aeb83-0.9.rlib
-lib/rustlib/x86_64-unknown-freebsd/lib/libstd-3e5aeb83-0.9.so
-lib/rustlib/x86_64-unknown-freebsd/lib/libsyntax-9be99726-0.9.so
+lib/rustlib/x86_64-unknown-freebsd/lib/libcompiler-rt.a
+share/man/man1/rustdoc.1
+share/man/man1/rustc.1
 @dirrm lib/rustlib/x86_64-unknown-freebsd/lib
 @dirrm lib/rustlib/x86_64-unknown-freebsd
 @dirrm lib/rustlib


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403261645.s2QGjW25024191>