Mac OS X TK

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?
Can anyone point me to the steps?

James Edward G. II

On Nov 24, 2005, at 19:52, James Edward G. II wrote:

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?
Can anyone point me to the steps?

James Edward G. II

http://developer.imendio.com/wiki/Gtk_Mac_OS_X

Was (apparently) recently merged with Gnome CVS, so should presumably
be quite usable, though I’m not able to vouch for it. Build
instructions are linked from the page.

Hope that helps,
matthew smillie.

James Edward G. II wrote:

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?
Can anyone point me to the steps?

James Edward G. II

There is that page which helped me when I explored Tk with Perl or Ruby:
http://tcltkaqua.sourceforge.net/

J-P

On 11/24/05, James Edward G. II [email protected] wrote:

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?
Can anyone point me to the steps?

James Edward G. II

If you use the apple installed ruby its all of
require ‘tk’ # Aqua GUI – done

This may even work with a ruby installed from source, because I believe
the
magic is actually in the Tcl/Tk libs, not ruby.

On Nov 25, 2005, at 10:03 AM, Logan C. wrote:

If you use the apple installed ruby its all of
require ‘tk’ # Aqua GUI – done

If you have X11 installed. I have this working now. Thanks.

This may even work with a ruby installed from source, because I
believe the
magic is actually in the Tcl/Tk libs, not ruby.

I can’t get my custom compiled Ruby to do the same. I’m seeing:

$ ruby -r tk -e1
/usr/local/lib/ruby/1.8/tk.rb:7:in `require’: No such file to load –
tcltklib (LoadError)
from /usr/local/lib/ruby/1.8/tk.rb:7

If anyone knows what I’m doing wrong there, please let me know.

James Edward G. II

On 11/25/05, James Edward G. II [email protected] wrote:

I can’t get my custom compiled Ruby to do the same. I’m seeing:

$ ruby -r tk -e1
/usr/local/lib/ruby/1.8/tk.rb:7:in `require’: No such file to load –
tcltklib (LoadError)
from /usr/local/lib/ruby/1.8/tk.rb:7

If anyone knows what I’m doing wrong there, please let me know.

tcltklib is the part that requires tcltk iirc.

Perhaps the extconf did not find the tk libraries when you were
compiling ruby?

hth

Michal


Support the freedom of music!
Maybe it’s a weird genre … but weird is not illegal.
Maybe next time they will send a special forces commando
to your picnic … because they think you are weird.
www.music-versus-guns.org http://en.policejnistat.cz

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Sat, 26 Nov 2005 01:50:23 +0900
Message-ID: [email protected]

$ ruby -r tk -e1
/usr/local/lib/ruby/1.8/tk/event.rb:397: undefined method
`_define_attribute_aliases’ for CallbackSubst:Class (NoMethodError)
from /usr/local/lib/ruby/1.8/tk.rb:804

It loads older version of ‘tkutil.so’.
Please check it based on ‘tkutil.c’ included in the same source
archive of the ‘event.rb’.

I tried the following on my Powerbook, 10.4.3. I believe that I have run
the patch and rebuild thingy you need to do to get gem / rails to work.

irb> require ‘tk’
irb> root = TkRoot.new() { title “Hello, world!” }
irb> Tk.mainloop()

This works, ie pops up a window, from both the normal Terminal.app and
from xterm under X11.

On Nov 25, 2005, at 10:32 AM, Michal S. wrote:

Perhaps the extconf did not find the tk libraries when you were
compiling ruby?

I got closer using the directions at the top of this page:

Now I see:

$ ruby -r tk -e1
/usr/local/lib/ruby/1.8/tk/event.rb:397: undefined method
`_define_attribute_aliases’ for CallbackSubst:Class (NoMethodError)
from /usr/local/lib/ruby/1.8/tk.rb:804

Does that make sense to anyone?

Note that this step of the install:

cd /usr/local/bin
/Developer/Tools/Rez -t APPL Carbon.r -o ruby

failed:

$ /Developer/Tools/Rez -t APPL Carbon.r -o ruby

/Developer/Tools/Rez - SysError -5000 during create of “ruby”.

/Developer/Tools/Rez - Fatal error trying to open the resource

file “ruby” for writing.
Fatal Error!

/Developer/Tools/Rez - Fatal Error, can’t recover.

/Developer/Tools/Rez - Since errors occurred, ruby’s resource

fork was not written.

I don’t think that’s the error I am seeing above though.

Any tips appreciated.

James Edward G. II

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Sat, 26 Nov 2005 13:15:01 +0900
Message-ID: [email protected]

Hmm, I assume that means the --enable-mac-tcltk-framework option
doesn’t correctly point Ruby at Tiger’s magic TK library.

‘tkutil.c’ does NOT depend on Tcl/Tk libraries.
Even if there are no Tcl/Tk libraries or header files in your
environment, ‘tkutil.so’ can be created from it.

On the latest version of Ruby’s source archive, when fail to

compile tcltklib, tkuti.so will not be compiled.

Because Ruby/Tk doesn’t work without tcltklib.so.

Maybe, threre is an old tkutil.so which has higher priority
on the load path, or a newer tkutil.so is not installed because
you fail to compile tkutil.c.

On Nov 25, 2005, at 9:23 PM, Hidetoshi NAGAI wrote:

Please check it based on ‘tkutil.c’ included in the same source
archive of the ‘event.rb’.

Hmm, I assume that means the --enable-mac-tcltk-framework option
doesn’t correctly point Ruby at Tiger’s magic TK library. I have no
idea what I would need to edit for that though…

James Edward G. II

On Nov 26, 2005, at 12:23 AM, Hidetoshi NAGAI wrote:

Maybe, threre is an old tkutil.so which has higher priority
on the load path, or a newer tkutil.so is not installed because
you fail to compile tkutil.c.

And this compile would have happened as a natural part of Ruby’s
build process?

If tkutil.so is supposed to be in Ruby’s lib directories, it’s not
there. Is there another place I should be looking for it?

What could cause it not to build?

Thanks for all your help.

James Edward G. II

On Nov 26, 2005, at 10:40 AM, Hidetoshi NAGAI wrote:

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 01:09:28 +0900
Message-ID: [email protected]

If tkutil.so is supposed to be in Ruby’s lib directories, it’s not
there. Is there another place I should be looking for it?

I don’t know the directory name of Ruby’s dynamic library on MacOS X.
But the directory is a sub-directory of the Ruby’s library directory.
For example, in my env, that is “/usr/local/lib/ruby/1.8/i686-linux”.

You led me right to it:

Neo:~$ ruby -e ‘p $:’
[“/usr/local/lib/ruby/site_ruby/1.8”, “/usr/local/lib/ruby/site_ruby/
1.8/powerpc-darwin8.3.0”, “/usr/local/lib/ruby/site_ruby”, “/usr/
local/lib/ruby/1.8”, “/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0”, “.”]
Neo:~$ ls /usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/t*
/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tcltklib.bundle
/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tkutil.bundle

Which sourse archive do you use?

Old version of archive (e.g. ruby-1.8.2) doesn’t support

tcltk-framework of the latest MacOS X.

This sounds like my problem right here. 1.8.3 caused me headaches,
so I’m back to 1.8.2. That’s the source I used.

I have TK working in the Apple install (/usr/bin/ruby), so I guess
it’s not too big of a deal. I was just trying to get it to work with
my install, if possible.

Thanks again for trying to help.

James Edward G. II

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 01:09:28 +0900
Message-ID: [email protected]

If tkutil.so is supposed to be in Ruby’s lib directories, it’s not
there. Is there another place I should be looking for it?

I don’t know the directory name of Ruby’s dynamic library on MacOS X.
But the directory is a sub-directory of the Ruby’s library directory.
For example, in my env, that is “/usr/local/lib/ruby/1.8/i686-linux”.

What could cause it not to build?

If your source archive doesn’t include “ext/tcltklib/” directory,
probably, you fail to compile tcltklib.so (maybe, fail to find
Tcl/Tk header files or libraries).
When cannot make tcltklib.so, tkutil.c is not compiled.

Which sourse archive do you use?

Old version of archive (e.g. ruby-1.8.2) doesn’t support

tcltk-framework of the latest MacOS X.

ruby-1.8.3 or later will support it.

If your source archive includes both of “ext/tcltklib/” and “ext/tk/”,
tkutil.c should be compiled.
If not, I’m sorry but I don’t know the reason too.

On Nov 26, 2005, at 7:30 PM, Hidetoshi NAGAI wrote:

/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tcltklib.bundle
/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tkutil.bundle

Hmm… Don’t you have tkutil.* in
“/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.3.0” ?
^^^^^^^^^
If don’t, that is very strange.

No, that directory appears to bee empty.

It’s also empty for Apple’s install though, where TK is working.

I don’t understand what is happen in your environment.
Can ‘ext/tcltklib/README.1st’ (‘ext/tk/README.tcltklib’ on
ruby-1.8.4 or 1.9) help you?

I read those and tried building Ruby 1.8.2 with:

./configure --enable-pthread --with-tcllib=tcl8.4 --with-tklib=tk8.4
–with-tcl-dir=/usr --with-tk-dir=/usr --with-tcltk-framework=/System/
Library/Frameworks --with-tcl-framework-header=/System/Library/
Frameworks/Tcl.framework/Headers/ --with-tk-framework-header=/System/
Library/Frameworks/Tk.framework/Headers/

I’m still seeing errors:

/usr/local/lib/ruby/1.8/tk/event.rb:397: undefined method
_define_attribute_aliases' for CallbackSubst:Class (NoMethodError) from /usr/local/lib/ruby/1.8/tk.rb:804 from rrobots.rb:106:inrequire’
from rrobots.rb:106

James Edward G. II

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 03:28:18 +0900
Message-ID: [email protected]

Neo:~$ ruby -e ‘p $:’
[“/usr/local/lib/ruby/site_ruby/1.8”, “/usr/local/lib/ruby/site_ruby/
1.8/powerpc-darwin8.3.0”, “/usr/local/lib/ruby/site_ruby”, “/usr/
local/lib/ruby/1.8”, “/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0”, “.”]
Neo:~$ ls /usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/t*
/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tcltklib.bundle
/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/tkutil.bundle

Hmm… Don’t you have tkutil.* in
“/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.3.0” ?
^^^^^^^^^
If don’t, that is very strange.
The situation shows me that tkutil.c cannot be compiled but
tk libraries are installed.
In normal case, when fail to compile tkutil.c, tk libraries
are not installed.

I don’t understand what is happen in your environment.
Can ‘ext/tcltklib/README.1st’ (‘ext/tk/README.tcltklib’ on
ruby-1.8.4 or 1.9) help you?

On 11/24/05, James Edward G. II [email protected] wrote:

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?
Can anyone point me to the steps?

James, if you do get this working with non-apple install ruby…
please post the complete steps you took to do it. Seeing as the first
thing I did with my mac is hose apple’s installs of most everything,
I’d love to know how to get Tk setup so I can join in on the RRobots
fun :slight_smile:

Of course, I’ll be back at school later today where it will ‘just
work’ on Gentoo. :slight_smile:

On Nov 27, 2005, at 4:29 PM, Hidetoshi NAGAI wrote:

The change about _define_attribute_aliases was done at
‘Mon Jun 13 17:07:25 2005 UTC’.

TkUtil::RELEASE_DATE was updated at ‘Tue Jun 14 11:48:48 2005 UTC’.

Please check the RELEASE_DATEs by

/usr/local/bin/ruby -r tk -e ‘p TclTkLib::RELEASE_DATE; p
Tk::RELEASE_DATE; p TkUtil::RELEASE_DATE’

$ /usr/local/bin/ruby -r tk -e ‘p TclTkLib::RELEASE_DATE; p
Tk::RELEASE_DATE; p TkUtil::RELEASE_DATE’
/usr/local/lib/ruby/1.8/tk/event.rb:397: undefined method
`_define_attribute_aliases’ for CallbackSubst:Class (NoMethodError)
from /usr/local/lib/ruby/1.8/tk.rb:804

If that is right, two or more sources or binaries are mixed in
your environment.

I pull a fresh copy of the Ruby source whenever I try to build. I
have however upgraded to 1.8.3 and 1.8.4pr1, then downgraded back to
1.8.2. Could my library directories be messed up by this process?
Is there an easy way to uninstall ruby, so I can try a fresh build?

James Edward G. II

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Mon, 28 Nov 2005 01:40:04 +0900
Message-ID: [email protected]

/usr/local/lib/ruby/1.8/tk/event.rb:397: undefined method
_define_attribute_aliases' for CallbackSubst:Class (NoMethodError) from /usr/local/lib/ruby/1.8/tk.rb:804 from rrobots.rb:106:in require’
from rrobots.rb:106

The change about _define_attribute_aliases was done at
‘Mon Jun 13 17:07:25 2005 UTC’.

TkUtil::RELEASE_DATE was updated at ‘Tue Jun 14 11:48:48 2005 UTC’.

Please check the RELEASE_DATEs by

/usr/local/bin/ruby -r tk -e ‘p TclTkLib::RELEASE_DATE; p
Tk::RELEASE_DATE; p TkUtil::RELEASE_DATE’

Of course, those RELEASE_DATE are not same.
But, probably, Tk’s RELEASE_DATE will be after June 14th, and
TkUtil’s RELEASE_DATE will be before June 13th.
If that is right, two or more sources or binaries are mixed in
your environment.
To clean your source environment, please rename (or remove) your
current ruby’s source directory (and if you can, rename
/usr/local/lib/ruby and check that your ruby doesn’t work), and
try to extract a new source directory from the new source archive,
and make and make install on the new source directory.

From: James Edward G. II [email protected]
Subject: Re: Mac OS X TK
Date: Mon, 28 Nov 2005 09:26:17 +0900
Message-ID: [email protected]

     from /usr/local/lib/ruby/1.8/tk.rb:804

Ah, sorry.

/usr/local/bin/ruby -r tcltklib -e ‘p TclTkLib::RELEASE_DATE’
/usr/local/bin/ruby -r tkutil -e ‘p TkUtil::RELEASE_DATE’
grep RELEASE_DATE /usr/local/lib/ruby/1.8/tk.rb

I pull a fresh copy of the Ruby source whenever I try to build. I
have however upgraded to 1.8.3 and 1.8.4pr1, then downgraded back to
1.8.2. Could my library directories be messed up by this process?

Maybe. Was the fresh copy extracted to a new clean directory?
Your ‘/usr/local/lib/ruby/1.8/tk/event.rb’ is derived from 1.8.3 or
1.8.4-preview1, and your ‘/usr/local/lib/ruby/1.8/powerpc-darwin8.3.0/
tkutil.bundle’ is derived from 1.8.2.
Please rename ‘/usr/local/lib/ruby’ to ‘/usr/local/lib/ruby.old’,
and try to re-install Ruby from a new clean directory.