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

Does libffi-sys-rs support Windows? #16

Closed
yorickpeterse opened this issue Sep 22, 2018 · 9 comments
Closed

Does libffi-sys-rs support Windows? #16

yorickpeterse opened this issue Sep 22, 2018 · 9 comments

Comments

@yorickpeterse
Copy link
Collaborator

I'm currently trying to use libffi, and I would like to support windows. When building libffi-sys on x86_64 windows (either using GNU or MSVC), the output is as follows (full build output: https://ci.appveyor.com/project/YorickPeterse/inko/build/166/job/5p9n02e84nrwu3bu):

   Compiling libffi-sys v0.6.2
error: failed to run custom build command for `libffi-sys v0.6.2`
process didn't exit successfully: `C:\projects\inko\vm\target\debug\build\libffi-sys-cdc3debe8ea09211\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Generating configure: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', libcore\result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
make: *** [Makefile:30: test] Error 101

The FFI README says the following for Windows (followed by some more notes for Windows):

It's also possible to build libffi on Windows platforms with Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so:

path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP"
For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64" and CXX="path/to/msvcc.sh -m64". You may also need to specify --build appropriately.

The build script however doesn't seem to use anything, instead it just does the following:

libffi-sys-rs/build.rs

Lines 67 to 68 in d65c185

run_command("Generating configure",
Command::new("./autogen.sh").current_dir(&build_dir));

As such my question is simple: should I do anything else (or install any other dependencies besides the one mentioned in the README), or does libffi-sys-rs need to make some changes to support Windows?

@yorickpeterse yorickpeterse changed the title Does libffi-sys-rs support windows? Does libffi-sys-rs support Windows? Sep 22, 2018
@yorickpeterse
Copy link
Collaborator Author

I suppose it's also possible that the use of ./autogen.sh instead of autogen.sh trips up Windows.

@tov
Copy link
Owner

tov commented Sep 24, 2018

Sorry for the slow response—on vacation until today. I haven't tried libffi-sys on Windows, unfortunately, and I don't know what would be required to make it work.

What happens if you remove the "./"?

@yorickpeterse
Copy link
Collaborator Author

@tov I am in the process of setting up both Mac and Windows VMs for my project, so I'll try to mess around with libffy-sys-rs to see what is necessary to make it work.

@tov
Copy link
Owner

tov commented Sep 25, 2018

Great, do let me know what you discover. Thanks!

@yorickpeterse
Copy link
Collaborator Author

@tov I'm still working towards setting up a proper Windows VM. In the mean time, would it perhaps be an option for this repository to use AppVeyor to run tests on Windows? That way we could at least continuously test windows support. If you need a sample configuration file for a Rust project on AppVeyor, you can refer to the following one: https://gitlab.com/inko-lang/inko/blob/3d15c20e3be137ee3308f6389bd3365c9836e3b8/appveyor.yml

@tov
Copy link
Owner

tov commented Oct 8, 2018

Okay, thanks for the link! I set it up and it's running for the first time now.

@timfish
Copy link
Contributor

timfish commented Dec 8, 2019

I've created an experimental msvc build (#29).

You can try it out by patching like this:

[dependencies]
libffi = "0.9.0"

[patch.crates-io]
libffi-sys = { git = "https://github.com/timfish/libffi-sys-rs.git", branch = "msvc-0.9.0" }

@tov
Copy link
Owner

tov commented Dec 29, 2019

libffi-sys 0.9.1 now supports Windows. Thanks @timfish and @yorickpeterse!

@tov tov closed this as completed Dec 29, 2019
@yorickpeterse
Copy link
Collaborator Author

@tov @timfish Thanks! I will take a look at these changes in the coming days to see how well it works.

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

No branches or pull requests

3 participants