Skip to content
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

Better cross compilation support #53

Merged
merged 4 commits into from
Mar 7, 2022
Merged

Better cross compilation support #53

merged 4 commits into from
Mar 7, 2022

Conversation

messense
Copy link
Contributor

@messense messense commented Mar 4, 2022

Originally I want to use autotools-rs, but it doesn't support Rust 1.36.0.

This enables building with cargo-zigbuild:

cargo zigbuild --target x86_64-unknown-linux-gnu

libffi-sys-rs/build/not_msvc.rs Outdated Show resolved Hide resolved
libffi-sys-rs/build/not_msvc.rs Outdated Show resolved Hide resolved
libffi-sys-rs/build/not_msvc.rs Show resolved Hide resolved
libffi-sys-rs/Cargo.toml Outdated Show resolved Hide resolved
libffi-sys-rs/build/not_msvc.rs Show resolved Hide resolved
@yorickpeterse
Copy link
Collaborator

Windows GNU builds are failing with the following error:

  = note: D:\a\libffi-rs\libffi-rs\target\debug\build\libffi-sys-5c1d0e050ef2f003\out\libffi-root\lib\libffi.a(closures.o): In function `internal_malloc_stats':
          D:\a\libffi-rs\libffi-rs\target\debug\build\libffi-sys-5c1d0e050ef2f003\out\libffi-build\x86_64-pc-windows-gnu/../src/dlmalloc.c:2951: undefined reference to `__imp___acrt_iob_func'
          D:\a\libffi-rs\libffi-rs\target\debug\build\libffi-sys-5c1d0e050ef2f003\out\libffi-build\x86_64-pc-windows-gnu/../src/dlmalloc.c:2952: undefined reference to `__imp___acrt_iob_func'
          D:\a\libffi-rs\libffi-rs\target\debug\build\libffi-sys-5c1d0e050ef2f003\out\libffi-build\x86_64-pc-windows-gnu/../src/dlmalloc.c:2953: undefined reference to `__imp___acrt_iob_func'

I'm guessing some compile options may be missing?

@messense
Copy link
Contributor Author

messense commented Mar 6, 2022

x86_64-pc-windows-gnu test only fails on Rust 1.36.0, kinda odd, I'm not sure why.

Here is a related stackoverflow post: https://stackoverflow.com/questions/62804616/cross-compiling-from-linux-windows-stdio-has-undefined-references-to-imp-a

@yorickpeterse
Copy link
Collaborator

@messense Past builds/PRs worked just fine though, so this is the result of something that the cc crate is doing. Since Rust 1.36 is ancient at this point I'm fine with bumping the minimum version (e.g. to 1.48 as Debian stable seems to still be using that), but not if newer versions of Rust are also failing. Could you check to see how newer versions are doing? Thanks!

@messense
Copy link
Contributor Author

messense commented Mar 7, 2022

@messense
Copy link
Contributor Author

messense commented Mar 7, 2022

rust-lang/rust#67429 might be related, it was released in Rust 1.43.0.

@yorickpeterse yorickpeterse merged commit b556763 into tov:master Mar 7, 2022
@yorickpeterse
Copy link
Collaborator

@messense Thanks! This has been released in libffi-sys 2.0 and libffi-rs 3.0 🎉

@messense messense deleted the target-cc branch March 7, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants