RubyCocoa 0.4.0 path [?] Issue

Any Mac OS X/Ruby users out there?

Okay…I like the command line but I’m itching for a GUI.

I’m using Mac OS X 10.2.6 and Ruby 1.6.8 (compiled from source). I just
compiled RubyCocoa 0.4.0 from source and even though I applied the
patch to take care of the Segmentation Fault problem, there still seems
to be a greater problem with RubyCocoa finding individual bundles. For
example, the test suite quits with:

[me@computer:~/Desktop/rubycocoa-0.4.0/tests]$DYLD_FRAMEWORK_PATH=/
Users/stephyn/Desktop/rubycocoa-0.4.0/framework/build r
uby -I…/lib testall.rb
…/lib/osx/cocoa.rb:12:in require': No such file to load -- osx/objc/cocoa (LoadError) from ../lib/osx/cocoa.rb:12 from ./tc_nsattributedstring.rb:12:inrequire’
from ./tc_nsattributedstring.rb:12
from testall.rb:4:in require' from testall.rb:4 from testall.rb:3:ineach’
from testall.rb:3
Loaded suite testall
Started

Finished in 0.002562 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

Similarly, attempting to run any other of the sample scripts fails with
similar results. Generally, anything osx/? can’t be found. For example,

[me@computer:/Developer/Examples/RubyCocoa]$ruby sndplay.rb
/usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12:in require': No such file to load -- osx/objc/cocoa (LoadError) from /usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12 from sndplay.rb:1:inrequire’
from sndplay.rb:1

This seems to be a known issue. I was curious if anyone had found a
fix. I’m also posting to rubycocoa-talk but there doesn’t seem to be
much traffic on that list.

Thanks in advance.
Steve

You should check the following:

a0 = $:.dup
require ‘rubycocoa’
p $: - a0

The file “osx/objc/cocoa.rb” should exist in the result directory.

I guess that rubycocoa.bundle or RubyCocoa.framework is broken,
because “ruby install.rb setup” has failed. If so, I don’t know
why it failed. Did you check an error of the log when setup-phase?

regards,

···

At Fri, 11 Jul 2003 13:03:50 +0900, Stephyn Butcher wrote:

Similarly, attempting to run any other of the sample scripts fails with
similar results. Generally, anything osx/? can’t be found. For example,

[me@computer:/Developer/Examples/RubyCocoa]$ruby sndplay.rb
/usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12:in require': No such file to load -- osx/objc/cocoa (LoadError) from /usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12 from sndplay.rb:1:in require’
from sndplay.rb:1


FUJIMTO Hisakuni

Thank you for your reply.

There are details below of some experiments I ran this morning. I’m
still not having any luck. If you wish, I can send you more detailed
output directly.

Similarly, attempting to run any other of the sample scripts fails
with
similar results. Generally, anything osx/? can’t be found. For
example,

[me@computer:/Developer/Examples/RubyCocoa]$ruby sndplay.rb
/usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12:in require': No such file to load -- osx/objc/cocoa (LoadError) from /usr/local/lib/ruby/site_ruby/1.6/osx/cocoa.rb:12 from sndplay.rb:1:in require’
from sndplay.rb:1

You should check the following:

a0 = $:.dup
require ‘rubycocoa’
p $: - a0

The file “osx/objc/cocoa.rb” should exist in the result directory.

This is an empty array.

I guess that rubycocoa.bundle or RubyCocoa.framework is broken,
because “ruby install.rb setup” has failed. If so, I don’t know
why it failed. Did you check an error of the log when setup-phase?

Is there a specific error log file somewhere or will there only be an
error message on the console that the build failed or that some other
error occurred?

I was able to run SimpleApp.app as described but I don’t know if this
is means everything else compiled or installed properly.

After looking at the directions for 1.6.7/1.8.0p3 installations, I
realized that I probably did not have the right options RubyCocoa set
when I build 1.6.8 so I re-built libruby.a following the directions for
1.6.7. This was successful.

$ rbhost=ruby -r rbconfig -e "print Config::CONFIG['host']"
$ CFLAGS=‘-g -O2 -fno-common’ ./configure --prefix=/usr --host=$rbhost
$ make
$ make test
$ ranlib libruby.a
$ rubyarchdir=ruby -r rbconfig -e 'print Config::CONFIG["archdir"]'
$ sudo install -m 0644 libruby.a $rubyarchdir

Next, following the instructions, I made RubyCocoa. First with:

$ ruby install.rb config

There was no error reported. Next:

$ ruby install.rb setup

There was an error reported at this point that I did not see last night
and was unexpected given that I ran ranlib on libruby.a above.

DynamicLibrary.LinkUsingFileList
/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build/
RubyCocoa.framework/Versions/A/RubyCocoa
/usr/bin/gcc3 -o
/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build/
RubyCocoa.framework/Versions/A/RubyCocoa
“-L/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build”
“-L/usr/local/lib/ruby/1.6/powerpc-darwin6.6”
“-F/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build”
-filelist
/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build/
RubyCocoa.build/RubyCocoa.build/Objects-normal/LinkFileList
“-framework” “Cocoa” “-lruby” “-arch” “ppc” “-Wl,-single_module”
“-dynamiclib” “-compatibility_version” “1” “-current_version” “1”
“-undefined” “suppress” “-flat_namespace” -install_name “echo "/Library/Frameworks/RubyCocoa.framework/Versions/A/RubyCocoa" | /usr/bin/sed 's!//*!/!g'
ld: table of contents for archive:
/usr/local/lib/ruby/1.6/powerpc-darwin6.6/libruby.a is out of date;
rerun ranlib(1) (can’t load from it)
/usr/bin/libtool: internal link edit command failed
…failed DynamicLibrary.LinkUsingFileList
/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/framework/build/
RubyCocoa.framework/Versions/A/RubyCocoa …
** BUILD FAILED **
setup failed
‘system pbxbuild’ failed
try ‘ruby install.rb --help’ for usage
$ sudo ranlib /usr/local/lib/ruby/1.6/powerpc-darwin6.6/libruby.a
Password:
$

Worked so I ran setup again:

$ruby install.rb setup

And the result was:

[snip]
** BUILD SUCCEEDED **
<— framework
—> lib
—> lib/osx
<— lib/osx
<— lib
—> ext
—> ext/rubycocoa
make
gcc -fno-common -g -O2 -pipe -F…/…/framework/build -framework
RubyCocoa -I. -I/usr/local/lib/ruby/1.6/powerpc-darwin6.6
-I/Users/stephyn/Documents/ruby/rubycocoa-0.4.0/ext/rubycocoa -c -o
rubycocoa.o rubycocoa.m
gcc: -framework: linker input file unused because linking not done
gcc: RubyCocoa: linker input file unused because linking not done
cc -dynamic -bundle -undefined suppress -flat_namespace
-L/usr/local/lib/ruby/1.6/powerpc-darwin6.6 -L/usr/local/lib
-F…/…/framework/build -framework RubyCocoa -o rubycocoa.bundle
rubycocoa.o -lobjc
ld: warning dynamic shared library: /usr/lib/libobjc.dylib not made a
weak library in output with MACOSX_DEPLOYMENT_TARGET environment
variable set to: 10.1
ld: warning dynamic shared library: /usr/lib/libSystem.dylib not made a
weak library in output with MACOSX_DEPLOYMENT_TARGET environment
variable set to: 10.1
<— ext/rubycocoa
<— ext
install.rb: setup done.
[stephyn@kosmo:~/Documents/ruby/rubycocoa-0.4.0]$

I don’t remember this error from before, either the linking error
(which should be better highlighted) or the 10.1 warning:

“gcc: -framework: linker input file unused because linking not done
gcc: RubyCocoa: linker input file unused because linking not done
cc -dynamic -bundle -undefined suppress -flat_namespace
-L/usr/local/lib/ruby/1.6/powerpc-darwin6.6 -L/usr/local/lib
-F…/…/framework/build -framework RubyCocoa -o rubycocoa.bundle
rubycocoa.o -lobjc
ld: warning dynamic shared library: /usr/lib/libobjc.dylib not made a
weak library in output with MACOSX_DEPLOYMENT_TARGET environment
variable set to: 10.1
ld: warning dynamic shared library: /usr/lib/libSystem.dylib not made a
weak library in output with MACOSX_DEPLOYMENT_TARGET environment
variable set to: 10.1”

but it is a known bug in the December 2002 Development Tools Release
and interferes with a number of other Ruby compilations (namely, eruby).

So I tried:

$ MACOS_DEPLOYMENT_TARGET=10.2
$ ruby install.rb setup

And there were no errors reported:

[snip]
** BUILD SUCCEEDED **
<— framework
—> lib
—> lib/osx
<— lib/osx
<— lib
—> ext
—> ext/rubycocoa
make
make: Nothing to be done for `all’.
<— ext/rubycocoa
<— ext
install.rb: setup done.

The next step fails with the same error as before:

$DYLD_FRAMEWORK_PATH=‘~/Documents/ruby/rubycocoa-0.4.0/framework/build’
ruby -I…/lib testall.rb
…/lib/osx/cocoa.rb:12:in require': No such file to load -- osx/objc/cocoa (LoadError) from ../lib/osx/cocoa.rb:12 from ./tc_nsattributedstring.rb:12:in require’
from ./tc_nsattributedstring.rb:12
from testall.rb:4:in require' from testall.rb:4 from testall.rb:3:in each’
from testall.rb:3
Loaded suite testall
Started

Finished in 0.002569 seconds.

0 tests, 0 assertions, 0 failures, 0 errors
$

Clearly something is still wrong but what “it” is, eludes me. I can
send more detailed output if you wish to you directly.

Steve

regards,

FUJIMTO Hisakuni

Steve

···

On Friday, July 11, 2003, at 02:55 AM, FUJIMOTO Hisakuni wrote:

At Fri, 11 Jul 2003 13:03:50 +0900, > Stephyn Butcher wrote:

In the previous mail, I intended to show the hint for your solving
your problem by yourself.

It was clear that setup phase was failed and so the
rubycocoa.bundle was corrupt. However, I’m sorry, it is too hard
that I continue to diagnostic process with an interview like your
home doctor by English.

If it’s difficult that you solve this problem by yourself, I
recommend you to use bianry distribution of RubyCocoa and default ruby
1.6.7 in OSX.

Thanks,

···

At Sat, 12 Jul 2003 00:08:14 +0900, Stephyn Butcher wrote:

There are details below of some experiments I ran this morning. I’m
still not having any luck. If you wish, I can send you more detailed
output directly.


FUJIMOTO Hisakuni