aurae-runtime / aurae

Distributed systems runtime daemon written in Rust.
https://aurae.io
Apache License 2.0
1.85k stars 91 forks source link

error: could not compile `libcontainer` due to previous error #315

Closed S4CH closed 1 year ago

S4CH commented 1 year ago

Where it started ??

It's started on cargo build

Compiling auraescript v0.1.0 (/home/s4ch/projects/aurae/auraescript)
error: failed to run custom build command for `auraescript v0.1.0 (/home/s4ch/projects/aurae/auraescript)`

Caused by:
process didn't exit successfully: `/home/s4ch/projects/aurae/target/debug/build/auraescript-4d00ba6819fb3a64/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at 'Failed to create or overwrite "/home/s4ch/projects/aurae/auraescript/gen/helpers.ts"', auraescript/build.rs:37:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Panicked right!!!

So, Install the protobuf (https://github.com/protocolbuffers/protobuf/releases) and if you are on arch based distro then yay -S protobuf buf

make proto

I thought it will help but my bad got the libcontainer error

s4ch@wizer ~/p/aurae (main) [101]> cargo build --bins
Compiling tonic v0.8.3
Compiling swc_ecma_parser v0.122.19
Compiling swc_ecma_visit v0.80.14
Compiling swc_ecma_codegen v0.127.23
Compiling libcontainer v0.0.4 (https://github.com/krisnova/youki?branch=musl-libcontainer#e8919304)
error[E0308]: mismatched types
--> /home/s4ch/.cargo/git/checkouts/youki-ecf4771dd4ac50dc/e891930/crates/libcontainer/src/syscall/linux.rs:380:44
|
380  |         let res = unsafe { libc::setrlimit(rlimit.typ() as i32, rlim) };
|                            --------------- ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`
|                            |
|                            arguments to this function are incorrect
|
note: function defined here
--> /home/s4ch/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.139/src/unix/linux_like/linux/gnu/mod.rs:1168:12
|
1168 |     pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
|            ^^^^^^^^^
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
|
380  |         let res = unsafe { libc::setrlimit((rlimit.typ() as i32).try_into().unwrap(), rlim) };
|                                            +                   +++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `libcontainer` due to previous error
warning: build failed, waiting for other jobs to finish...

Now what to do ??

Now clean up the cargo by cargo clean and remove the cargo lockfile rm Cargo.lock

Install the musl (https://wiki.musl-libc.org/getting-started.html) and for arch guys yay -S musl

Look at the rustup target list | grep installed You should have both installed on your machine

s4ch@wizer ~/p/aurae (main)> rustup target list | grep installed
x86_64-unknown-linux-gnu (installed)
x86_64-unknown-linux-musl (installed)

If you don't have then just add them simply by

rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl

And remember it's architecture depended.

Also, if you don't have clang and llvm on your machine then install them as well

make auraed

Hope it will resolve the issues which you are facing !!

Generate pki as well first make pki config and then make start

References you can find in the community on discord -> https://discordapp.com/channels/1026578122969206796/1029511038598664192/1067296632787435561

Don't miss this moment by @krisnova

Thanks @future-highway @jesse-peters !!

future-highway commented 1 year ago

Thank you for the write up. I'm not sure why clang and llvm were needed in your setup. I don't seem to have them on my system. I think the error was due to the missing musl dependency and target.