# Compiling ruby/tk on 64 bit Redhat?

**URL:** <https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091>\
**Category:** Ruby\
**Created:** [November 15, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091 "2006-11-15T19:21:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fkc\_email-news\_S\_ya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bc79bd/32.png) [@fkc\_email-news\_S\_ya](https://www.ruby-forum.com/u/fkc_email-news_S_ya)\
**Post date:** [November 15, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091/1 "2006-11-15T19:21:12Z")

</div>

HI All:

I"m wondering if anyone has successfully done this. I’m trying to  
build 1.8.5 with ruby/tk extension. It seems the extconf.rb can’t find  
XOpen Display. I hand tweaked the makefiles with values from Makefiles  
that I’ve successfully built on other unix’es and built, but I get the  
following sort of error

> > require ‘tk’  
> > root = Tk=\> true
> 
> > root = TkRoot.new  
> > RuntimeError: hash modified  
> > from /home/users/fchang/local\_linux/lib/ruby/1.8/tk.rb:3339:in  
> > `_symbolkey2str' from /home/users/fchang/local_linux/lib/ruby/1.8/tk.rb:3339:in`initialize’  
> > from  
> > /home/users/fchang/local\_linux/lib/ruby/1.8/tk/root.rb:36:in `new' from /home/users/fchang/local_linux/lib/ruby/1.8/tk/root.rb:36:in`new’  
> > from (irb):2

So I"m back to trying to get extconf.rb to work. It usually fails  
after not finding XOpenDisplay, which is curious as I built tcl/tk on  
the same machine.

checking for t\_open() in -lnsl… no  
checking for socket() in -lsocket… no  
checking for dlopen() in -ldl… yes  
checking for log() in -lm… no  
checking for tcl.h… yes  
checking for tk.h… yes  
checking for XOpenDisplay() in -lX11… no

From reading the mkmf.log, I"m guessing it’s not picking  
/usr/X11R6/lib64 as the lib directory when it’s trying to discover  
libs. It does try /usr/X11R6/lib, however. I can’t seem to figure out  
a way to get it to add that search dir. Guesses at adding with-x-lib  
or with-x11-lib didn’t seem to do it.

Any help appreciated. Thanks

Forrest

---

<div class="post-metadata">

**Author:** ![fkc\_email-news\_S\_ya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bc79bd/32.png) [@fkc\_email-news\_S\_ya](https://www.ruby-forum.com/u/fkc_email-news_S_ya)\
**Post date:** [November 20, 2006, 5:25pm UTC](https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091/2 "2006-11-20T17:25:07Z")

</div>

From: “fkc\_email-news @ yahoo dot com” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: compiling ruby/tk on 64 bit Redhat?  
Date: Thu, 16 Nov 2006 03:20:14 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> From reading the mkmf.log, I"m guessing it’s not picking  
> /usr/X11R6/lib64 as the lib directory when it’s trying to discover  
> libs. It does try /usr/X11R6/lib, however. I can’t seem to figure out  
> a way to get it to add that search dir. Guesses at adding with-x-lib  
> or with-x11-lib didn’t seem to do it.

Please try “–with-X11-lib=/usr/X11R6/lib64”.  
^(uppercase)

I think that “–with-X11-dir”. “–with-X11-include”, and  
“–with-X11-lib” must be available.  
After trying, please report the result to this ML.

---

<div class="post-metadata">

**Author:** ![fkc\_email-news\_S\_ya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bc79bd/32.png) [@fkc\_email-news\_S\_ya](https://www.ruby-forum.com/u/fkc_email-news_S_ya)\
**Post date:** [November 20, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091/3 "2006-11-20T19:05:38Z")

</div>

That did the trick.

I had to manually run the extconf.rb however and compile, and in doing  
such by hand the tkutil/extconf.rb didn’t recognize the compiled?  
method.

Thanks

Forrest

---

<div class="post-metadata">

**Author:** ![fkc\_email-news\_S\_ya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bc79bd/32.png) [@fkc\_email-news\_S\_ya](https://www.ruby-forum.com/u/fkc_email-news_S_ya)\
**Post date:** [November 21, 2006, 2:35am UTC](https://www.ruby-forum.com/t/compiling-ruby-tk-on-64-bit-redhat/76091/4 "2006-11-21T02:35:05Z")

</div>

From: “fkc\_email-news @ yahoo dot com” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: compiling ruby/tk on 64 bit Redhat?  
Date: Tue, 21 Nov 2006 03:05:09 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> I had to manually run the extconf.rb however and compile, and in doing  
> such by hand the tkutil/extconf.rb didn’t recognize the compiled?  
> method.

Please try “ruby -r mkmf -e ‘create\_makefile(“tkutil”)’”.  
And if you don’t mind modifying “extconf.rb”, please try the following.

-----------\<tkutil/extconf.rb\>-------------------------------------  
begin  
has\_tk = compiled?(‘tk’)  
rescue NoMethodError

# Probably, called manually (NOT from ‘extmk.rb’). Force to make

Makefile.  
has\_tk = true  
end

if has\_tk  
require ‘mkmf’  
create\_makefile(‘tkutil’)  
end
