I'm various issues getting CocoaPods dependencies to work in RubyMotion. Firstly, if I add dependency 'JSONKit'
to my Rakefile and then run rake
it get's aborted with a can't convert Pathname into String
error. rake --trace
then produces the following output:
** Invoke default (first_time)
** Invoke simulator (first_time)
** Invoke build:simulator (first_time)
** Execute build:simulator
/usr/bin/gen_bridge_metadata --format complete --no-64-bit --cflags "-I. -I." JSONKit.h -o "JSONKit.bridgesupport"
invalid option: --no-64-bit
Usage: gen_bridge_metadata [options] <headers...>
Use the `-h' flag or consult gen_bridge_metadata(1) for help.
rake aborted!
Command failed with status (1): [/usr/bin/gen_bridge_metadata --format comp...]
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
/Library/RubyMotion/lib/motion/project/vendor.rb:93:in `block in build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:34:in `chdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:34:in `build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:23:in `build'
/Library/RubyMotion/lib/motion/project/builder.rb:37:in `block in build'
/Library/RubyMotion/lib/motion/project/builder.rb:36:in `each'
/Library/RubyMotion/lib/motion/project/builder.rb:36:in `build'
/Library/RubyMotion/lib/motion/project/app.rb:50:in `build'
/Library/RubyMotion/lib/motion/project.rb:33:in `block (2 levels) in <top (required)>'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/Users/xxxx/.rbenv/versions/1.9.3-p194/bin/rake:32:in `<main>'
Tasks: TOP => default => simulator => build:simulator
The vendor directory in the project contains various JSONKit files.
Secondly, in another RubyMotion app, if I add dependency 'Nimbus'
to my Rakefile and then run rake
the app builds but errors out with uninitialized constant errors when I try to use anything Nimbus-related in my code and no vendor directory is created.
What is the problem in these two instances?
There are a couple issues at play here.
can't convert Pathname into String
Update: As of 5/7/12, you can just sudo motion update
and this will be fixed
This error has to do with the fact that you're using Ruby 1.9. Though I don't see it explicitly stated in the documentation, the fact that the examples of setting this up refer to using sudo
in the gem install
commands means it's assumed you're running OS X's built-in ruby (1.8.7). If you switch your project to system ruby (add a .rbenv-version
file with system
in it). Alternatively, if you want to stick with 1.9, you can change line 22 of /Library/RubyMotion/lib/motion/project/vendor.rb
to read:
App.info 'Build', @path.to_s
Once doing this, there's a good chance you'll then get an error like this:
ERROR! Building vendor project `./vendor/JSONKit' failed to create at least one `.a' library.`
You'll need to edit line 77 of that same file to read:
objs = Dir.glob('**/*.o') # Removed the leading "*/"
Then rake
should finally work properly.
An issue has been filed on the motion-cocoapods
repo regarding these issues: https://github.com/HipByte/motion-cocoapods/issues/1
Additionally, I just filed an official support ticket for this using motion support
. (Remember, you paid money for this brand new product which includes support; use it!)
Nimbus
The problem here is that you're requiring the top-level cocoapod. Since it has "subspecs", you need to require those directly, so maybe dependency 'Nimbus/Core'
instead. You can see a full list of them here (see the s.subspec
entries)