Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 732632 - dev-lang/rust does not build when using libcxx as stdlib
Summary: dev-lang/rust does not build when using libcxx as stdlib
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Georgy Yakovlev
: 747976 (view as bug list)
Depends on:
Reported: 2020-07-14 21:07 UTC by Jeffrey Lin
Modified: 2020-11-23 14:03 UTC (History)
5 users (show)

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

build.log (rust-1.44.1:20200711-032546.log,938.45 KB, text/x-log)
2020-07-14 21:07 UTC, Jeffrey Lin
libcxx rust failing to bootstrap itself (rust-1.44.1:20200715-030153.log,4.93 KB, text/x-log)
2020-07-15 16:52 UTC, Jeffrey Lin

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Lin 2020-07-14 21:07:05 UTC
Created attachment 649226 [details]

The solution is to add in config.toml under the [llvm] section:

use-libcxx = true

when the compiler is sys-devel/clang[default-libcxx] or -stdlib=libc++ is passed as a compiler flag.

Arfrever suggested the following check on IRC:

tc-is-clang && { has_version "sys-devel/clang:$(clang-major-version)[default-libcxx]" || is-flagq -stdlib=libc++; }
Comment 1 Georgy Yakovlev gentoo-dev 2020-07-14 21:22:51 UTC
yes, please go with that suggestion.

I don't like it because it introduces a automagic dependency, but amount of users who's going to use it will be less than 5 probably, so that's fine ;-)

as for implementation, please pass ( we are not doing it now)

use-libcxx = false
in [llvm] section by default, in the main `echo` call.
and after that call introduce a check and a sed that will modify

something like
> if need-to-use-libcxx-check; then 
> sed -i '/^use-libcxx/ s/false/true/' config.toml || die
> fi
Comment 2 Jeffrey Lin 2020-07-15 16:52:27 UTC
Created attachment 649312 [details]
libcxx rust failing to bootstrap itself

I'm having trouble getting rust to compile itself with USE=system-bootstrap after compiling successfully with libcxx.  Attached is the build.log showing the failure.  It references a failed command, here is the output of the command run:

# /usr/bin/cargo build --manifest-path /tmp/portage/dev-lang/rust-1.44.1/work/rustc-1.44.1-src/src/bootstrap/Cargo.toml --verbose --locked --frozen
error: failed to get `cc` as a dependency of package `bootstrap v0.0.0 (/tmp/portage/dev-lang/rust-1.44.1/work/rustc-1.44.1-src/src/bootstrap)`

Caused by:
  attempting to make an HTTP request, but --frozen was specified

When run without --frozen, the build system contacts
Comment 3 12101111 2020-10-14 03:45:09 UTC
*** Bug 747976 has been marked as a duplicate of this bug. ***
Comment 4 12101111 2020-10-14 07:26:42 UTC
I compile rust 1.47.0 with `use-libcxx=true`, system-bootstrap and system-llvm and it can bootstrap itself.

I can drop this hack:

> cat /usr/lib/