Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: failed to load source for a dependency on 'cc' #49269

Closed
arbitrix opened this issue Mar 22, 2018 · 5 comments · Fixed by #62549
Closed

error: failed to load source for a dependency on 'cc' #49269

arbitrix opened this issue Mar 22, 2018 · 5 comments · Fixed by #62549
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arbitrix
Copy link

./x.py build && sudo ./x.py install

Doesn't work.

error: failed to load source for a dependency on 'cc'.

@sanxiyn sanxiyn added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Mar 26, 2018
@sanxiyn
Copy link
Member

sanxiyn commented Mar 26, 2018

It would be appreciated if you could provide more details, such as your environment. While it doesn't work for you, it works for many people.

@ghost
Copy link

ghost commented Mar 26, 2018

I have the same problem on gentoo (using rust overlay and rust-9999 package, which builds rust from git). The build issue was introduced between todays rust version and "rustc 1.26.0-dev (24e679c 2018-03-14)" - this is the last version I have installed.

Here's the error message from the log:

running: /var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/bootstrap/Cargo.toml --verbose --locked --frozen
error: failed to load source for a dependency on cc

Caused by:
Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
failed to update replaced source registry https://github.com/rust-lang/crates.io-index

Caused by:
failed to read root of directory source: /var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/vendor

Caused by:
No such file or directory (os error 2)
Traceback (most recent call last):
File "x.py", line 20, in
bootstrap.main()
File "/var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/bootstrap/bootstrap.py", line 800, in main
bootstrap(help_triggered)
File "/var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/bootstrap/bootstrap.py", line 780, in bootstrap
build.build_bootstrap()
File "/var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/bootstrap/bootstrap.py", line 606, in build_bootstrap
run(args, env=env, verbose=self.verbose)
File "/var/tmp/portage/dev-lang/rust-9999/work/rust-git-src/src/bootstrap/bootstrap.py", line 148, in run
raise RuntimeError(err)

'cc' - I guess it means, it can't find the C++ compiler - I don't have clang installed (though I have llvm-4, llvm-5 and llvm-6). I have gcc-7.3.0 and gcc-6.4.0. cc is gcc-7.3.0. On different system with clang installed the build issue also shows up.

@ExpHP
Copy link
Contributor

ExpHP commented Mar 27, 2018

The cc in the error message is a bit of a red herring. It means the cc crate; it's searching for a vendored source of the crate and failing.

I don't know too much about the build process for a global install, but here's a similar issue about the (older) Makefile-based build process, which apparently expects to find vendored sources when run with sudo (though a much nicer error is given there). The circumstances here may be the same.

@sanxiyn sanxiyn changed the title Build Instructions Incorrect error: failed to load source for a dependency on 'cc' Mar 28, 2018
@XAMPPRocky XAMPPRocky added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 26, 2018
@Randl
Copy link
Contributor

Randl commented Nov 2, 2018

I found a relatively simple solution to this:

  1. commented out the following line https://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py#L792 preventing use of vendored sources
  2. run install with sudo -H instead of sudo.

@qknight
Copy link

qknight commented Dec 9, 2018

@Randl: you probably are refering to:

build.use_vendored_sources = True

thanks for pointing out! (your link points to master, and that changed...)

ewk added a commit to ewk/rust that referenced this issue Mar 21, 2019
Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues rust-lang#40108 and rust-lang#49269.
Centril added a commit to Centril/rust that referenced this issue Mar 26, 2019
Update build instructions in README.md

Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues rust-lang#40108 and rust-lang#49269.

r? @steveklabnik
Centril added a commit to Centril/rust that referenced this issue Mar 26, 2019
Update build instructions in README.md

Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues rust-lang#40108 and rust-lang#49269.

r? @steveklabnik
Centril added a commit to Centril/rust that referenced this issue Mar 26, 2019
Update build instructions in README.md

Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues rust-lang#40108 and rust-lang#49269.

r? @steveklabnik
bors added a commit that referenced this issue Jul 11, 2019
Update cargo-vendor usage

This contains a variety of updates to clean up the usage of cargo-vendor.

- Remove the install step for the old cargo-vendor now that it is built-in to cargo and available in the stage0 install.
- Update installation instructions, dealing with vendoring. The current instructions of running `sudo ./x.py install` is broken, it will almost always fail (since the vendor directory doesn't exist). Since the steps for properly handling this are numerous, I'm recommending removing the suggestion to use `sudo` altogether.
- If the sudo-forced-vendoring detects that the vendor directory is not available, abort with instructions on how to fix.
- Now that cargo-vendor is built-in, automatically run it if it looks like it is needed.
- Update instructions on how to install cargo.
- Remove the unused markdown link references in README/CONTRIBUTING. This reverts most of #44935. These references don't do anything if they are unused.

Closes #49269
cc #61142 #48771 #40108
bors added a commit that referenced this issue Jul 12, 2019
Update cargo-vendor usage

This contains a variety of updates to clean up the usage of cargo-vendor.

- Remove the install step for the old cargo-vendor now that it is built-in to cargo and available in the stage0 install.
- Update installation instructions, dealing with vendoring. The current instructions of running `sudo ./x.py install` is broken, it will almost always fail (since the vendor directory doesn't exist). Since the steps for properly handling this are numerous, I'm recommending removing the suggestion to use `sudo` altogether.
- If the sudo-forced-vendoring detects that the vendor directory is not available, abort with instructions on how to fix.
- Now that cargo-vendor is built-in, automatically run it if it looks like it is needed.
- Update instructions on how to install cargo.
- Remove the unused markdown link references in README/CONTRIBUTING. This reverts most of #44935. These references don't do anything if they are unused.

Closes #49269
cc #61142 #48771 #40108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants