Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 626136 - dev-lang/rust-1.19.0 with <dev-lang/rust-1.19.0 - file collisions in /usr/bin/rust-gdb /bin/rustc /bin/rustdoc
Summary: dev-lang/rust-1.19.0 with <dev-lang/rust-1.19.0 - file collisions in /usr/bin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-25 11:47 UTC by Marien Zwart
Modified: 2018-01-27 13:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,439.69 KB, text/plain)
2017-07-25 11:47 UTC, Marien Zwart
Details
Fix separate libdir issue (rust-1.23.0-fix-libdir.patch,7.10 KB, patch)
2018-01-25 18:05 UTC, Oleg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marien Zwart 2017-07-25 11:47:24 UTC
Created attachment 486798 [details]
build.log

The new dev-lang/rust-1.19.0 ebuild installs unslotted binaries into /usr/bin:

$ ls /var/tmp/portage/dev-lang/rust-1.19.0/image/usr/bin
rustc  rustdoc  rust-gdb  rust-lldb

While rust-1.16.0 installs versioned binaries...

$ qlist dev-lang/rust|grep usr/bin
/usr/bin/rust-gdb-1.16.0                                                                                               
/usr/bin/rustc-1.16.0                                                                                                  
/usr/bin/rustdoc-1.16.0                                                                                                

...and symlinks maintained by eselect:

$ ls -l /usr/bin/{rust-gdb,rustc,rustdoc}
lrwxrwxrwx 1 root root 22 19 mrt 20:48 /usr/bin/rustc -> //usr/bin/rustc-1.16.0                                        
lrwxrwxrwx 1 root root 24 19 mrt 20:48 /usr/bin/rustdoc -> //usr/bin/rustdoc-1.16.0
lrwxrwxrwx 1 root root 25 19 mrt 20:48 /usr/bin/rust-gdb -> //usr/bin/rust-gdb-1.16.0

Installing rust-1.19.0 fails if those symlinks are present:

>>> Installing (1 of 2) dev-lang/rust-1.19.0::gentoo        
 * checking 187 files for package collisions
...
 * package dev-lang/rust-1.19.0 NOT merged
 * 
 * Detected file collision(s):
 * 
 *      /usr/bin/rust-gdb
 *      /usr/bin/rustc
 *      /usr/bin/rustdoc
 * 
 * Searching all installed packages for file collisions...
 * 
 * Press Ctrl-C to Stop
 * 
 * None of the installed packages claim the file(s).

The ebuild still installs /etc/env.d/rust/provider-rust-1.19.0 and calls eselect, but while the previous ebuild did "mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}"" the new one does "dobin "${obj}/bin/rustc" "${obj}/bin/rustdoc"". I'm guessing src_install was changed to keep the originals around, and this accidentally broke slotting?

(Also, maybe rust-lldb should be added to that env file?)
Comment 1 tka 2017-10-05 17:04:18 UTC
I tried to get the 1.19.0 ebuild to install the files into locations equivalent to the 1.16.0 ebuild. The following diff is what was needed.

Unfortunately, the rust compiler built this way does not find the rustlib directory /usr/lib64/rust-1.19.0/rustlib/ but looks for /usr/lib64/rustlib/ instead. Adding a symlink /usr/lib64/rustlib -> rust-1.19.0/rustlib let me build cargo and firefox successfully. Maybe someone with an understanding of rust's build system can have a look into this.

--- a/rust-1.19.0.ebuild
+++ b/rust-1.19.0.ebuild
@@ -72,11 +72,6 @@ src_unpack() {
 }
 
 src_configure() {
-       echo "No configure step for rust"
-}
-
-src_compile() {
-       local stage0="rust-${STAGE0_VERSION}-${TRIPLE}"
        if use debug ; then
                local optimized="false";
                local debug="true";
@@ -94,6 +89,7 @@ src_compile() {
        submodules = false
        python = "${EPYTHON}"
        vendor = true
+       verbose = 1
        [install]
        prefix = "${EPREFIX}/usr"
        libdir = "$(get_libdir)/${P}"
@@ -107,7 +103,9 @@ src_compile() {
        rpath = false
        optimize-tests = ${optimized}
        EOF
+}
 
+src_compile() {
        local cache_dir="build/cache/${BOOTSTRAP_DATE}"
        mkdir -p ${cache_dir}
        for i in ${A}; do
@@ -117,15 +115,12 @@ src_compile() {
 }
 
 src_install() {
-       default
+       DESTDIR="${D}" ${EPYTHON} x.py install || die
+       docompress "${EPREFIX}/usr/share/${P}/doc"
 
-       local obj="build/${TRIPLE}/stage2"
-       dobin "${obj}/bin/rustc" "${obj}/bin/rustdoc"
-       dobin src/etc/rust-gdb src/etc/rust-lldb
-       insinto "/usr/$(get_libdir)"
-       doins -r "${obj}/lib/"*
-       dodoc COPYRIGHT
-       doman man/*
+       for f in rustc rustdoc rust-gdb rust-lldb; do
+               mv "${ED}/usr/bin/${f}" "${ED}/usr/bin/${f}-${PV}" || die
+       done
 
        cat <<-EOF > "${T}"/50${P}
        LDPATH="/usr/$(get_libdir)/${P}"
@@ -136,6 +131,7 @@ src_install() {
        cat <<-EOF > "${T}/provider-${P}"
        /usr/bin/rustdoc
        /usr/bin/rust-gdb
+       /usr/bin/rust-lldb
        EOF
        dodir /etc/env.d/rust
        insinto /etc/env.d/rust
Comment 2 Marien Zwart 2018-01-25 12:26:03 UTC
dev-lang/rust-1.23.0 fixed this for the /usr/bin stuff.

It still installs into /usr/lib64/rustlib, and installs files like /usr/lib64/librustc-482d6ef79768f8f7.so. This is currently fine, as all currently available dev-lang/rust versions use the "stable" slot and rust-bin installs into /opt. There's still support in the ebuild for a "beta" slot: I'm not so sure that one will work without further changes.
Comment 3 Oleg 2018-01-25 18:04:42 UTC
> It still installs into /usr/lib64/rustlib, and installs files like /usr/lib64/librustc-482d6ef79768f8f7.so. This is currently fine, as all currently available dev-lang/rust versions use the "stable" slot and rust-bin installs into /opt. There's still support in the ebuild for a "beta" slot: I'm not so sure that one will work without further changes.

I've fixed it in https://github.com/rust-lang/rust/pull/46592 and separate libdir will be available in 1.25

There also a patch for 1.23 version:
Comment 4 Oleg 2018-01-25 18:05:39 UTC
Created attachment 516704 [details, diff]
Fix separate libdir issue
Comment 5 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-01-27 13:31:11 UTC
Should be fixed in 1.23.0-r1 thanks to Oleg's patch.