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

Support compiling rustc without LLVM #42752

Closed
wants to merge 3 commits into from
Closed

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jun 19, 2017

Doesn't yet compile without llvm enabled.

Todo:

  • Make crate metadata reading work without LLVM
  • Make crate metadata writing work without LLVM

Error log when not using llvm:

$ ../x.py build
    Finished dev [unoptimized] target(s) in 0.0 secs
Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage0 std from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 test artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage0 test from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 compiler artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
   Compiling rustc_driver v0.0.0 (file:///~/Documents/rust_fork/src/librustc_driver)
error[E0433]: failed to resolve. Use of undeclared type or module `rustc_trans`
   --> ~/Documents/rust_fork/src/librustc_driver/lib.rs:210:54
    |
210 |     let cstore = Rc::new(CStore::new(&dep_graph, box rustc_trans::LlvmMetadataLoader));
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `rustc_trans`

error[E0433]: failed to resolve. Use of undeclared type or module `rustc_trans`
   --> ~/Documents/rust_fork/src/librustc_driver/lib.rs:417:66
    |
417 |                 let cstore = Rc::new(CStore::new(&dep_graph, box rustc_trans::LlvmMetadataLoader));
    |                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `rustc_trans`

error: aborting due to 2 previous errors

error: Could not compile `rustc_driver`.

To learn more, run the command again with --verbose.
thread 'main' panicked at 'command did not execute successfully: "~/Documents/rust_fork/no_llvm_build/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "8" "--target" "x86_64-apple-darwin" "--release" "--features" " jemalloc" "--manifest-path" "/Users/bjorn/Documents/rust_fork/src/rustc/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', /Users/bjorn/Documents/rust_fork/src/bootstrap/compile.rs:555
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: bootstrap::compile::run_cargo
   7: bootstrap::compile::rustc
   8: bootstrap::step::build_rules::{{closure}}
   9: bootstrap::step::Rules::run
  10: bootstrap::step::run
  11: bootstrap::Build::build
  12: bootstrap::main
  13: __rust_maybe_catch_panic
  14: std::rt::lang_start
  15: main
failed to run: ~/Documents/rust_fork/no_llvm_build/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:00:04

Edit: remove getting rustdoc working from todo list.

@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 19, 2017

This would allow miri to run on platforms without llvm like redox os

@est31
Copy link
Member

est31 commented Jun 20, 2017

Note that @steveklabnik is currently working on a rewrite of rustdoc to get rid of most compiler dependencies, not sure if you want to duplicate work here.

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 20, 2017

@est31 thanks for pointing me to that!

Will remove the commit with rustdoc changes later this day.

@bjorn3 bjorn3 force-pushed the no_llvm_pr branch 4 times, most recently from 17ebb33 to 06d9fc5 Compare June 20, 2017 18:04
@arielb1 arielb1 added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 20, 2017
@bors
Copy link
Contributor

bors commented Jun 21, 2017

☔ The latest upstream changes (presumably #42664) made this pull request unmergeable. Please resolve the merge conflicts.

Doesn't yet compile when `llvm-enabled = false` due to crate metadata loading needing LLVM
@bjorn3 bjorn3 force-pushed the no_llvm_pr branch 2 times, most recently from 6cd811b to 2e2501b Compare June 21, 2017 12:34
@brson
Copy link
Contributor

brson commented Jun 24, 2017

Neat project.

There's quite a lot of cfg in the driver. Seems like a bit of a smell. And the driver is actually sliced up to completely remove trans. Eventually we would expect this to be more refined, with trans supporting multiple backends, and disabling llvm just disabling one particular backend. It might be more elegant here to sink all the driver cfg into trans, and have trans itself report that there is no backend.

@ids1024
Copy link
Contributor

ids1024 commented Jun 24, 2017

This would allow miri to run on platforms without llvm like redox os

Actually Rustc and LLVM now work under Redox (as part of my Google Summer of Code project to make Redox OS self-hosting). Of course that doesn't invalidate this PR which has many other potential benefits, but I thought I might as well mention it.

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 24, 2017

@ids1024 didn't know.

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 27, 2017

Closing in favor of #42932.

@bjorn3 bjorn3 closed this Jun 27, 2017
bors added a commit that referenced this pull request Aug 11, 2017
Support compiling rustc without LLVM (try 2)

Now doesn't change rustc_driver.

Supersedes #42752
@bjorn3 bjorn3 deleted the no_llvm_pr branch September 24, 2017 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants