RadiusNetworks / scanbeacon-gem

A Ruby gem for scanning beacons
MIT License
30 stars 9 forks source link

can not install scan_beacon on Mac OS X 10.10 #13

Closed wind-chh closed 9 years ago

wind-chh commented 9 years ago

admins-Mac-mini-4:~ root# gem install scan_beacon Fetching: scan_beacon-0.5.6.gem (100%) Building native extensions. This could take a while... ERROR: Error installing scan_beacon: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

creating Makefile

make "DESTDIR=" compiling core_bluetooth.m core_bluetooth.m:22:19: error: inconsistent number of instance variables specified NSMutableArray __scans; ^ core_bluetooth.m:28:3: error: use of undeclared identifier '_scans' _scans = [[NSMutableArray alloc] init]; ^ core_bluetooth.m:42:19: error: use of undeclared identifier '_scans' @synchronized(_scans) { ^ core_bluetooth.m:43:8: error: use of undeclared identifier '_scans' [_scans addObject: scan]; ^ core_bluetooth.m:53:19: error: use of undeclared identifier '_scans' @synchronized(_scans) { ^ core_bluetooth.m:54:8: error: use of undeclared identifier '_scans' [_scans addObject: scan]; ^ core_bluetooth.m:67:17: error: use of undeclared identifier '_scans' @synchronized(_scans) { ^ core_bluetooth.m:68:16: error: use of undeclared identifier '_scans' scanCopy = _scans; ^ core_bluetooth.m:69:5: error: use of undeclared identifier '_scans' scans = [[NSMutableArray alloc] init]; ^ 9 errors generated. make: ** [core_bluetooth.o] Error 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/scan_beacon-0.5.6 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/gems/scan_beacon-0.5.6/ext/core_bluetooth/gem_make.out admins-Mac-mini-4:~ root# cd /

syoder commented 9 years ago

What version of Xcode and/or the command line tools do you have?

A quick google search indicates that Xcode used to throw this error sometimes when building for 32 bit architectures (because the ObjC runtime didn't support instance variables defined in the @implementation block for 32bit architectures), but I doubt that is the issue here. If you're using a different version of the Xcode command line tools to build, I can try to use the same version here to see if I can see the issue.

syoder commented 9 years ago

I'd still be curious to know what version of the compiler you have, but I went ahead and moved that instance variable declaration into the @interface block which may solve your problem. Try gem install scan_beacon -v 0.5.7.

wind-chh commented 9 years ago

Sorry that I am a newbie for both OS X and Ruby. The 0.5.7 seems worked. Thanks in advance!

My Xcode version: Version 6.4 (6E35b) and system and compiler info:

admins-Mac-mini-4:~ root# uname -a Darwin admins-Mac-mini-4.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 admins-Mac-mini-4:~ root# admins-Mac-mini-4:~ root# gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) Target: x86_64-apple-darwin14.4.0 Thread model: posix admins-Mac-mini-4:~ root#

admins-Mac-mini-4:~ root# gem install scan_beacon -v 0.5.7 Fetching: scan_beacon-0.5.7.gem (100%) Building native extensions. This could take a while... Successfully installed scan_beacon-0.5.7 Parsing documentation for scan_beacon-0.5.7 unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/scan_beacon/bluez.bundle, skipping unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/scan_beacon/core_bluetooth.bundle, skipping Installing ri documentation for scan_beacon-0.5.7 1 gem installed admins-Mac-mini-4:~ root#

syoder commented 9 years ago

Glad it works!

Looks like the same version of Xcode as I have. Any chance you used gnu's gcc (rather than Apple's) to build Ruby on your machine? I believe that may support an older standard of Objective C.