-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running cargo test
fails out-of-the-box on an M1 Mac
#4233
Comments
➤ Sammy Khamis commented: This is an excellent write-up! I think you covered everything here. The only thing I'll add is the actual error log for verbosity: java.lang.UnsatisfiedLinkError: dlopen(/Users/skhamis/moz/uniffi-rs/target/debug/libuniffi_coverall.dylib, 9): no suitable image found. Did find: failures:
Error: running failures: test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 32.53sand running a file on the lib that is erroring out nets: |
➤ Sammy Khamis commented: So wanted to update on this as I had time to finally fix it! The real issue was indeed having incompatible Java and JNA versions which is "fixed" by installing an arm64 java.
While this definitely over-complicates things for M1 users. I actually believe this is the way to go for the near future as it allows flexibility for arm64 and x86_64 when one or the other is needed for simple compiling. I do think this was in part contributing to "operator error" as I had x86_64 JVM but JNA auto-detects and "forces" arm64 since it detects that platform. Don't necessarily know what the "right" way to fix this would be other than possibly detecting what JVM they have and generating the libs based on that but this seems really specific to Apple silicon. Possibly a doc that FAQ with what is happening? Definitely open to any ideas! |
Some notes from a discussion earlier today with @skhamis; please add your own notes here as appropriate.
On a checkout of
uniffi-rs
on an M1 Mac,cargo test
fails when running the Kotlin bindings tests. IIUC the issue we ran into was:arm64
by default.x86_64
binary, meaning that Java programs would run in virtualized mode.x64_64
dylibs, and is not able to loadarm64
dylibs. (ref Platform.RESOURCE_PREFIX on Darwin x64 and M1 java-native-access/jna#1313 for a bit of discussion about this in JNA).cargo build
the target crate for the native host, making anarm64
dylib.Two things we could try to solve this:
x86_64
binaries for use in these tests.┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: