Mac OS X TK

  • Thread starter James Edward Gray II
  • Start date
J

James Edward Gray II

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 Gray II
 
L

Logan Capaldo

------=_Part_23763_5909342.1132934630346
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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 Gray 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.

------=_Part_23763_5909342.1132934630346--
 
J

James Edward Gray II

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 Gray II
 
J

James Edward Gray II

tcltklib is the part that requires tcltk iirc.

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:

http://www.rubygarden.org/ruby?RubyTkOnOSX

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 Gray II
 
P

Peter Hickman

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.
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sat, 26 Nov 2005 01:50:23 +0900
Message-ID: said:
$ 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'.
 
J

James Edward Gray II

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sat, 26 Nov 2005 01:50:23 +0900


It loads older version of 'tkutil.so'.
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 Gray II
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sat, 26 Nov 2005 13:15:01 +0900
Message-ID: said:
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.
 
J

James Edward Gray II

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 Gray II
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 01:09:28 +0900
Message-ID: said:
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.
 
J

James Edward Gray II

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 01:09:28 +0900


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 Gray II
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 03:28:18 +0900
Message-ID: said:
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?
 
J

James Edward Gray II

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Sun, 27 Nov 2005 03:28:18 +0900
Message-ID: said:
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.

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:in `require'
from rrobots.rb:106

James Edward Gray II
 
G

Gregory Brown

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 :)

Of course, I'll be back at school later today where it will 'just
work' on Gentoo. :)
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Mon, 28 Nov 2005 01:40:04 +0900
Message-ID: said:
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: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.
 
J

James Edward Gray II

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/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 Gray II
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Mon, 28 Nov 2005 09:26:17 +0900
Message-ID: said:
$ /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

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.
 
H

Hidetoshi NAGAI

From: James Edward Gray II <[email protected]>
Subject: Re: Mac OS X TK
Date: Mon, 28 Nov 2005 01:40:04 +0900
Message-ID: said:
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/

Oh! tcltklib on 1.8.2 doesn't support many of those configure options.
Those were added at 'May 23 07:27:37 2005 UTC'.
If you want to make 1.8.2 on MacOS X Tiger, you have to edit
'ext/tcltklib/extconf.rb'.

If you have 'ext/tk/README.tcltklib', your 1.8.2 source tree is NOT pure.
The file was added to ruby_1_8 branch at 'Nov 2 11:19:28 2005 UTC',
or to ruby 1.9 at 'Jan 25 14:31:44 2005 UTC'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top