Skip to content

Instantly share code, notes, and snippets.

@NickClark
Created March 28, 2012 16:26
Show Gist options
  • Save NickClark/2227967 to your computer and use it in GitHub Desktop.
Save NickClark/2227967 to your computer and use it in GitHub Desktop.
Trouble with ffi and multi arch lib
#console output
$ ruby lib/hitt/sdk.rb
/Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'lib/ext/libH-ITTSDK.so': dlopen(lib/ext/libH-ITTSDK.so, 5): no suitable image found. Did find: (LoadError)
lib/ext/libH-ITTSDK.so: unknown file type, first eight bytes: 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A
from /Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:88:in `map'
from /Users/nick/.rvm/gems/ruby-1.9.3-p0-perf/gems/ffi-1.0.12.rc1/lib/ffi/library.rb:88:in `ffi_lib'
from lib/hitt/sdk.rb:5:in `<module:Sdk>'
from lib/hitt/sdk.rb:3:in `<main>'
$ file lib/ext/libH-ITTSDK.so
lib/ext/libH-ITTSDK.so: Mach-O universal binary with 4 architectures
lib/ext/libH-ITTSDK.so (for architecture ppc): current ar archive random library
lib/ext/libH-ITTSDK.so (for architecture i386): current ar archive random library
lib/ext/libH-ITTSDK.so (for architecture ppc64): current ar archive random library
lib/ext/libH-ITTSDK.so (for architecture x86_64): current ar archive random library
module Hitt::Sdk
extend FFI::Library
ffi_lib 'lib/ext/libH-ITTSDK.so'
attach_function 'hitt_sdk_version', [:char, :uint], :int
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment