Fails to build on Alpine Linux
cargo build --release
...
Compiling pkg-config v0.3.24
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-linux-gnu` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
Alpine’s rust triplet is x86_64-alpine-linux-musl.
- youki 0.0.1
- rust 1.58.0
- Alpine Linux Edge
@jirutka Thanks for your report. Maybe you need to modify .cargo/config. Can I ask you to try to modify it?
Sure, what I should put into .cargo/config?
@jirutka How about this?
[build]
target = "x86_64-alpine-linux-musl"
Oh my… I see where’s the problem. Why do you have .cargo/config in the repository? This is a local site-specific config, it shouldn’t be committed into the repository. And you definitely shouldn’t force the target triplet.
Oh my… I see where’s the problem. Why do you have .cargo/config in the repository? This is a local site-specific config, it shouldn’t be committed into the repository. And you definitely shouldn’t force the target triplet.
@jirutka Youki can only be built with a linux kernel. Therefore, I had to specify it for my environment, but it may not be necessary anymore.
Youki can only be built with a linux kernel.
And how is this related to linux kernel? Anyway, it shouldn’t be in the repository.
BTW, I successfully built youki on Alpine Linux (musl libc, dynamically linked) aarch64, armhf, armv7, ppc64le, x86, and x86_64 (https://pkgs.alpinelinux.org/packages?name=youki), but a few tests fail (I haven't had time to find out why). I had to patch few things: fix-rlimit-type.patch and libcgroups-workaround-magic-constants.patch. The latter is a workaround for missing constants in the nix crate which is caused by missing constants in the libc crate (https://github.com/rust-lang/libc/pull/2633).
@jirutka It uses kernel calls that are only available in libseccomp and linux. Therefore, it cannot be built on mac os.
Thanks for your report!
(https://pkgs.alpinelinux.org/packages?name=youki), but a few tests fail (I haven't had time to find out why). I had to patch few things: fix-rlimit-type.patch and libcgroups-workaround-magic-constants.patch. The latter is a workaround for missing constants in the nix crate which is caused by missing constants in the libc crate (rust-lang/libc#2633).
It uses kernel calls that are only available in libseccomp and linux. Therefore, it cannot be built on mac os.
I know, but again, this is not a reason for forcing target in .cargo/config for everyone.
It uses kernel calls that are only available in libseccomp and linux. Therefore, it cannot be built on mac os.
Definitely, I agree with you. Do you have any good ideas about it? Maybe we have to use build.rs.
Do you have any good ideas about it? Maybe we have to use build.rs.
I don’t see any problem that needs to be addressed here, except adding .cargo/ to .gitignore and removing it from the repository. When you have linux-headers, libseccomp dev files and dbus dev files installed on the system (and this is already documented in readme), it just builds (except a few musl/Alpine-specific issues in my case).
What OS do you actually use that you had to to explicitly set target to x86_64-unknown-linux-gnu?
This was to make it easier for macos users to understand the error if they build it.
It is possible to delete them when the README describes the supported OSes.
It is possible to delete them when the README describes the supported OSes.
Yes, that’s the correct way.
Local build is only supported on Linux.
I think it's already addressed in the README.
Seems the issue now is tests failing on Alpine. We probably need to look into this, and figure out why. Until there's some discovery work done I'll leave this ticket open. I may have time in the near future to look into this. @jirutka if you can provide any additional context as to what tests are failing and which architectures they are failing on that would incredibly helpful.
There has been no activity in this issue and youki has changed a lot since this issue has been filed. Please re-open if there is objections.