I am working on a C extension for ruby, but I need to include headers from the IOBluetooth
framework, specifically:
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
#import <IOBluetooth/IOBluetoothUserLib.h>
Everything compiles fine, but at runtime, the extension errors:
path/to/file.rb:1:in `require_relative': dlopen(/path/to/extension.bundle, 9):
Symbol not found: _OBJC_CLASS_$_IOBluetoothDeviceInquiry (LoadError)
I am fairly sure this has something to do with the framework not being included in the linking process, but I'm not sure why. Any help would be greatly appreciated
extconf.rb
:
# Loads mkmf which is used to make makefiles for Ruby extensions
require 'mkmf'
# Give it a name
extension_name = 'bluetooth'
dir_config(extension_name)
create_makefile(extension_name, 'bluetooth')
Generated MakeFile: http://paste.wilhall.com/25
UPDATE: I modified the Makefile so that the library statically links; still experiencing the same error, but this time when linking.
Oddly, have_header
in my extconf.rb
file finds these header files fine.
UPDATE: I have pulled the following from the system log files:
Process: ruby [951]
Path: /usr/local/bin/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: bash [468]
User ID: 501
Date/Time: 2012-10-17 14:06:57.425 -0400
OS Version: Mac OS X 10.8.1 (12B19)
Report Version: 10
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010
If I remember correctly, EXC_BAD_ACCESS (SIGABRT)
is often related to a GC issue? Will look into it and post results