mvz / gir_ffi-gtk

GirFFI-based bindings for Gtk+. Supports both Gtk+ 2 and Gtk+ 3
GNU Lesser General Public License v2.1
19 stars 7 forks source link

Crash when running on Mac #2

Closed kaspernj closed 8 years ago

kaspernj commented 12 years ago

port install gtk3 brew install gobject-introspection

Then in Ruby:

require "gir_ffi-gtk3"

Got the following:

Kasper-Johansens-MacBook-Air:GirFFITest kaspernj$ ruby start.rb This platform and/or version of gobject-introspection are not supported by GirFFI. Please file bugs for any errors found. /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/ffi-gobject_introspection/i_repository.rb:81:in require': Typelib file for namespace 'Gtk', version '3.0' not found (RuntimeError) from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi/builder/module.rb:135:ingir' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi/builder/module.rb:75:in build_dependencies' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi/builder/module.rb:48:inbuild_module' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi/builder/module.rb:20:in generate' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi/builder.rb:27:inbuild_module' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-0.4.0/lib/gir_ffi.rb:14:in setup' from /Users/kaspernj/.rvm/gems/ruby-1.9.2-head/gems/gir_ffi-gtk-0.4.0/lib/gir_ffi-gtk3.rb:3:in<top (required)>' from /Users/kaspernj/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in require' from /Users/kaspernj/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:inrescue in require' from /Users/kaspernj/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in require' from start.rb:4:in

'

Same error with Gtk2. I am willing to give access to my machine by using VNC or something else, if that can help.

mvz commented 12 years ago

Hi Kasper,

For some reason gobject-introspection cannot find the introspection data for Gtk. I'm not too familliar with these package managers, but perhaps using 'port' to install gtk3, and then 'brew' to install gobject-introspection has something to do with this. Can you try installing both with the same package manager?

kaspernj commented 12 years ago

For some reason, it looks like the "gobject-introspection" from port is Python-specific and the "gtk+3"-package from brew compiles it with introspection disabled (dont really understand why, but the configure-files are specifically set to disable it).

Can you give me a hint of which files it is looking for? It may be a problem with linking (brew works by making a custom-path install and then linking files).

mvz commented 12 years ago

It's looking for a file called Gtk-3.0.typelib, which on GNU/Linux is located in /usr/lib/girepository-1.0/.

kaspernj commented 12 years ago

I got it working! Had to hack it a bit with various symlinks though, because "port" installs in "/opt/local/lib". It is possible to make it look in "/opt/local/lib" to make it compatible with "port" by default?

Here are the commands I used:

sudo port install gtk3 sudo port install gobject-introspection

cd /usr/lib sudo ln -s /opt/local/lib/girepository-1.0 sudo ln -s /opt/local/lib/libgirepository-1.0.dylib sudo ln -s /opt/local/lib/libgobject-2.0.dylib

Be aware the "brew" corrupts the install, so you will have to uninstall various packages from "brew" like "gtk+3", "gobject-introspection", "atk" and so on.

mvz commented 12 years ago

Is the first ln -s still necessary now that you use port for both gtk3 and gobject-introspection?

Also, how was Ruby installed? The ffi gem should be able to find libgirepository-1.0.dylib and libgobject-2.0.dylib by itself, without the softlinks.