Projects

Ticket #281 (closed defect: fixed)

Opened 3 years ago

Last modified 14 months ago

Bundles pointing to local MacRuby installation instead of embedded

Reported by: reborg@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.8
Component: MacRuby Keywords: embedded,deploy,installation,distribution
Cc: miskomartinka@…

Description

After embedding the MacRuby framework with 'macrake deploy' is not possible to distribute the application to computers without MacRuby installed if the application uses native bundles.

Try this: - hotcocoa test; cd test - macrake deploy - otool -L Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle

The last command gives an absolute reference to libmacruby.dylib: Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle:

/Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/libmacruby.dylib (compatibility version 0.4.0, current version 0.4.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)

Another test: - open lib/application.rb and require 'stringio' at the top - save and close, macrake clean; macrake deploy - move the MacRuby installation dir in /Library/Frameworks to another name - run the app

This is the output from the console:

6/7/09 5:08:47 PM [0x0-0xdb8db8].com.yourcompany.Test[54737] /Users/reborg/tmp/test/Test.app/Contents/Resources/lib/application.rb:1:in `require': dlopen(/Users/reborg/tmp/test/Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle, 9): Library not loaded: /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/libmacruby.dylib (LoadError) 6/7/09 5:08:47 PM [0x0-0xdb8db8].com.yourcompany.Test[54737] Referenced from: /Users/reborg/tmp/test/Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle 6/7/09 5:08:47 PM [0x0-0xdb8db8].com.yourcompany.Test[54737] Reason: image not found - /Users/reborg/tmp/test/Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle 6/7/09 5:08:47 PM [0x0-0xdb8db8].com.yourcompany.Test[54737] from /Users/reborg/tmp/test/Test.app/Contents/Resources/lib/application.rb:1:in `<top (required)>' 6/7/09 5:08:47 PM [0x0-0xdb8db8].com.yourcompany.Test[54737] from /Users/reborg/tmp/test/Test.app/Contents/Resources/rb_main.rb:3:in `load'

Attachments

testerror.crash Download (10.2 KB) - added by miskomartinka@… 19 months ago.

Change History

Changed 3 years ago by lsansonetti@…

As a work-around, the install_name_tool(1) tool can be run on every .bundle, to change the absolute path into a relative path to the executable.

Changed 3 years ago by reborg@…

Thanks Laurent for the hint, I got it working with:

cd <YourApp.app>/Contents
install_name_tool -change /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/libmacruby.dylib @executable_path/../Frameworks/MacRuby.framework/Versions/0.4/usr/lib/libmacruby.dylib Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/<BundleName>.bundle

where BundleName in my case were socket, fcntl, stringio, syck. I'm going to rake this on all .bundle(s) as part of the deploy build along with a clean-up of unnecessary MacRuby files (for distribution).

Renzo

Changed 2 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.6

I believe this problem has been fixed as of 0.5. Recently in trunk, we also fixed the install name of .rbo files in r3434. So, I'm closing this ticket, please let me know if it's still a problem for you and I will re-investigate.

Changed 19 months ago by miskomartinka@…

  • status changed from closed to reopened
  • resolution fixed deleted

Hello guys, great work here with macruby/hotcocoa, thank you!

I am still experiencing this issue. I installed MacRuby 0.6 on my Snow Leopard. Then installed hotcocoa with: sudo macgem install hotcocoa. Installed version of hotcocoa is 0.5.1. Then I did: hotcocoa test ls test macrake

this works fine then I did

macrake deploy

took a while and big app package is build. when I run it it works ok. But if I run it on computer which doesn't have MacRuby installed it crashes. Also happens when I delete/move /Library/Frameworks/MacRuby.framework on my mac I got this error in console:

30/7/10 9:01:33 PM [0x0-0xf10f1].com.yourcompany.Test[4050] /Users/michal/Code/test/Test.app/Contents/Resources/lib/application.rb:1:in `<main>': dlopen(/Users/michal/Code/test/Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/rubygems.rbo, 9): Library not loaded: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/libmacruby.dylib 30/7/10 9:01:33 PM [0x0-0xf10f1].com.yourcompany.Test[4050] Reason: image not found - /Users/michal/Code/test/Test.app/Contents/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/rubygems.rbo (LoadError)

I also tried to do install_name_tool solution suggested above but it didn't help. Btw. if I create macruby app in xcode(not using cocoa) it works and build it with Embed target it works OK(also with options like --no-stdlib, --compile)

Changed 19 months ago by miskomartinka@…

  • cc miskomartinka@… added

Cc Me!

Changed 19 months ago by miskomartinka@…

Changed 19 months ago by miskomartinka@…

Based on error in console I thought that rubygems.rbo is trying to load libmacruby.dylib not from app package but from installed framework(which is not installed) so I tried to changed rubygems.rbo with this command

install_name_tool -change /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/libmacruby.dylib /Users/michal/Code/test/Test.app/MacOS/../Frameworks/MacRuby.framework/Versions/0.6/usr/lib/libmacruby.dylib Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/rubygems.rbo

but it didn't help. I now get different error which you can see in attached file testerror.crash

Changed 19 months ago by miskomartinka@…

Sorry, typo above. this is command I ran to modify rubygems.rbo

install_name_tool -change /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/libmacruby.dylib @executable_path/../Frameworks/MacRuby.framework/Versions/0.6/usr/lib/libmacruby.dylib Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/rubygems.rbo

of course before I did cd Test.app/Contents

Changed 14 months ago by isaackearse@…

I suspect this is more related to hotcocoa than macruby - I'm pretty sure it was fixed when the ticket was closed last time.

Changed 14 months ago by lsansonetti@…

  • status changed from reopened to closed
  • resolution set to fixed
  • milestone changed from MacRuby 0.6 to MacRuby 0.8

I believe this bug has been fixed since at least 2 releases. Please try again and let us know.

Note: See TracTickets for help on using tickets.