Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
benalexau merged 1 commit intolmdbjava:masterfrombenalexau:cross-compile
Apr 24, 2023

Conversation

benalexau
Copy link
Member

This new approach provides a number of benefits:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

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.
@wardle
Copy link
Contributor

I can usemvn package with no test errors on Linux x86 and Mac OS X ARM64 with master branch head, and the same with this new PR. I will do some more tests usingmvn package on mac arm64, but the build jar files appear to work.

benalexau and mrmeszaros reacted with hooray emoji

@benalexaubenalexau merged commit288bb09 intolmdbjava:masterApr 24, 2023
benalexau added a commit that referenced this pull requestApr 24, 2023
@jubax
Copy link

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).

mrmeszaros reacted with heart emoji

@benalexau
Copy link
MemberAuthor

@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!).

jubax, mrmeszaros, and garrett-hopper reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@benalexau@wardle@jubax

[8]ページ先頭

©2009-2025 Movatter.jp