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

Partial work on building with Cargo #71029

Merged
merged 5 commits into from
Apr 12, 2020
Merged

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Apr 11, 2020

This cherry picks the commits I'm directly approving from #70999, I want to land them so that that PR is smaller.

@Mark-Simulacrum
Copy link
Member Author

cc @luca-barbieri -- just cherry-picking your commits that I want to approve without some further thought / feedback so that we don't need to rebase them and such. These seem definitely good to have :)

@bors r+

Self-approving since I've just cherry-picked @luca-barbieri's commits essentially, with only minor edits to the compiler-rt root.

@bors
Copy link
Contributor

bors commented Apr 11, 2020

📌 Commit 708ae8345b69ed334bddbd82d15ac68e4abc4c83 has been approved by Mark-Simulacrum

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 11, 2020
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-04-11T15:16:44.0650667Z ========================== Starting Command Output ===========================
2020-04-11T15:16:44.0653643Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/caabb19f-27da-471e-9f86-6e8baaedec14.sh
2020-04-11T15:16:44.0654033Z 
2020-04-11T15:16:44.0659133Z ##[section]Finishing: Disable git automatic line ending conversion
2020-04-11T15:16:44.0678980Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/71029/merge to s
2020-04-11T15:16:44.0682547Z Task         : Get sources
2020-04-11T15:16:44.0682839Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-11T15:16:44.0683173Z Version      : 1.0.0
2020-04-11T15:16:44.0683363Z Author       : Microsoft
---
2020-04-11T15:16:45.2872093Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-04-11T15:16:45.2878195Z ##[command]git config gc.auto 0
2020-04-11T15:16:45.2883310Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-04-11T15:16:45.2888752Z ##[command]git config --get-all http.proxy
2020-04-11T15:16:45.2897841Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/71029/merge:refs/remotes/pull/71029/merge
---
2020-04-11T15:18:58.8268505Z  ---> 78ad2f4d4aca
2020-04-11T15:18:58.8268819Z Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
2020-04-11T15:18:58.8269213Z  ---> Using cache
2020-04-11T15:18:58.8269594Z  ---> 4d2dc61c4d00
2020-04-11T15:18:58.8271166Z Step 7/7 : ENV SCRIPT python3 ../x.py test src/tools/expand-yaml-anchors &&            python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python3 ../x.py build --stage 0 src/tools/build-manifest &&            python3 ../x.py test --stage 0 src/tools/compiletest &&            python3 ../x.py test src/tools/tidy &&            /scripts/validate-toolstate.sh
2020-04-11T15:18:58.8273193Z  ---> 776b6266a8b7
2020-04-11T15:18:58.8273374Z Successfully built 776b6266a8b7
2020-04-11T15:18:58.8273981Z Successfully tagged rust-ci:latest
2020-04-11T15:18:58.8274493Z Built container sha256:776b6266a8b7d63e2d3c2b5a784dbf521184a904fb10bf818c6b5c7e1ab74d4a
2020-04-11T15:18:58.8274493Z Built container sha256:776b6266a8b7d63e2d3c2b5a784dbf521184a904fb10bf818c6b5c7e1ab74d4a
2020-04-11T15:18:58.8274833Z Looks like docker image is the same as before, not uploading
2020-04-11T15:19:05.4397536Z [CI_JOB_NAME=mingw-check]
2020-04-11T15:19:05.4622985Z [CI_JOB_NAME=mingw-check]
2020-04-11T15:19:05.4651310Z == clock drift check ==
2020-04-11T15:19:05.4660176Z   local time: Sat Apr 11 15:19:05 UTC 2020
2020-04-11T15:19:05.5232413Z   network time: Sat, 11 Apr 2020 15:19:05 GMT
2020-04-11T15:19:05.5255151Z Starting sccache server...
2020-04-11T15:19:05.6327762Z configure: processing command line
2020-04-11T15:19:05.6328521Z configure: 
2020-04-11T15:19:05.6329879Z configure: rust.parallel-compiler := True
---
2020-04-11T15:20:59.0484108Z    Compiling hashbrown v0.6.2
2020-04-11T15:20:59.1678179Z error: failed to run custom build command for `compiler_builtins v0.1.25`
2020-04-11T15:20:59.1678945Z 
2020-04-11T15:20:59.1679100Z Caused by:
2020-04-11T15:20:59.1679834Z   process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/build/compiler_builtins-2069b1987fa53be5/build-script-build` (exit code: 101)
2020-04-11T15:20:59.1680472Z --- stdout
2020-04-11T15:20:59.1680834Z cargo:rerun-if-changed=build.rs
2020-04-11T15:20:59.1681327Z cargo:compiler-rt=/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/compiler-rt
2020-04-11T15:20:59.1681765Z cargo:rustc-cfg=feature="unstable"
2020-04-11T15:20:59.1682462Z --- stderr
2020-04-11T15:20:59.1682462Z --- stderr
2020-04-11T15:20:59.1683417Z thread 'main' panicked at 'RUST_COMPILER_RT_ROOT is not set', /cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/build.rs:423:21
2020-04-11T15:20:59.1684074Z 
2020-04-11T15:20:59.1684491Z warning: build failed, waiting for other jobs to finish...
2020-04-11T15:20:59.3407779Z error: build failed
2020-04-11T15:20:59.3430913Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libtest/Cargo.toml" "--message-format" "json-render-diagnostics"
2020-04-11T15:20:59.3430913Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libtest/Cargo.toml" "--message-format" "json-render-diagnostics"
2020-04-11T15:20:59.3431592Z expected success, got: exit code: 101
2020-04-11T15:20:59.3445971Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2020-04-11T15:20:59.3446278Z Build completed unsuccessfully in 0:01:53
2020-04-11T15:20:59.3551235Z == clock drift check ==
2020-04-11T15:20:59.3566308Z   local time: Sat Apr 11 15:20:59 UTC 2020
2020-04-11T15:20:59.4933624Z   network time: Sat, 11 Apr 2020 15:20:59 GMT
2020-04-11T15:21:00.3887601Z 
2020-04-11T15:21:00.3887601Z 
2020-04-11T15:21:00.3982767Z ##[error]Bash exited with code '1'.
2020-04-11T15:21:00.3995708Z ##[section]Finishing: Run build
2020-04-11T15:21:00.4039165Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/71029/merge to s
2020-04-11T15:21:00.4043639Z Task         : Get sources
2020-04-11T15:21:00.4043935Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-11T15:21:00.4044531Z Version      : 1.0.0
2020-04-11T15:21:00.4044884Z Author       : Microsoft
2020-04-11T15:21:00.4044884Z Author       : Microsoft
2020-04-11T15:21:00.4045179Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-04-11T15:21:00.4045686Z ==============================================================================
2020-04-11T15:21:00.7010495Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-04-11T15:21:00.7055042Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/71029/merge to s
2020-04-11T15:21:00.7145504Z Cleaning up task key
2020-04-11T15:21:00.7147006Z Start cleaning up orphan processes.
2020-04-11T15:21:00.7352965Z Terminate orphan process: pid (3964) (python)
2020-04-11T15:21:00.7492841Z ##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@Mark-Simulacrum
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 11, 2020
@Mark-Simulacrum
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2020

📌 Commit 7612358277bda03959b1bf876e903a5b67cfaa83 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 11, 2020
@Mark-Simulacrum
Copy link
Member Author

Cherry-picked one more commit. @bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2020

📌 Commit c740496252ae50388e6173a55006c33e4e5ffc0d has been approved by Mark-Simulacrum

Comment on lines 4 to 5
// Use the test crate here so we depend on getopts through it. This allow tools to link to both
// librustc_session and libtest.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it might not be, good call. I think that tools should continue to work with this PR, but I can try and check locally (and if so update this comment) due to the pub use getopts below. If we do have problems in practice then we can workaround them I think.

@Mark-Simulacrum
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 11, 2020
rustc_session exports it for other crates to avoid mismatching
crate versions.
The code was broken because it printed "llvm-config" instead of the
absolute path to the llvm-config executable, causing Cargo to always
rebuild librustc_llvm if using system LLVM.

Also, it's not the build system's job to rebuild when a system library
changes, so we simply don't emit "rerun-if-changed" if a path to LLVM
was not explicitly provided.
x.py sets it unconditionally, so want it for plain "cargo build".

We need to load one of the panic runtimes that is in src (vs. pre-built in the
compiler's sysroot) to ensure that we don't load libpanic_unwind from the
sysroot. That would lead to a load of libcore, also from the sysroot, and create
lots of errors about duplicate lang items.
@Mark-Simulacrum
Copy link
Member Author

As best as I can tell clippy/miri do build with this, and rustfmt will likely need to bump it's rustc_session dependency (to stop trying to pull getopts from the sysroot). But I believe the comment isn't correct, so approving (I've pushed an update removing it).

If it turns out that rustfmt or some other tool does in fact need this I believe it should be true that they can use getopts from the rustc_session in the sysroot. But if that's not right, then we can back this out.

@bors r+

@bors
Copy link
Contributor

bors commented Apr 11, 2020

📌 Commit 1864caa has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 11, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2020
Rollup of 6 pull requests

Successful merges:

 - rust-lang#71029 (Partial work on building with Cargo)
 - rust-lang#71034 (Clean up E0515 explanation)
 - rust-lang#71041 (Update links of `rustc guide`)
 - rust-lang#71048 (Normalize source when loading external foreign source into SourceMap)
 - rust-lang#71053 (Add some basic docs to `sym` and `kw` modules)
 - rust-lang#71057 (Clean up E0516 explanation)

Failed merges:

r? @ghost
default = ["std_detect_file_io", "std_detect_dlsym_getauxval"]
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat surprising to me, what's the explanation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to link to some panic runtime for std to build and I believe bootstrap always builds std with panic-unwind linked in today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this negatively affect some -Zbuild-std uses?

@bors bors merged commit b83c2e9 into rust-lang:master Apr 12, 2020
Comment on lines -2 to -7
#![feature(test)]

// Use the test crate here so we depend on getopts through it. This allow tools to link to both
// librustc_session and libtest.
extern crate getopts;
extern crate test as _;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this broke rustfmt and rls in #71059 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right link-related extern crates still exist in rustc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error:

error[E0464]: multiple matching crates for `getopts`
 --> /cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_session-651.0.0/lib.rs:6:1
  |
6 | extern crate getopts;
  | ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: candidates:
          crate `getopts`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-2a6246002b81ef60.rlib
          crate `getopts`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-c6adfde1f127313e.rlib

error[E0463]: can't find crate for `getopts`
 --> /cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_session-651.0.0/lib.rs:6:1
  |
6 | extern crate getopts;
  | ^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems likely, but I'm pretty sure that once y'all bump the autopublished librustc_session crate then things should work. If not, please do let me know, we can re-add this here as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants