Comments (14)
I don't really like the idea of statically linking Musl to support one uncommon Linux variant. If we're going to support this, I'd rather we do some autoconf-like detection of which library, glibc or musl, to link to, and to use the OS-provided one. Otherwise we're opening ourselves to an upgrade treadmill for all security updates to musl.
from h3-java.
Thanks for providing detailed steps for reproducing. I was able to reproduce the issue with the openjdk:8-alpine
image.
After taking a look at the core dump, it looks like the issue is inside the function h3ToGeo
. I noticed it calls a C core library function isfinite
, and I was able to move the crash up in the call stack by adding a call to isfinite
in jniapi.c
. The issue is that the linux-x64
cross-compile build links to glibc, which is not available on Alpine Linux.
Since installing glibc on Alpine or statically linking with glibc are not recommended, it looks like the best approach here might be to change the linux-*
cross-compile builds to statically link to musl.
from h3-java.
If this is the path we'll follow, I'd really enjoy opening a PR to change that during the weekend.
Are you aware of any dependency from glibc that is not available in musl?
from h3-java.
No, we shouldn't have any dependency on glibc itself. The core library has been tested with Alpine Linux and musl itself, and with MSVC.
cc @dfellis @isaachier @nrabinowitz in case there's something I'm not considering about statically linking to a different libc.
from h3-java.
@isaacbrodsky statically linking libc is generally a bad idea, and I think affects the licensing of the resulting binary (https://lwn.net/Articles/117972/), so H3 doesn't do that.
from h3-java.
@isaachier I believe the idea is to statically link musl, actualy. musl has a MIT license
from h3-java.
@dgmneto I think @isaacbrodsky helped me find the underlying problem. Here is a quote from the musl FAQ:
At present, some glibc-linked shared libraries can be loaded with musl, but all but the simplest glibc-linked applications will fail if musl is dropped-in in place of /lib/ld-linux.so.2.
https://www.musl-libc.org/faq.html
from h3-java.
I'll have to disagree with @dfellis on how uncommon Alpine is: in the docker world Alpine is usually used to reduce layer/image sizes. Even so, I get your point.
We are using H3 in a few Java applications rn, so I'll try to make a dockcross that uses musl-gcc and then I'll share here the results.
from h3-java.
@isaacbrodsky somewhat related question: Would it make sense to use -DCMAKE_BUILD_TYPE=RelWithDebInfo
so the stacktraces aren't hex values?
from h3-java.
I don't want to get into a Linux distro flamewar (Linux is my daily driver, I've had enough of those over the years), I wanted to point out that we could easily tangle ourselves into a support nightmare when we look beyond the top 10 Linux distros (Alpine is currently 65th according to Distrowatch, and even in the world of Docker, Alpine has half the stars of Ubuntu).
from h3-java.
@dfellis I understand your position, but you'd be surprised about how many docker images use Alpine as a base. Stars aside, I wonder if there is a way to search for base image "spinoffs."
from h3-java.
See here for known issues with libraries on Alpine Linux: https://github.com/gliderlabs/docker-alpine/blob/master/docs/caveats.md.
from h3-java.
A good solution would be to package H3 itself as a package in Alpine, then H3-Java and other bindings can use the system provided core library.
edit: this would be limited by the need for JNI adapter functions.
The other option would be for Alpine users to build H3-Java on Alpine Linux and use the built artifact from there. That should be fully compatible with Alpine.
from h3-java.
Yes that would work but you will have a lot of package systems to work with (debian, rpm, etc.).
from h3-java.
Related Issues (20)
- java.io.IOException: No such file or directory in H3Core.newInstance() HOT 2
- Performance of a non-throwing API
- java.lang.UnsatisfiedLinkError on v4 in Windows HOT 2
- Upgrade h3 version in Java monorepo HOT 3
- Dockcross build failure on master HOT 1
- Error building cross-compile on M1 macbook (ARM) HOT 1
- linux-x86 fails to cross compile on M1 Mac
- Compact Cells Failing on Certain Large Polygons HOT 1
- Can't use H3 with Spring Boot HOT 1
- Build fail on ppc64 HOT 7
- How to generate the jar package with all the linux native objs ?
- CCLA Contact
- Add M1 CI step in Github Actions
- polygonToCells fails on a rectangular polygon
- Bump guava from 32.0.0-jre to 32.1.3-jre
- OperatingSystem Enum , getDirName toLowerCase() causes UnsatisfiedLinkError for Turkish Local HOT 1
- Why these are different h3.getToH3(..) and h3.h3ToParent(..)? HOT 2
- [Breaking change] Glibc version changed in 3.7.1 HOT 8
- Does Python have a similar module HOT 1
- java.lang.UnsatisfiedLinkError: Can't load library: /tmp/libh3-java6591047064313530667.so HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3-java.