FS#51335 - [rust] Improve build/packaging
Attached to Project:
Community Packages
Opened by userwithuid (userwithuid) - Wednesday, 12 October 2016, 06:28 GMT
Last edited by Alexander F. Rødseth (xyproto) - Friday, 02 December 2016, 10:20 GMT
Opened by userwithuid (userwithuid) - Wednesday, 12 October 2016, 06:28 GMT
Last edited by Alexander F. Rødseth (xyproto) - Friday, 02 December 2016, 10:20 GMT
|
Details
A couple of improvements for the current rust package:
1. Build against system llvm like most other distros do (fedora [1], gentoo [2], debian, etc.). Faster build, smaller binaries. rust-depends: add 'llvm-libs' makedepends: add 'llvm', remove 'libffi' 'perl' configure: add '--llvm-root=/usr --disable-codegen-tests' 2. Fix jemalloc usage Option A) --disable-jemalloc like fedora (seems to be not that important either way [3]) Option B) Use system jemalloc. It's already in makedepends, but I think it needs to be specified in configure. configure: add '--jemalloc-root=/usr/lib' 3. Fix bootstrapping. Currently, the PKGBUILD downloads a stage0 rustc during build(), which I think is suboptimal. Option A) At least do what gentoo currently does and download the stage0 bin via source. Option B) Preferably, I suggest we go the fedora way and bootstrap ourselves with the previous version. This is officially supported, rustc version X can be bootstrapped with either X or X-1 [4,5,6] makedepends: add 'rust' configure: add '--enable-local-rust --local-rust-root=/usr' 4. Remove accidentally duplicated docs. Currently, both 'rust' and 'rust-docs' contain all the docs in different folders. Remove them from 'rust'. A PKGBUILD with all those fixes and a few more is a attached for guidance. |
This task depends upon
Closed by Alexander F. Rødseth (xyproto)
Friday, 02 December 2016, 10:20 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented most of the suggestions.
Friday, 02 December 2016, 10:20 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented most of the suggestions.
[1] http://pkgs.fedoraproject.org/cgit/rpms/rust.git/tree/rust.spec?id=b7f305b4991a24ce95264c5de11f07b4c2b26612#n184
[2] https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/rust/rust-1.12.0.ebuild?id=4d6da89247bd2fc79fcc7e9f7218a45cc16a22b3#n95
[3] https://internals.rust-lang.org/t/disabling-jemalloc/3650
[4] https://github.com/rust-lang/rust/issues/29555
[5] https://github.com/rust-lang/rust/pull/32942
[6] https://github.com/rust-lang/rust/pull/34779
/bin/sh: /build/rust/src/rustc-1.12.1/src/libbacktrace/missing: No such file or directory
configure: WARNING: `missing' script is too old or missing
With regards to the libbacktrack error: Hmm, I don't know why you would get that error. Looks like a missing makedep, how are you building?
Anyway, attached is a revised PKGBUILD for 1.12.1.
The referenced patch is from upstream, see here: https://users.rust-lang.org/t/bootstrapping-1-12-1-from-1-12-0/7715
Fedora also uses it: http://pkgs.fedoraproject.org/cgit/rpms/rust.git/commit/rust.spec?id=6050c3a1b2df417ed4b51ec830477506078f4dee
For me, this builds successfully both for i686 and x86_64. I'm not a packager, so I don't know how you build, but I used the clean chroot approach as described in the developer wiki: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot
Please test the latest version from [community].
If that package looks okay, I'll move forward with implementing point 2 and 3 above now that the time pressure of releasing version 1.12.1 quickly is over.
Thanks for the insights and for collecting the best ideas for how to package rust.
Yeah, I'm mostly just trying to relay what upstream is dicussing with regards to distro-packaging (looks like they are still figuring things out themselves :-) ).
Looks like once we get llvm 3.9 in arch, llvm-config will allow dynamic linking even if static libs are present [1], so no ffi hack and way smaller pkg. We'll see.
[1] https://github.com/llvm-mirror/llvm/commit/93083d498658f4c6da98e8950bd9f58c76080299
I'm a bit concerned that bootstrapping rust with rust will have problems in the future (like the transition from 1.12.0 to 1.12.1). I suspect that packaging rust without depending on rust will have a higher likelihood of working effortlessly (without patches or sed replacements) for future updates. Thoughts?
@self-bootstrap approach: imho, having to download a vendored compiler binary during build is sooooo ugly that I felt the need to look for alternatives, and 'bootstrap from old version' seems to be the way to go.
1. It is actively discussed and used [3] upstream.
2. Since the fedora packager (cuviper) is involved, it should be pretty easy to use from here on out (also, easy to look at their fixes for potential future transition problems :-) ).
Then again, I totally understand that, from a maintainer's perspective, everything beyond configure && make is additional burden during every version upgrade; KISS and all. You could always delay the decision and see whether debian/gentoo/... follow fedora or stick to their current 'pre-download stage0'-approach. In the end, it's not exactly high priority, the final package should be the same either way.
[1] https://users.rust-lang.org/t/bootstrapping-1-12-1-from-1-12-0/7715
[2] https://github.com/rust-lang/rust/commit/81d97957a7807d3ac1a9defde037c6e504e3d797
[3] https://github.com/rust-lang/rust/pull/32942 ; I linked to this before. To be clear, the background-downloaded stage0 binary at build is just a previous major version rustc since this commit from 2016-04.