rust-lang / rust-lang/rustc_codegen_gcc

Quickstart can't build hello world: librustc_codegen_gcc.so not found

Open
#930 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Rust
Stars
1.2k
Forks
105
Avg merge
8h 20m
Merged PRs (30d)
14

Description

I'm trying to build librustc_codegen_gcc.so from this repo (rather than from Rust) to make it easier to upstream patches. However, the Quickstart instructions do not appear to work.

Following the instructions, I've:

  1. Copied config.example.toml to config.toml
  2. Ran ./y.sh prepare
  3. Ran ./y.sh build --sysroot --release

Now I'm trying to run the fourth step:

$ ./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml
[BUILD] build system
    Finished [`release` profile [optimized]](https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles) target(s) in 0.01s
Using `/home/seancross/Code/rustc_codegen_gcc/build/libgccjit/b794cb99508e7eccd40fa42bb310d5781e09899b` as path for libgccjit
   Compiling hello_world v0.0.0 (/home/seancross/Code/rustc_codegen_gcc/tests/hello-world)
error: couldn't load codegen backend /home/seancross/Code/rustc_codegen_gcc/target/debug/librustc_codegen_gcc.so: cannot open shared object file: No such file or directory

error: could not compile `hello_world` (bin "hello_world") due to 1 previous error
$

It appears to be looking for something under target/debug even though the instructions say to run ./y.sh build --sysroot --release. If I re-run step 3 with ./y.sh build --sysroot without --release, then attempting to build hello-world gives a different error:

$ ./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml
[BUILD] build system
    Finished [`release` profile [optimized]](https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles) target(s) in 0.00s
Using `/home/seancross/Code/rustc_codegen_gcc/build/libgccjit/b794cb99508e7eccd40fa42bb310d5781e09899b` as path for libgccjit
   Compiling hello_world v0.0.0 (/home/seancross/Code/rustc_codegen_gcc/tests/hello-world)
error[E0463]: can't find crate for `mylib`
 --> src/main.rs:1:5
  |
1 | use mylib::my_func;
  |     ^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `hello_world` (bin "hello_world") due to 1 previous error
$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Quickstart instructions, config.example.toml, and the ./y.sh prepare/build/cargo entry points; reproduce the release and non-release commands against tests/hello-world/Cargo.toml. Trace why the release build looks under target/debug and why the non-release build cannot find mylib. Done means the documented Quickstart commands build hello-world successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.