Projects

Ticket #48 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

inline functions not available from MacRuby (Foundation.h et cetera)

Reported by: apparently@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 0.2
Component: MacRuby Keywords:
Cc:

Description

sounds as though the dylibs which contain inline functions were not built with GC enabled, MacRuby requiring GC so dlopen'ing them fails - bummer.

(in macirb)

>> framework 'Cocoa'
# => true  

>> r = NSRect.new(NSPoint.new(0,0), NSSize.new(10,10))
# => #<NSRect origin=#<NSPoint x=0.0 y=0.0> size=#<NSSize width=10.0 height=10.0>>  

>> NSRectToCGRect(r)
(irb):3: [BUG] cannot locate symbol for bridgesupport function `NSRectToCGRect'
MacRuby version 0.2 (ruby 1.9.0 2008-03-01) [universal-darwin9.0]

-- control frame ----------
c:0024 p:---- s:0074 b:0074 l:000073 d:000073 CFUNC  :NSRectToCGRect
c:0023 p:0010 s:0070 b:0070 l:000204 d:000069 EVAL   (irb):3
c:0022 p:---- s:0069 b:0069 l:000068 d:000068 FINISH :empty?
c:0021 p:---- s:0067 b:0067 l:000066 d:000066 CFUNC  :eval
c:0020 p:0023 s:0060 b:0060 l:000059 d:000059 METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb/workspace.rb:80
c:0019 p:0025 s:0053 b:0052 l:000051 d:000051 METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb/context.rb:218
c:0018 p:0024 s:0047 b:0047 l:001dc4 d:000046 BLOCK  /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:149
c:0017 p:0025 s:0040 b:0040 l:000039 d:000039 METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:262
c:0016 p:0009 s:0035 b:0035 l:001dc4 d:000034 BLOCK  /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:146
c:0015 p:0093 s:0032 b:0032 l:000021 d:000031 BLOCK  /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb/ruby-lex.rb:243
c:0014 p:---- s:0032 b:0032 l:000031 d:000031 FINISH :block_given?
c:0013 p:---- s:0030 b:0030 l:000029 d:000029 CFUNC  :loop
c:0012 p:0007 s:0027 b:0027 l:000021 d:000026 BLOCK  /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb/ruby-lex.rb:230
c:0011 p:---- s:0028 b:0028 l:000027 d:000027 FINISH :each
c:0010 p:---- s:0026 b:0026 l:000025 d:000025 CFUNC  :catch
c:0009 p:0017 s:0022 b:0022 l:000021 d:000021 METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb/ruby-lex.rb:229
c:0008 p:0034 s:0019 b:0019 l:001dc4 d:001dc4 METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:145
c:0007 p:0009 s:0016 b:0016 l:001cec d:000015 BLOCK  /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:69
c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH :(null)
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
c:0004 p:0152 s:0011 b:0011 l:001cec d:001cec METHOD /Library/Frameworks/MacRuby.framework/Versions/0.2/usr/lib/ruby/1.9.0/irb.rb:68
c:0003 p:0033 s:0006 b:0006 l:000005 d:000005 TOP    /usr/local/bin/macirb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    

[lots more output…]

possible workaround would be to regenerate the dylibs with GC enabled.

Change History

Changed 4 years ago by apparently@…

until MacRuby can support the default, non-GC dylib, one can regenerate the Foundation dylib using the GC switch CFLAG, moving the system version aside - seems to do the trick.

% gen_bridge_metadata -f /System/Library/Frameworks/Foundation.framework -F dylib -o ~/Desktop/Foundation.dylib -c -fobjc-gc

Changed 4 years ago by apparently@…

and remove the #if block on line 2159 in load_bridge_support() of objc.m in MacRuby.

Changed 4 years ago by apparently@…

unfortunately this trick doesn't appear to work for the CoreGraphics dylib (CGPointMake, CGRectMake, CGSizeMake - likely everything in CGGeometry.h), generating the dylib blows up with missing CG headers - perhaps because it is in an umbrella framework a slightly different command is needed?

also, and perhaps more importantly, while i can use inline functions defined in NSGeometry after regenerating the dylib in macirb, i cannot from my MacRuby applications which result in the same backtrace, even after a full clean.

Changed 4 years ago by lsansonetti@…

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

Fixed in #240. We are now marking all /S/L/F dylibs for GC, at build time (during make install).

Note: See TracTickets for help on using tickets.