hermit-os / hermit-rs

Hermit for Rust.
Apache License 2.0
1.69k stars 86 forks source link

Can't build with khronos-egl as dependency #498

Closed dpogorzelski closed 1 year ago

dpogorzelski commented 1 year ago

Hey, I'm running into the following issue when building a project that has khronos-egl as dependency:

error[E0433]: failed to resolve: could not find `Library` in `libloading`
    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-4.1.0/src/lib.rs:2191:27
     |
2191 |                   let lib = libloading::Library::new(filename).map_err(LoadError::Library)?;
     |                                         ^^^^^^^ could not find `Library` in `libloading`
...
2210 | / api! {
2211 | |     EGL1_0 : "1_0" {
2212 | |         fn eglChooseConfig(
2213 | |             display: EGLDisplay,
...    |
2362 | |     }
2363 | | }
     | |_- in this macro invocation
     |
     = note: this error originates in the macro `api` (in Nightly builds, run with -Z macro-backtrace for more info)
help: there is an enum variant `LoadError::Library`; try using the variant's enum
     |
2191 |                 let lib = LoadError(filename).map_err(LoadError::Library)?;

any suggestion as to what could be the problem? Outside of hermit target everything builds just fine.

dpogorzelski commented 1 year ago

I guess the reason is because https://docs.rs/libloading/latest/libloading/struct.Library.html is only available for unix and windows

mkroening commented 1 year ago

Thanks for your interest!

Hermit does not support loading dynamic libraries yet.

You might want to check out Unikraft instead. I think, they might have dynamic library support. Also, I am working on Rust application support on Unikraft with an example application coming soon. This is currently blocked on https://github.com/unikraft/kraftkit/pull/703, though.

dpogorzelski commented 1 year ago

Thanks for the info. I the meantime I managed to get rid of the dependency.