d-unsed / ruru

Native Ruby extensions written in Rust
MIT License
832 stars 40 forks source link

MS Windows support #65

Open Zapotek opened 7 years ago

Zapotek commented 7 years ago

Does Ruru support MS Windows?

I'm trying with RubyInstaller 2.3.0 and Rust nightly but keep getting link errors with cargo build --release.

At first the file x64-msvcrt-ruby230.lib is not found, but I figured it to mean that it's looking for either libx64-msvcrt-ruby230-static.a or libx64-msvcrt-ruby230.dll.a, although still no luck when renaming either to x64-msvcrt-ruby230.lib.

Zapotek commented 7 years ago

I found the missing file at: https://github.com/gosu/gosu/tree/master/dependencies/msvcrt-ruby

Zapotek commented 7 years ago

Re-opening because even though I managed to compile, I immediately get a segfault when calling the initialize methods via:

Fiddle::Function.new( library['initialize'], [], Fiddle::TYPE_VOIDP ).call

Using Windows 10, same Ruby and Rust version as before.

Zapotek commented 7 years ago

I've narrowed it down to Ruru. Loading Rust libs via FFI is working fine, but the moment Ruru gets involved the process segfaults.

Even with simple stuff like:

Class::from_existing( "String" )

Update: Segfaults with Rust stable as well.

d-unsed commented 7 years ago

Hi @Zapotek! Right now I don't have any Windows computer to reproduce and fix the issue. I will let you know when I find it

Zapotek commented 7 years ago

Windows 10 doesn't need a product key to install and it will be functional enough to debug this and it's pretty easy to setup a VM for free with VirtualBox. I'm not in any hurry for this but it will be pretty important to me in the long run and probably to others too. If you need any help with this let me know.

d-unsed commented 6 years ago

Sorry that it took time to come back to this issue. One thing I've just realized is that there should not be some Windows-specific problems, at least with such simple things like Class::from_existing("String"). Since we have a test suite which is on Windows as well using AppVeyor CI, it would indicate that there are some problems on the platform.

I've faced weird segfault issues before, when a native extension was built against one version of ruby, let's say 2.2.0, but it was used with some other one like 2.3.0. The app crashed with segfault during the very first call to the ruby VM. It was related to rbenv misconfiguration for the directory where the extension was build and the directory where it was used. Could you please check if this is not an issue in your case?

Zapotek commented 6 years ago

I removed all Ruby versions and rebuilt but I still got the same behavior.

danielpclark commented 6 years ago

Hey @Zapotek, which shell are you using on Windows 10? Have you tried it with Bash on the Linux subsystem on Windows 10?

Zapotek commented 6 years ago

@danielpclark Regular shell. You mean building the extension or running my entire system there? Because the latter isn't really a solution for native MS Windows support.

d-unsed commented 6 years ago

@Zapotek, which version of Ruby is used on the machine? And how was it installed there?

Zapotek commented 6 years ago

@d-unseductable Ruby 2.4.2p189 using RubyInstaller.