archan937/motion-bundler

Cannot define method `load:' because no Objective-C stub was pre-compiled for types `B@:^v'.

Closed this issue · 4 comments

My project's configuration

Rakefile

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/osx'

# Require and prepare Bundler
require "bundler"
Bundler.require

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'redix'
end

# Track and specify files and their mutual dependencies within the :motion Bundler group
MotionBundler.setup

Gemfile

source "http://rubygems.org"

# RubyMotion aware gems
gem "motion-bundler"

# RubyMotion unaware gems
group :motion do
  gem "redis"
end

Log

$ rake
Build ./build/MacOSX-10.8-Development
Compile ~/Code/motion/redix/.motion-bundler.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/motion-bundler-0.1.0/lib/motion-bundler/simulator/console.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/motion-bundler-0.1.0/lib/motion-bundler/simulator/core_ext.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/colorize-0.5.8/lib/colorize.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/motion-bundler-0.1.0/lib/motion-bundler/simulator/boot.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/errors.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/version.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/connection/registry.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/connection/ruby.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/socket.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/connection/command_helper.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/connection.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/cgi/cookie.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/cgi/core.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/cgi/util.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/cgi/html.rb
Compile ~/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/cgi.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/subscribe.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/pipeline.rb
Compile ~/.rvm/gems/ruby-1.9.3-p392@redix/gems/redis-3.0.4/lib/redis/client.rb
Compile ./app/menu.rb
Compile ./app/app_delegate.rb
Create ./build/MacOSX-10.8-Development/redix.app/Contents
Create ./build/MacOSX-10.8-Development/redix.app/Contents/MacOS
Link ./build/MacOSX-10.8-Development/redix.app/Contents/MacOS/redix
Create ./build/MacOSX-10.8-Development/redix.app/Contents/Info.plist
Create ./build/MacOSX-10.8-Development/redix.app/Contents/PkgInfo
Copy ./resources/Credits.rtf
Create ./build/MacOSX-10.8-Development/redix.dSYM
Run ./build/MacOSX-10.8-Development/redix.app/Contents/MacOS/redix
Cannot define method `load:' because no Objective-C stub was pre-compiled for types `B@:^v'. Make sure you properly link with the framework or library that defines this message.

A verbose log is available here

I get this for an empty OSX project that merely requires the mocked zlib library. Switching to an iOS project it works. Maybe this project is for iOS only?

I think the issue is that +load is a reserved method on the OSX runtime or something. Defining any class method named load that takes anything but 0 or 1 arguments blows up the runtime.

Including this file will reproduce:

class AnyOldClass
def self.load(var1, var2)
end
end

This is now filed as a bug in RubyMotion: http://hipbyte.myjetbrains.com/youtrack/issue/RM-161

I am very sorry for picking up this issue so very late. I have solved this problem by using *args instead of two arguments within the load override within simulator/core_ext.rb and device/core_ext.rb. See 9f2725f.

I have also released MotionBundler v0.2.0 in which the fix is included. See also https://github.com/archan937/motion-bundler/tree/master/sample_apps/osx for a working example.