Skip to content

Installation is broken when custom relative libdir path starts with lib/ or when libdir is changed during installation #28627

Closed
@jauhien

Description

@jauhien

Gentoo uses installation of multiple rust versions side by side based on the possibility to install libraries to custom locations. At the moment because of this bug (its first part) we need to apply patch.

Steps to reproduce bug.

Case when custom libdir works

We are installing to /home/jauhien/w/image-working, libraries go to /home/jauhien/w/image-working/customrust.

  1. Configure rust

    ./configure --prefix=/home/jauhien/w/image-working --libdir=/home/jauhien/w/image-working/customrust --disable-debug --disable-valgrind --disable-helgrind --disable-valgrind-rpass --enable-debuginfo-tests --disable-llvm-assertions --disable-debug-assertions --disable-debug-jemalloc --disable-debuginfo
    
  2. Make rust

    make -j5
    

    Have some coffee or tea.

  3. Install rust

    make install
    

Rust is installed and works. Libraries go to /home/jauhien/w/image-working/customrust as expected.

Case when custom libdir leads to failure (bug)

We are going to install rust into /home/jauhien/w/image, libraries will go to /home/jauhien/w/image/lib/customrust.

  1. Configure rust
    ./configure --prefix=/home/jauhien/w/image --libdir=/home/jauhien/w/image/lib/customrust --disable-debug --disable-valgrind --disable-helgrind --disable-valgrind-rpass --enable-debuginfo-tests --disable-llvm-assertions --disable-debug-assertions --disable-debug-jemalloc --disable-debuginfo

Steps 2 and 3 as in the previous case.

Result: libraries are installed in /home/jauhien/w/image/lib/customrust/customrust. Note the customrust being repeated twice. Reason: lines in installer removed by mentioned patch.

Changing libdir during installation is broken

Libdir option for installer makes no sense as it is anyway broken.

Working installation using unchanged libdir

  1. Download rust binary tarball for your arch and unpack it.

  2. Install rust

    ./install.sh --prefix=/home/jauhien/w/image-bin-working
    
  3. Try if it works

    jauhien@jauhien-VirtualBox rust-tmp % LD_LIBRARY_PATH=/home/jauhien/w/image-bin-working/lib ../image-bin-working/bin/rustc -V             
    rustc 1.3.0 (9a92aaf19 2015-09-15)                                                                                         
    jauhien@jauhien-VirtualBox rust-tmp % cat test.rs
    fn main() {
       println!("It works!");
    }
    jauhien@jauhien-VirtualBox rust-tmp % LD_LIBRARY_PATH=/home/jauhien/w/image-bin-working/lib ../image-bin-working/bin/rustc -V
    rustc 1.3.0 (9a92aaf19 2015-09-15)                                                                                   
    jauhien@jauhien-VirtualBox rust-tmp % ./test
    It works!
    

Broken installation when libdir option is used

  1. As in previous case

  2. Install rust

    ./install.sh --prefix=/home/jauhien/w/image-bin --libdir=/home/jauhien/w/image-bin/customrust
    
  3. Try if it works

    jauhien@jauhien-VirtualBox rust-tmp % LD_LIBRARY_PATH=/home/jauhien/w/image-bin/customrust ../image-bin/bin/rustc -V        
    rustc 1.3.0 (9a92aaf19 2015-09-15)                                                                                
    jauhien@jauhien-VirtualBox rust-tmp % LD_LIBRARY_PATH=/home/jauhien/w/image-bin/customrust ../image-bin/bin/rustc test.rs -o test
    test.rs:1:1: 1:1 error: can't find crate for `std`                                                          
    test.rs:1 fn main() {
             ^
    error: aborting due to previous error
    
    

Reason: relative libdir path is captured by rust compiler during build and it is impossible to change it later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-linuxOperating system: Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions