James Edward Gray 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.
J-P
http://www.rubygarden.org/ruby?RubyTkOnOSX
This may even work with a ruby installed from source, because I believe the
magic is actually in the Tcl/Tk libs, not ruby.
> 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
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
>> 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?
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
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.
It loads older version of 'tkutil.so'.
Please check it based on 'tkutil.c' included in the same source
archive of the 'event.rb'.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
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
'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.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> 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
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.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> From: James Edward Gray II <ja...@grayproductions.net>
> Subject: Re: Mac OS X TK
> Date: Sun, 27 Nov 2005 01:09:28 +0900
> Message-ID: <01A0C547-E567-4E19...@grayproductions.net>
>> 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 Gray II
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?
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> From: James Edward Gray II <ja...@grayproductions.net>
> Subject: Re: Mac OS X TK
> Date: Sun, 27 Nov 2005 03:28:18 +0900
> Message-ID: <248A7B57-9D17-4D46...@grayproductions.net>
>> 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
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. :)
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.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> 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 Gray II
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.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
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'.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> From: James Edward Gray II <ja...@grayproductions.net>
> Subject: Re: Mac OS X TK
> Date: Mon, 28 Nov 2005 09:26:17 +0900
> Message-ID: <450D6791-CD09-492D...@grayproductions.net>
>>> 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
>
> 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
> ---------------------------------------------------------------
Neo:~$ /usr/local/bin/ruby -r tcltklib -e 'p TclTkLib::RELEASE_DATE'
"2004-12-23"
Neo:~$ /usr/local/bin/ruby -r tkutil -e 'p TkUtil::RELEASE_DATE'
"2004-12-23"
Neo:~$ grep RELEASE_DATE /usr/local/lib/ruby/1.8/tk.rb
RELEASE_DATE = '2004-12-24'.freeze
Is this what you expected to see?
James Edward Gray II
>> 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?
Yes, I always extract to a clean directory.
James Edward Gray II
Hmmm...
It tells me that your '/usr/local/lib/ruby/1.8/tk.rb' is derived
from 1.8.2 and your '/usr/local/lib/ruby/1.8/tk/event.rb' is
derived from 1.8.3 (or 1.8.4).
That is very strange.
If you used a really clean source tree and had no errors on
'make install', I cannot understand the reason of your trouble.
Probably, the simplest way to escape the trouble is to replace
all files for Ruby/Tk under '/usr/local/lib/ruby/1.8/' to files
under '<1.8.2-source>/ext/tk/lib/' by your hand.
--
Hidetoshi NAGAI (na...@ai.kyutech.ac.jp)
> Hmmm...
> It tells me that your '/usr/local/lib/ruby/1.8/tk.rb' is derived
> from 1.8.2 and your '/usr/local/lib/ruby/1.8/tk/event.rb' is
> derived from 1.8.3 (or 1.8.4).
> That is very strange.
> If you used a really clean source tree and had no errors on
> 'make install', I cannot understand the reason of your trouble.
> Probably, the simplest way to escape the trouble is to replace
> all files for Ruby/Tk under '/usr/local/lib/ruby/1.8/' to files
> under '<1.8.2-source>/ext/tk/lib/' by your hand.
Bingo! That fixed it.
Thank you very much for all your tireless help!!!
James Edward Gray II
James-
i have been watching this thread a little bit because I failed to
get tk working on my custom built ruby on OSX tiger. If its not too
much trouble would you mind summarizing the process you just figured
out to get it working? I would very much appreciate it as I think
many others would as well.
Thanks-
-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ez...@yakima-herald.com
509-577-7732
I certainly would. I have Tk working by using the built-in /usr/bin/
ruby (which I actually renamed /usr/bin/ruby_apple to be clear), but
I'd love to have it working with my home-grown build in /usr/local/
bin/ruby
If you have not yet installed 1.8.3 / 1.8.4, you shouldn't have any
polution in your directories...
just rebuild 1.8.2 as described at the top of this page:
http://www.rubygarden.org/ruby?RubyTkOnOSX
After months of failing at getting Tk installed, I followed those
instructions and it just 'worked'
> On 11/28/05, Gavin Kistner <ga...@refinery.com> wrote:
>> On Nov 28, 2005, at 8:49 PM, Ezra Zygmuntowicz wrote:
>>> i have been watching this thread a little bit because I
>>> failed to
>>> get tk working on my custom built ruby on OSX tiger. If its not too
>>> much trouble would you mind summarizing the process you just
>>> figured out to get it working? I would very much appreciate it as I
>>> think many others would as well.
>>
>> I certainly would. I have Tk working by using the built-in /usr/bin/
>> ruby (which I actually renamed /usr/bin/ruby_apple to be clear), but
>> I'd love to have it working with my home-grown build in /usr/local/
>> bin/ruby
>
> If you have not yet installed 1.8.3 / 1.8.4, you shouldn't have any
> polution in your directories...
Greg is right that most of my trouble was causes by bad library
files. If you're not having that problem, it should be quite easy to
get working.
The biggest gotcha I found: TK-Aqua doesn't require X11, but Ruby/TK
does! It will only work if you have it installed.
James Edward Gray II