h3-java: Failure on MacBook M1
Hi,
I tried to build our software using the H3 library on a new MacBook M1. Unfortunately I do get the following error:
java.lang.UnsatisfiedLinkError: No native resource found at /darwin-arm64/libh3-java.dylib at com.uber.h3core.H3CoreLoader.copyResource(H3CoreLoader.java:68) at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:120) at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:89) at com.uber.h3core.H3Core.newInstance(H3Core.java:79)
I already found out that this is because there simply is no native library for the combination of operating system (darwin) and architecture (arm64). So my questions are: Is a fix already planned? Is there a workaround?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (1 by maintainers)
v3.7.2 should now be released to Maven Central which should include the darwin-arm64 binary!
@g-derzhavets
I believe this is the same issue as #85 and #88. While I can take a look at pinning dockcross to a far back enough version, Ubuntu 16.04 is out of standard support so I would suggest upgrading to the latest LTS if possible.
I am also on M1 mac with Monterey macOs. I have a gradle project, that uses the
com.uber:h3:3.4.1
lib. I’ve managed to build the libs locally viamvn clean install -Dh3.use.docker=false
and I see that the new libs (3.7.2) were copied into my.m2
repository. I am not that proficient with dependencies, so would you be able to explain, where should I put these jars so my gradle project in Intellij could use them? @isaacbrodsky thanksupd: I managed to make gradle (with this recommendation) to use the lib from my
.m2
and my build ran successfully. Thanks a lot @muthenberg for raising the issue and @isaacbrodsky for fixing it 😃I hope the lib for arm will be soon published to the maven repository.
@muthenberg Would you be able to upload a complete build log to Gist?
I think the issue you are running into may be due to the Docker cross compiling failing (it needs to use a JNI header from the host platform.) Please try instead
mvn clean install -Dh3.use.docker=false
Could you also post the output of
uname -sm
? The file build-h3.sh may need to be updated to put the library in the right place. Probably something like adding:(There’s also the possibility that H3CoreLoader.java will need a small update to detect the right library to load. If that’s the case you should be able to use
H3Core.newInstance(H3CoreLoader.OperatingSystem.DARWIN, "arm64")
as a workaround.)BTW.: If I try to build the newest version (commit #661bea1) with
mvn clean install
I get:It seems that the system tries to build H3 for Linux ARM64, which will obviously not work. Unfortunately my Make knowledge is not great enough to fix that issue.