mrk-its / rust-mos

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
55 stars 7 forks source link

rust-mos compilation issue #7

Closed frehwagen closed 1 year ago

frehwagen commented 2 years ago

Brilliant project, thx for it!

I'm trying to compile and use the rust-mos myself, which goes through successful as it seems but when trying to compile the hello-world project I see the following error:

`frehwagen@notebook21:~/workspace/rust-mos-hello-world$ cargo build
    Updating git repository `https://github.com/mrk-its/compiler-builtins`
    Updating crates.io index
   Compiling compiler_builtins v0.1.75 (https://github.com/mrk-its/compiler-builtins?tag=0.1.75-mos#829c47e6)
   Compiling proc-macro2 v1.0.43
   Compiling core v0.0.0 (/home/frehwagen/workspace/rust-mos/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core)
   Compiling unicode-ident v1.0.3
   Compiling quote v1.0.21
   Compiling syn v1.0.99
   Compiling proc-macro-hack v0.5.19
   Compiling libc v0.2.127
   Compiling rustc-std-workspace-core v1.99.0 (/home/frehwagen/workspace/rust-mos/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/frehwagen/workspace/rust-mos/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/alloc)
rustc: /home/frehwagen/workspace/llvm-mos/llvm/lib/CodeGen/MachineFunction.cpp:230: void llvm::MachineFunction::init(): Assertion `Target.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"' failed.
error: could not compile `compiler_builtins`

Caused by:
  process didn't exit successfully: `rustc --crate-name compiler_builtins /home/frehwagen/.cargo/git/checkouts/compiler-builtins-6e48e97653cc45c3/829c47e/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C linker-plugin-lto -C codegen-units=1 -C debuginfo=2 -C debug-assertions=on --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=0141bbeb1e689156 -C extra-filename=-0141bbeb1e689156 --out-dir /home/frehwagen/workspace/rust-mos-hello-world/target/mos-sim-none/debug/deps --target mos-sim-none -Z force-unstable-if-unmarked -L dependency=/home/frehwagen/workspace/rust-mos-hello-world/target/mos-sim-none/debug/deps -L dependency=/home/frehwagen/workspace/rust-mos-hello-world/target/debug/deps --extern core=/home/frehwagen/workspace/rust-mos-hello-world/target/mos-sim-none/debug/deps/librustc_std_workspace_core-38f3135ada7400b9.rmeta --cap-lints allow --cfg 'feature="unstable"' --cfg 'feature="mem"'` (signal: 6, SIGABRT: process abort signal)
warning: build failed, waiting for other jobs to finish...
frehwagen@notebook21:~/workspace/rust-mos-hello-world$`

I'm using the latest available llvm-mos and llvm-mos-sdk from the source repo.

Any idea what is going wrong?

mrk-its commented 1 year ago

Could you try again? I updated rust-mos recently and it should work with current llvm-mos now

p2mate commented 1 year ago

this works indeed. I still ran into #2 but I figured out what goes wrong there. Problem is that the default installation path for the target descriptions is /usr/local/rust-mos-targets/ which is only writeable by root. However I don't have rustup or rust installed as root so sudo ./create_mos_targets.py won't work because it will run rustc to get the target description. I worked around this by temporarily allowing my user to write to /usr/local/rust-mos-targets/, but probably there are better solutions.

U007D commented 1 year ago

Thank you for the write-up @p2mate. Unfortunately for me, I have given my user permission to write as well, yet issue #2 still persists for me.