containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
807 stars 67 forks source link

EFI variant not building correctly #168

Closed tylerfanelli closed 7 months ago

tylerfanelli commented 7 months ago

On aarch64 macOS:

$ make EFI=1
cargo build --release --features efi
    Finished release [optimized] target(s) in 0.03s
cp target/release/libkrun-efi.dylib target/release/libkrun-efi.1.7.2.dylib
cp: target/release/libkrun-efi.dylib: No such file or directory
make: *** [target/release/libkrun-efi.1.7.2.dylib] Error 1

$ ls -l target/release
...
libkrun.dylib
...

It seems that the generated dylib is not being named properly.

When manually copying the file over:

$ cp target/release/libkrun.dylib target/release/libkrun-efi.dylib
$ make
gcc -O2 -static -Wall  -o init/init init/init.c 
init/init.c:23:10: fatal error: 'linux/vm_sockets.h' file not found
#include <linux/vm_sockets.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [init/init] Error 1

The init binary is being compiled, which should not be as the EFI feature explicitly sets BUILD_INIT = 0. This is strange, we see that the EFI feature is found because of cargo build's --features efi feature, yet some other features (like BUILD_INIT) may be overwritten?

slp commented 7 months ago

Good catch, #170 should fix this. As for the second call, you seem to be missing EFI=1 on make there, which would explain why it's trying to build init/init.

tylerfanelli commented 7 months ago

@slp Yes, you're right. Thanks for submitting the fix.