Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 703744 - dev-lang/rust: rustlib should be in /usr/${LIBDIR}/rustlib
Summary: dev-lang/rust: rustlib should be in /usr/${LIBDIR}/rustlib
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 689336
  Show dependency tree
 
Reported: 2019-12-25 09:47 UTC by tt_1
Modified: 2024-02-11 06:00 UTC (History)
4 users (show)

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


Attachments
output from emerge --info (emerge--info,8.08 KB, text/plain)
2019-12-25 09:50 UTC, tt_1
Details
files list from rust-1.40.0-r1 (rust-1.40.-r1-files.txt,5.54 KB, text/plain)
2019-12-30 19:36 UTC, tt_1
Details
GZipped logs from building without boostrap with alternative libdir (build-no-bootstrap2.log.gz,123.70 KB, application/octet-stream)
2020-03-30 20:56 UTC, Oleg
Details
GZipped logs from building with boostrap with alternative libdir (build-bootstrap.log.gz,123.97 KB, application/gzip)
2020-03-30 20:56 UTC, Oleg
Details
Patch for 1.43.1 to be bootstrapped with custom libdir (1.43.1-fix-libdir.patch,2.70 KB, patch)
2020-05-28 16:42 UTC, Oleg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2019-12-25 09:47:37 UTC
currently, dev-lang/rust-1.39.0 ebuild does install it's rustlib into an own subfolder called ${P}, this confuses some binaries when trying to find the rust std libs: 

cargo bloat 
Error: failed to find a dir with std libraries. Expected location: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib.

looking at the ebuild, this seems intentional: 

[install]
prefix = "${EPREFIX}/usr"
libdir = "$(get_libdir)/${P}"
docdir = "share/doc/${P}"
mandir = "share/${P}/man"

why is there an additional path added to the config? 
can all these ${P} variables be dropped?
Comment 1 tt_1 2019-12-25 09:50:27 UTC
Created attachment 600586 [details]
output from emerge --info
Comment 2 Jonas Stein gentoo-dev 2019-12-25 18:49:29 UTC
elevating to 'major', because several packages could suffer.
Comment 3 Georgy Yakovlev archtester gentoo-dev 2019-12-26 08:07:33 UTC
it's not major, we've been doing it for a long time.

for reference: discussion with cargo-bloat author

https://github.com/RazrFalcon/cargo-bloat/issues/51

original bug why it was moved:
https://bugs.gentoo.org/667966

another reason is ability to co-install with rust from overlay, we had clashing files before.

dumping them straight to /usr/<libdir> is not correct either, thou we could use debian's patch https://sources.debian.org/patches/rustc/1.39.0+dfsg1-4/d-add-soname.patch/ that adds soname that will shut up QA check.

also there's portage bug involved https://bugs.gentoo.org/show_bug.cgi?id=694248

I'll investigate a bit, but I think the easier way will be patching bloat for now.
Comment 4 Georgy Yakovlev archtester gentoo-dev 2019-12-30 00:36:27 UTC
ok after digging it a bit I agree we should adjust paths

to be clear public libs should go to /usr/$(get_libdir)
and private and target libs should go to
/usr/lib/rustlib/${rust_target_triple}/lib
Comment 5 Georgy Yakovlev archtester gentoo-dev 2019-12-30 01:16:09 UTC
best part is that it opens up system-bootstrap for rust.
previously my attempts to bootstrap using system-installed rust were failing due to bootstrap unable to find std libs, now I know why lol.
Comment 6 tt_1 2019-12-30 09:25:45 UTC
I'm lacking the deeper understanding of the issue, so propapably can't help that much with fixing it, but I'm willing to test any proposed fix.
Comment 7 Larry the Git Cow gentoo-dev 2019-12-30 09:59:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0449fb463341e064a926929e1c6d1c22b963891

commit a0449fb463341e064a926929e1c6d1c22b963891
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2019-12-29 10:17:49 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2019-12-30 09:58:30 +0000

    dev-lang/rust: revbump 1.40.0 with fixes
    
    add parallel-compiler useflag, to use pass RUSTFLAGS=" -Zthreads=<num>"
    add debian soname patch
    add system-bootstrap
    install rustlib into /usr/lib unconditionally
    drop multilib hacks
    various minor fixes
    add myself to metadata.xml explicitly
    
    Bug: https://bugs.gentoo.org/694248
    Bug: https://bugs.gentoo.org/703744
    Bug: https://bugs.gentoo.org/703470
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-lang/rust/files/1.40.0-add-soname.patch |  36 +++
 dev-lang/rust/metadata.xml                  |   6 +
 dev-lang/rust/rust-1.40.0-r1.ebuild         | 340 ++++++++++++++++++++++++++++
 3 files changed, 382 insertions(+)
Comment 8 tt_1 2019-12-30 12:27:13 UTC
thank you so much for the fast fix, the initial problem is solved now. 

But mind you, that on an amd64 machine, most libs are installed into /usr/lib/rustlib, while few libs are installed into /usr/lib64/

is this what you intended?
Comment 9 tt_1 2019-12-30 13:57:38 UTC
there's a typo, should be rustlib instead of rurstlib:

https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.40.0-r1.ebuild#L101
Comment 10 tt_1 2019-12-30 14:35:02 UTC
there might be another typo somewhere in the new virtual:

user # emerge pv =virtual/rust-1.40.0 --nodeps
[ebuild  N     ] sys-apps/pv-1.6.6  USE="nls -debug" 
[ebuild     U ~] virtual/rust-1.40.0 [1.39.0] ABI_X86="(64%*) -32% (-x32)" 

The following keyword changes are necessary to proceed:
 (see "package.accept_keywords" in the portage(5) man page for more details)
# required by =virtual/rust-1.40.0 (argument)
=virtual/rust-1.40.0 ~amd64

this likely indicates that some variable of PV might not be handled properly?
Comment 11 Georgy Yakovlev archtester gentoo-dev 2019-12-30 18:56:27 UTC
Thanks for feedback!

Second one is a type on you commandline, I also always install pv =) it should be -pv

That’s how I discovered that wonderful utility, not kidding, it’s great.
Comment 12 Georgy Yakovlev archtester gentoo-dev 2019-12-30 18:57:10 UTC
And of course I made a typo in a word typo.
Comment 13 Larry the Git Cow gentoo-dev 2019-12-30 19:20:15 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce2a266d1db4ad5e2bde4a729772a7065213c50b

commit ce2a266d1db4ad5e2bde4a729772a7065213c50b
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2019-12-30 19:11:19 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2019-12-30 19:19:54 +0000

    dev-lang/rust: fix small typo in 1.40-r1 ebuild
    
    Bug: https://bugs.gentoo.org/703744
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-lang/rust/rust-1.40.0-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 14 Georgy Yakovlev archtester gentoo-dev 2019-12-30 19:24:50 UTC
(In reply to tt_1 from comment #8)
> 
> But mind you, that on an amd64 machine, most libs are installed into
> /usr/lib/rustlib, while few libs are installed into /usr/lib64/
> 
> is this what you intended?

yes' it's intended and ok. those a public libs if stuff wants to link to them and rustc itself uses them.
it will not find it's libs in /usr/lib due to ld search path.

rustc => /usr/bin/rustc (interpreter => /lib64/ld64.so.2)
    librustc_driver-392e7f17f33a51e3.so => /usr/lib64/librustc_driver-392e7f17f33a51e3.so
        libtest-a215d318b8c82ccb.so => /usr/lib64/libtest-a215d318b8c82ccb.so
        libdl.so.2 => /lib64/libdl.so.2
        libpthread.so.0 => /lib64/libpthread.so.0
        libgcc_s.so.1 => /usr/lib/gcc/powerpc64le-unknown-linux-gnu/9.2.0/libgcc_s.so.1
        ld64.so.2 => /lib64/ld64.so.2
        libm.so.6 => /lib64/libm.so.6
    libstd-75405bbdc5edd537.so => /usr/lib64/libstd-75405bbdc5edd537.so
    libc.so.6 => /lib64/libc.so.6


it's illegal to install 64bit libs to /usr/lib directly on a typical system, but ok to do so in a subdir on other hand.
Comment 15 tt_1 2019-12-30 19:36:45 UTC
Created attachment 601944 [details]
files list from rust-1.40.0-r1

here's the file list, if it's as intended you can close the bug I guess.
Comment 16 Georgy Yakovlev archtester gentoo-dev 2019-12-30 19:46:33 UTC
yup, looks correct. thanks again for bringing this up.

I'd leave bug open till all versions are switched to this layout.
Comment 17 tt_1 2019-12-30 20:22:42 UTC
there's one note in the log though: 

 * QA Notice: The following shared libraries lack a SONAME
 * /usr/lib64/librustc_macros-83f7419bcdc43db4.so
Comment 18 Georgy Yakovlev archtester gentoo-dev 2020-01-01 00:11:11 UTC
that's ok, just fixed it, should not pop up anymore.
Comment 19 tt_1 2020-01-01 19:39:21 UTC
looks all shiny and fancy to me now :)
Comment 20 Georgy Yakovlev archtester gentoo-dev 2020-03-30 20:30:40 UTC
so starting with 1.43.0 we can could custom libdir again, thanks to
https://github.com/rust-lang/rust/pull/69608

I'll re-visit this bug when 1.43 time comes.


the only thing that may fail is bootstrap.
it was failing to find libdir as well.
has bootstrap been updated to take advantage of that new libdir locator?
or it takes the value of libdir automatically?

example of build faiure here
https://bugs.gentoo.org/show_bug.cgi?id=706292
Comment 21 Oleg 2020-03-30 20:49:08 UTC
(In reply to Georgy Yakovlev from comment #20)
> so starting with 1.43.0 we can could custom libdir again, thanks to
> https://github.com/rust-lang/rust/pull/69608
> 
> I'll re-visit this bug when 1.43 time comes.
> 
> 
> the only thing that may fail is bootstrap.
> it was failing to find libdir as well.
> has bootstrap been updated to take advantage of that new libdir locator?
> or it takes the value of libdir automatically?
> 
> example of build faiure here
> https://bugs.gentoo.org/show_bug.cgi?id=706292

Bootstrap still have strange issues. With same options it build cc crate and cfg-if crate without bootstrap when building rust, but with bootstrap cfg-if fails.
Comment 22 Oleg 2020-03-30 20:56:11 UTC
Created attachment 627606 [details]
GZipped logs from building without boostrap with alternative libdir
Comment 23 Oleg 2020-03-30 20:56:54 UTC
Created attachment 627634 [details]
GZipped logs from building with boostrap with alternative libdir
Comment 24 Georgy Yakovlev archtester gentoo-dev 2020-03-31 07:02:13 UTC
yeah that's the failure I'm talking about.
something in bootstrap of stage0 looks for /usr/lib/rustlib and not custom libdir one level deeper.

maybe it's just couple of crates, but maybe more, I'll try to experiment later.

still works with internal-bootstrap or rust-bin, because lib/rustlib exists.
Comment 25 Oleg 2020-05-27 16:38:05 UTC
I've opened issue on tracker: https://github.com/rust-lang/rust/issues/72661
Comment 26 Oleg 2020-05-28 13:43:12 UTC
I've found out what causes issue with bootstrapping. I got some ideas how to solve it, not sure which is better.
Comment 27 Oleg 2020-05-28 16:42:34 UTC
Created attachment 642376 [details, diff]
Patch for 1.43.1 to be bootstrapped with custom libdir

Could you try this patch? I have issues with some strange tests in upstream but suppose it should be enough here.
Comment 28 Larry the Git Cow gentoo-dev 2020-07-17 06:36:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75a4d1ee6422c5e2d3984e1e7c51e65dcce66c96

commit 75a4d1ee6422c5e2d3984e1e7c51e65dcce66c96
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-07-17 00:39:23 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-07-17 06:35:02 +0000

    dev-lang/rust: bump to 1.45.0
    
    move a lot of deps to BDEPEND
    
    Bug: https://bugs.gentoo.org/703744
    Bug: https://bugs.gentoo.org/683420
    Bug: https://bugs.gentoo.org/731764
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-lang/rust/Manifest           |  15 ++
 dev-lang/rust/rust-1.45.0.ebuild | 503 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 518 insertions(+)
Comment 29 Larry the Git Cow gentoo-dev 2020-08-03 20:14:41 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4e6ca7891bdea48a8214f8ca2a675ce00c65604

commit d4e6ca7891bdea48a8214f8ca2a675ce00c65604
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-08-03 20:08:15 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-08-03 20:11:39 +0000

    dev-lang/rust: bump to 1.45.2
    
    Install rustlib to versioned subdirectory in /usr/lib* again
    
    Bug: https://bugs.gentoo.org/703744
    Bug: https://bugs.gentoo.org/683420
    Package-Manager: Portage-3.0.1, Repoman-2.3.23
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-lang/rust/Manifest           |   1 +
 dev-lang/rust/rust-1.45.2.ebuild | 521 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 522 insertions(+)
Comment 30 Georgy Yakovlev archtester gentoo-dev 2020-08-03 20:18:02 UTC
I rolled-back the changes made in this bug originally.
Rust 1.45.2 installs to /usr/lib*/rust-{ver}/rustlib again like it was.

bootstrap works fine now due to Oleg's patches.
cargo-bloat will probably stop working again. it needt to use new rustc's interface to check for libdir (suggested in the PR)