- Notifications
You must be signed in to change notification settings - Fork124
Zig cross-compilation of native libraries#217
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This new approach provides a number of benefits:1. The LmdbJava Native project can be archived. This project requiredcoordination with LmdbJava module releases and added extra artifactsto Maven Central simply to wrap native libraries. The native projectalso required a great deal of Maven configuration and it was alwaystedious to support additional platforms. Using Zig eliminates the needto run QEMU emulators in builds to support unusual platforms etc.2. Zig supports numerous cross-compilation targets straight out of thebox. A full list is available via zig targets | jq -r '.libc[]' andthis presently lists 64 on my machine. This is likely to accommodatemost LmdbJava platform support requests we are likely to receive.3. Platform naming conventions have now been standardised based on theZig target name. Support for individual build chains or specificprocessors is now simplified and much more transparent.4. The GitHub Action has been amended to perform cross-compilationunder Linux and upload the resulting native artifacts for later buildsteps. The later build steps run the Verifier on a native VM whereavailable (eg Windows, Mac OS) and this therefore tests thecross-compiled libraries.5. Target name resolution logic has been refactored and externalisedin its own class with corresponding unit tests to ensure corner casesare duly considered and any bugs more easily reproduced andpermanently rectified.This change is backwards compatible with users who used (and maycontinue to use) the lmdbjava.native.lib system property.
I can use |
jubax commentedOct 9, 2023
I'm not 100% sure about the state of this issue. My impression: It has been fixed, but so far there is not public release which contains the fix. Is that correct? In that case it would be really nice to ship a new lmdbjava version (current: 0.8.3). |
@jubax, you are correct in that this is scheduled for inclusion in 0.9.0 as per theChange Log. I need to have a closer look at#215 before I release 0.9.0 in case it's a bug, after which I will make a release (I've follow a "Zero Bug Policy" for a couple of decades now; it's the only way to keep on top of them!). |
This new approach provides a number of benefits:
The LmdbJava Native project can be archived. This project required coordination with LmdbJava module releases and added extra artifacts to Maven Central simply to wrap native libraries. The native project also required a great deal of Maven configuration and it was always tedious to support additional platforms. Using Zig eliminates the need to run QEMU emulators in builds to support unusual platforms etc.
Zig supports numerous cross-compilation targets straight out of the box. A full list is available via zig targets | jq -r '.libc[]' and this presently lists 64 on my machine. This is likely to accommodate most LmdbJava platform support requests we are likely to receive.
Platform naming conventions have now been standardised based on the Zig target name. Support for individual build chains or specific processors is now simplified and much more transparent.
The GitHub Action has been amended to perform cross-compilation under Linux and upload the resulting native artifacts for later build steps. The later build steps run the Verifier on a native VM where available (eg Windows, Mac OS) and this therefore tests the cross-compiled libraries.
Target name resolution logic has been refactored and externalised in its own class with corresponding unit tests to ensure corner cases are duly considered and any bugs more easily reproduced and permanently rectified.
This change is backwards compatible with users who used (and may continue to use) the lmdbjava.native.lib system property.