-
Notifications
You must be signed in to change notification settings - Fork 13
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
Cross compilation compatibility builds #46
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Might fix aarch compilation - due to cross-compilation maybe we were picking up host architecture?
…map2-rs into feature/aarch_wheels
for all combos of target_arch and target_os
Set fakeminimap2 to use local (directory up) minimap2-rs
added minimap2-sys and fakeminimap2
Final note - the Cargo.toml for minimap2-rs currently points to the local minimap2-sys. This should be updated when the new version of minimap2-sys is up on crates.io |
Amazin!. I'm recovering from a conference but will get this pushed out in the next few days. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main changes
After hitting FEATURE: Conditional compilation for aarch64, arm_neon, and simde #13 (comment) a couple of time whilst trying to compile
mappy-rs
wheels for multiple architectures, I realised that checkingtarget_arch
in the build.rs script of minimap2-sys, only considers the host architecture and not the target triple.This meant that the
target_specific
functionminimap2-rs/minimap2-sys/build.rs
Lines 153 to 154 in bb118a5
To catch this I have changed the
target_specific
function and dropped conditional compilation for it based on target architecture, and instead used a check against the TARGET env variable inside the function, adding flags based on whether the target triple is x86 or aarch64.In the
minimap2-rs
library code, I had to add aFrom
trait to convert presets to C strings for both i8 and u8 types. I also conditionally compile any sections where pointers are passed through to the underlying FFI functions based on architecture. In linux aarch64/armv7 cross compilation, the underlying C compiler expectsu8
pointers, whereaslinux x86_64
,macOS x86_64
, andmacOS aarch64
expecti8
pointers. I have not been able to test if this breaks native compilation onlinux aarch64
.Other changes
For linux aarch64, for some reason to cross compile, the C99 standard had to be enabled, due to for loop constructions in minimap2. I've added this to the
simde
feature function, https://github.com/Adoni5/minimap2-rs/blob/d804692362e414058123de21d3464f6e7d615f52/minimap2-sys/build.rs#L167But I don't know if that's the best place to put it?
I added fakeminimap2 and minimap2-sys as cargo workspaces in the root Cargo.toml, simply so that
rust-analyzer
would work in the directory. This can be removed if you prefer, but I don't think it has any knock on effects otherwise.Built fakeminimap2 with local minimap2-rs crate - no reason, just seems semi-logical as it seems useful for testing.