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

Windows: bundled ffi_c.so is generating invalid memory access #182

Closed
luislavena opened this issue Nov 23, 2011 · 21 comments
Closed

Windows: bundled ffi_c.so is generating invalid memory access #182

luislavena opened this issue Nov 23, 2011 · 21 comments
Assignees
Labels

Comments

@luislavena
Copy link
Contributor

C:\Users\Luis\Desktop>irb
irb(main):001:0> require "1.9/ffi_c"
LoadError: 998: Se realizó un acceso no válido a la ubicación de memoria.   - C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.11-x86-mingw32/lib/1.9/ffi_c.so
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
        from (irb):1
        from C:/Ruby193/bin/irb:12:in `<main>'
@ghost
Copy link

ghost commented Nov 23, 2011

So, should I yank the mingw binary builds?

If it isn't working on 1.9.x, then having broken binaries is worse than having people build from source, correct?

@luislavena
Copy link
Contributor Author

Correct, please yank them and I'll investigate further.

Sorry for top posting. Sent from mobile.
On Nov 23, 2011 7:08 PM, "Wayne Meissner" <
reply@reply.github.com>
wrote:

So, should I yank the mingw binary builds?

If it isn't working on 1.9.x, then having broken binaries is worse than
having people build from source, correct?


Reply to this email directly or view it on GitHub:
#182 (comment)

@ghost
Copy link

ghost commented Nov 24, 2011

Ok, the mingw32 build is yanked.

@luislavena
Copy link
Contributor Author

@wmeissner would you mind share with me your current mingw installation version (i?86-*-mingw32-gcc --version) and also the versions of Ruby you used to build the 1.9 version? (a snapshot of ~/.rake-compiler/config.yml will do)

@ghost
Copy link

ghost commented Dec 9, 2011

$ i386-mingw32-gcc --version
i386-mingw32-gcc (GCC) 3.4.5 (mingw-vista special r2)
$ cat ~/.rake-compiler/config.yml 
--- 
rbconfig-1.8.7: /Users/wayne/.rake-compiler/ruby/ruby-1.8.7-p334/lib/ruby/1.8/i386-mingw32/rbconfig.rb
rbconfig-1.9.2: /Users/wayne/.rake-compiler/ruby/ruby-1.9.2-p0/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb

@luislavena
Copy link
Contributor Author

Hello @wmeissner, I'll be emailing you offline about this, I'm not able to replicate corrupt binaries so I think something borked in your setup.

@larskanis
Copy link
Member

Any progress about this issue? Since one of my gems (libusb) depends on ffi, it would be great, if a precompiled ffi.gem would be available again.

Equally to @luislavena, I'm also unable to reproduce the segv, when using a cross compiled binary gem. My compilation environment is:

$ cat ~/.rake-compiler/config.yml 
---
rbconfig-1.8.7: /home/likewise-open/COMCARD-NT/kanis/.rake-compiler/ruby/ruby-1.8.7-p352/lib/ruby/1.8/i386-mingw32/rbconfig.rb
rbconfig-1.9.2: /home/likewise-open/COMCARD-NT/kanis/.rake-compiler/ruby/ruby-1.9.2-p290/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb

$ i586-mingw32msvc-gcc --version
i586-mingw32msvc-gcc (GCC) 4.4.4

$ uname -a
Linux c1170lx 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

@ghost
Copy link

ghost commented Apr 2, 2012

Anyone who is still interested, please test the latest win32 build (https://rubygems.org/gems/ffi/versions/1.0.12.rc2-x86-mingw32). That is built using the toolchain recommended by the rake-compiler docs, so hopefully works.

@luislavena
Copy link
Contributor Author

Hello @wmeissner I think there is a problem with the gem you packaged:

C:\Users\Luis>gem install ffi --pre
Fetching: ffi-1.0.12.rc2-x86-mingw32.gem (100%)
Successfully installed ffi-1.0.12.rc2-x86-mingw32
1 gem installed

C:\Users\Luis>irb
irb(main):001:0> require "rubygems"
=> false
irb(main):002:0> require "ffi"
LoadError: cannot load such file -- ffi_c
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.12.rc2-x86-mingw32/lib/ffi.rb:11:in `rescue in <top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.12.rc2-x86-mingw32/lib/ffi.rb:2:in `<top (required)>'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
        from (irb):2
        from C:/Ruby193/bin/irb:12:in `<main>'

It is missing 1.9 binaries, which seems to because the compilation only targeted Ruby 1.8.x

Did you set RUBY_CC_VERSION=1.8.7:1.9.3 when cross compiling? Did you install also Ruby 1.9.3 with rake-compiler cross-ruby VERSION=1.9.3-p125 ?

@luislavena
Copy link
Contributor Author

Forgot to mention, but I did email you @wmeissner offline and never got an answer from you 😢

@ghost
Copy link

ghost commented Apr 3, 2012

Ok, I installed 1.9.3-p125, and pushed a new gem. 1.0.12.rc3 should have both 1.8 and 1.9 .so in it.

@luislavena
Copy link
Contributor Author

@wmeissner seems to have worked:

C:\Users\Luis>gem install ffi --pre
Fetching: ffi-1.0.12.rc3-x86-mingw32.gem (100%)
Successfully installed ffi-1.0.12.rc3-x86-mingw32
1 gem installed

C:\Users\Luis>irb
irb(main):001:0> require "rubygems"
=> false
irb(main):002:0> require "ffi"
=> true
irb(main):003:0> $LOADED_FEATURES.find { |f| f =~ /ffi/ }
=> "C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.12.rc3-x86-mingw32/lib/1.9/ffi_c.so"

@ghost
Copy link

ghost commented Apr 5, 2012

Thanks @luislavena!

If you have time, can you also confirm that everything builds fine using the devkit?

@luislavena
Copy link
Contributor Author

@wmeissner not so great:

https://gist.github.com/2306961

@luislavena
Copy link
Contributor Author

@wmeissner sorry, was sick the past couple of days (and still I am). Will take a look over the weekend.

@ghost
Copy link

ghost commented Apr 5, 2012

No problem, @luislavena, you've already gone above and beyond!

I think I fixed the devkit build problem - it also affected linux/macos with no libffi installed, and was due to the libffi-3.0.10 import ... it seems to do strange things when built in its own source tree, so that part of the build is always built in libffi-$(arch), and it seems to fix the problem.

@luislavena
Copy link
Contributor Author

@wmeissner seems what you pushed for 1.1.0.rc2 worked:

C:\Users\Luis>gem install ffi --pre --platform=ruby
Fetching: ffi-1.1.0.rc2.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed ffi-1.1.0.rc2
1 gem installed

@larskanis
Copy link
Member

I tested ffi-1.1.0.rc3 with libusb-0.1.3 using devkit and precompiled binary gems and the Ruby versions:

  • ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
  • ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

and all combinations worked as expected. Thanks!

@ghost
Copy link

ghost commented Apr 30, 2012

Thanks @larskanis and @luislavena for testing this out.

@larskanis
Copy link
Member

Hello @wmeissner ,

this issue is obviously solved, since the ffi-1.1.0-x86-mingw32.gem is working on ruby-installer 1.8.7 and 1.9.3.

@luislavena
Copy link
Contributor Author

@larskanis thanks for confirming this.

Closing this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants