Project

General

Profile

Actions

Bug #3248

closed

extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly

Added by luislavena (Luis Lavena) over 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
Revision: 27624
Backport:
[ruby-core:30010]

Description

=begin
Using GCC 3.4.5, under MinGW, with msysGit installed, extension tk is finding tcl and tk config bash scripts even when those are not in the path:


 compiling tk
 check functions.........
 check struct members..
 Use ActiveTcl libraries (if available).
 Search tclConfig.sh and tkConfig.sh.............................................
 Valid tclConfig.sh and tkConfig.sh are found in ["c:/Users/Luis/Tools/Git/lib"]
 Use [tclConfig.sh,tkConfig.sh] == ['c:/Users/Luis/Tools/Git/lib/tclConfig.sh','c:/Users/Luis/Tools/Git/lib/tkConfig.sh']
 Search Tcl library..
 Found a Tcl library at c:/Users/Luis/Tools/Git/lib.
 Search Tk library..
 Found a Tk library at c:/Users/Luis/Tools/Git/lib.
 

This is using a subversion checkout, not a git checkout and a normal command prompt (instead of bash).

Attached are config.log, config.status and mkmf.log from the ext build directory for tk extension.

Steps to reproduce require Windows, subversion, Git and a clone of RubyInstaller build recipes.
(of course, a working Ruby 1.8.6 or 1.8.7 is required too).
=end


Files

config.log.zip (28.7 KB) config.log.zip luislavena (Luis Lavena), 05/05/2010 03:09 PM
config.status (27 KB) config.status luislavena (Luis Lavena), 05/05/2010 03:09 PM
mkmf.log.zip (1.95 KB) mkmf.log.zip luislavena (Luis Lavena), 05/05/2010 03:09 PM
Actions #1

Updated by nagai (Hidetoshi Nagai) over 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27627.
Luis, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #2

Updated by luislavena (Luis Lavena) over 14 years ago

=begin
Hello Hidetoshi,

This issue still appears as r27635:


 
 Search tclConfig.sh and tkConfig.sh..........................................................
 Valid tclConfig.sh and tkConfig.sh are found in ["c:/Users/Luis/Tools/Git/lib"]
 Use [tclConfig.sh,tkConfig.sh] == ['c:/Users/Luis/Tools/Git/lib/tclConfig.sh','c:/Users/Luis/Tools/Git/lib/tkConfig.sh']
 
 

Git/lib is not in the PATH, so why extconf.rb is finding it? It shouldn't

--
Luis Lavena

=end

Actions #3

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30041] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 09:46:51 +0900
Message-ID:

This issue still appears as r27635:

I'm very sorry. I misunderstood about your trouble.

Search tclConfig.sh and tkConfig.sh..........................................................
Valid tclConfig.sh and tkConfig.sh are found in ["c:/Users/Luis/Tools/Git/lib"]
Use [tclConfig.sh,tkConfig.sh] == ['c:/Users/Luis/Tools/Git/lib/tclConfig.sh','c:/Users/Luis/Tools/Git/lib/tkConfig.sh']

Git/lib is not in the PATH, so why extconf.rb is finding it? It shouldn't

Because your PATH includes "c:/Users/Luis/Tools/Git/cmd".

extconf.rb of tk searchs tclConfig.sh/tkConfig.sh from
"/../lib" directory.
It supposes the relation of "/bin" and "/lib",
e.g. "/usr/opt/bin" and "/usr/opt/lib".
But, on your environment, the supposition resulted in improper files.

Can you temporaly remove the path from PATH,
or give --with-tclConfig-file/--with-tkConfig-file option?

Hidetoshi NAGAI ()
=end

Actions #4

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30041] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 09:46:51 +0900
Message-ID:

This issue still appears as r27635:

I'm very sorry. I misunderstood about your trouble.

Search tclConfig.sh and tkConfig.sh..........................................................
Valid tclConfig.sh and tkConfig.sh are found in ["c:/Users/Luis/Tools/Git/lib"]
Use [tclConfig.sh,tkConfig.sh] == ['c:/Users/Luis/Tools/Git/lib/tclConfig.sh','c:/Users/Luis/Tools/Git/lib/tkConfig.sh']

Git/lib is not in the PATH, so why extconf.rb is finding it? It shouldn't

Because your PATH includes "c:/Users/Luis/Tools/Git/cmd".

extconf.rb of tk searchs tclConfig.sh/tkConfig.sh from
"/../lib" directory.
It supposes the relation of "/bin" and "/lib",
e.g. "/usr/opt/bin" and "/usr/opt/lib".
But, on your environment, the supposition resulted in improper files.

Can you temporaly remove the path from PATH,
or give --with-tclConfig-file/--with-tkConfig-file option?

Hidetoshi NAGAI ()

=end

Actions #5

Updated by luislavena (Luis Lavena) over 14 years ago

=begin
On Thu, May 6, 2010 at 7:09 AM, Hidetoshi NAGAI wrote:

Search tclConfig.sh and tkConfig.sh..........................................................
Valid tclConfig.sh and tkConfig.sh are found in ["c:/Users/Luis/Tools/Git/lib"]
Use [tclConfig.sh,tkConfig.sh] == ['c:/Users/Luis/Tools/Git/lib/tclConfig.sh','c:/Users/Luis/Tools/Git/lib/tkConfig.sh']

Git/lib is not in the PATH, so why extconf.rb is finding it? It shouldn't

Because your PATH includes "c:/Users/Luis/Tools/Git/cmd".

extconf.rb of tk searchs tclConfig.sh/tkConfig.sh from
"/../lib" directory.
It supposes the relation of "/bin" and "/lib",
e.g. "/usr/opt/bin" and "/usr/opt/lib".
But, on your environment, the supposition resulted in improper files.

Yes, and that supposition will result in problems for other users, not just me.

Can you temporaly remove the path from PATH,
or give --with-tclConfig-file/--with-tkConfig-file option?

Yes, I can temporary disable it, but I see that will not solve the
issue for average user in the long run.

For example, if you checkout Ruby using Git (from official mirror)
then the revision parsing functionality on 1.9.2 will not work, as Git
will not be in the PATH.

I don't have tk or tcl in my system, so "--with-*Config" sounds
incorrectly, what should I provide to that option? empty value or a
path that doesn't exist just to avoid the issue?

Thank you.

Luis Lavena
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

=end

Actions #6

Updated by jonforums (Jon Forums) over 14 years ago

=begin
I also ran into the same issue back in March http://www.ruby-forum.com/topic/206113

My current "fix" is to remove <GIT_INSTALL>\cmd from my PATH and use a non-preferred shell (development irritant) which is not really a fix at all given that I do not have tk or tcl installed on my system.

I agree with Luis and hope this can be truly solved with some configure magic rather than an ugly configure option hack.

Jon
=end

Actions #7

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30055] Re: [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 21:39:22 +0900
Message-ID:

Yes, I can temporary disable it, but I see that will not solve the
issue for average user in the long run.

From: Jon Forums
Subject: [ruby-core:30056] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 22:22:16 +0900
Message-ID:

My current "fix" is to remove <GIT_INSTALL>\cmd from my PATH and use a non-preferred shell (development irritant) which is not really a fix at all given that I do not have tk or tcl installed on my system.

I see. Can the attached patch fix your problem?

Hidetoshi NAGAI ()

--- extconf.rb~ 2010-05-05 18:48:17.000000000 +0900
+++ extconf.rb 2010-05-06 23:35:23.000000000 +0900
@@ -84,8 +84,8 @@
if update_flag
puts "Configure options for Ruby/Tk may be updated."
puts "So, delete files which depend on old configs."

  • File.delete(Dir.glob(".#{CONFIG['DLEXT']}"))
  • File.delete(Dir.glob(".#{$OBJEXT}"))
  • File.delete(Dir.glob(".#{CONFIG['DLEXT']}", File::FNM_CASEFOLD))
  • File.delete(Dir.glob(".#{$OBJEXT}", File::FNM_CASEFOLD))
    File.delete('Makefile') rescue nil

else
@@ -177,7 +177,7 @@
path_dirs = []

if TkLib_Config["ActiveTcl"].kind_of?(String)  # glob path
  • path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
  • path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
    end
if is_win32?

@@ -199,17 +199,17 @@
next unless File.directory?(dir)

    path_dirs << "#{dir}/lib"
  •  path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*").empty?
    
  •  path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*", File::FNM_CASEFOLD).empty?
    
     dirnames = []
     if TkLib_Config["ActiveTcl"]
    
  •    dirnames.concat ["ActiveTcl","activeTcl","Activetcl","activetcl"]
    
  •    dirnames.concat ["ActiveTcl"]
     end
    
  •  dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk","tcltk","tcl_tk","tcl-tk"]
    
  •  dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk"]
    
     dirnames.each{|name|
       path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}")
    
  •    path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*").empty?
    
  •    path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*", File::FNM_CASEFOLD).empty?
     }
    
    }
    end
    @@ -379,34 +379,26 @@
    dirs << TkLib_Config["ActiveTcl"]
    end
    dirs.concat [
  •    "c:/ActiveTcl*/lib", "c:/Activetcl*/lib", 
    
  •    "c:/activeTcl*/lib", "c:/activetcl*/lib", 
    
  •    "c:/Tcl*/lib", "c:/tcl*/lib", 
    
  •    "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Activetcl*/lib",
    
  •    "c:/Program Files/activeTcl*/lib", "c:/Program Files/activetcl*/lib",
    
  •    "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
    
  •    "/ActiveTcl*/lib", "/Activetcl*/lib", 
    
  •    "/activeTcl*/lib", "/activetcl*/lib", 
    
  •    "/Tcl*/lib", "/tcl*/lib", 
    
  •    "/Program Files/ActiveTcl*/lib", "/Program Files/Activetcl*/lib",
    
  •    "/Program Files/activeTcl*/lib", "/Program Files/activetcl*/lib",
    
  •    "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
    
  •    "c:/ActiveTcl*/lib", "c:/Tcl*/lib",
    
  •    "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Tcl*/lib",
    
  •    "/ActiveTcl*/lib", "/Tcl*/lib",
    
  •    "/Program Files/ActiveTcl*/lib", "/Program Files/Tcl*/lib"
     ]
    
    else
    dirs = [
  •    "c:/Tcl*/lib", "c:/tcl*/lib", 
    
  •    "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
    
  •    "/Tcl*/lib", "/tcl*/lib", 
    
  •    "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
    
  •    "c:/Tcl*/lib", "c:/Program Files/Tcl*/lib",
    
  •    "/Tcl*/lib", "/Program Files/Tcl*/lib"
     ]
    
    end
  • dirs.collect{|d| Dir.glob(d)}.flatten!
  • dirs.collect{|d| Dir.glob(d, File::FNM_CASEFOLD)}.flatten!
    dirs |= dirs
  • ENV['PATH'].split(';').each{|dir|
  • ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
  •  dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
    
  •  next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
     dirs << File.expand_path(File.join(dir, '..', 'lib'))
     dirs << dir
    
  •  dirs << File.expand_path(File.join(dir, '..'))
    
  •  # dirs << File.expand_path(File.join(dir, '..'))
    

    }

    unless TkLib_Config["space-on-tk-libpath"]
    @@ -421,7 +413,7 @@
    else
    if activeTcl = TkLib_Config['ActiveTcl']
    # check latest version at first

  •  config_dir.concat(Dir.glob(activeTcl).sort.reverse)
    
  •  config_dir.concat(Dir.glob(activeTcl, File::FNM_CASEFOLD).sort.reverse)
    

    end

    config_dir.concat [
    @@ -438,25 +430,27 @@
    '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
    '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
    ].map{|dir|

  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*/lib')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}/lib')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}')
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}[87]*/lib', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}[87]*', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD)
    
    }.flatten!
  • ENV['PATH'].split(':').each{|dir|
  • ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|

  •  dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
    
  •  next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
     config_dir << File.expand_path(File.join(dir, '..', 'lib'))
    

    }

    for MacOS X

    #config_dir << "~/Library/Tcl"

  • #config_dir.concat(Dir.glob("~/Library/Tcl/*").sort.reverse)
  • #config_dir.concat(Dir.glob("~/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/Library/Tcl"
  • config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/Network/Library/Tcl"
  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/System/Library/Tcl"
  • config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/System/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    [
    #"~/Library/Frameworks",
    "/Library/Frameworks",
    @@ -483,7 +477,7 @@
    if path.kind_of?(Array)
    config_dir << path
    else
  •    dirs = Dir.glob(path)
    
  •    dirs = Dir.glob(path, File::FNM_CASEFOLD)
       config_dir.concat(dirs.zip(dirs))
     end
    
    }
    @@ -554,7 +548,7 @@
    libpath = $LIBPATH
    tcllibs = nil
    begin
  •    tcllib_ok = Dir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*")).find{|file|
    
  •    tcllib_ok = Dir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
         if file =~ /^.*(tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}(\.|)#{tclconf['TCL_MINOR_VERSION']}.*)\.[^.]*$/
           #puts "check #{file} #{$1} #{tclfunc} #{dir}"
           #find_library($1, tclfunc, dir)
    

@@ -563,7 +557,7 @@
try_func(tclfunc, tcllibs)
end
}

  •    tklib_ok = Dir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*")).find{|file|
    
  •    tklib_ok = Dir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
         if file =~ /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.[^.]*$/
           #puts "check #{file} #{$1} #{tkfunc} #{dir}"
           # find_library($1, tkfunc, dir)
    

@@ -675,10 +669,10 @@
path_list = []

  #if TkLib_Config["ActiveTcl"]
  • path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse

  • path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse

    #end
    if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path
  •  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
    
  •  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
    

    end

    vers = get_shlib_versions
    @@ -691,16 +685,16 @@
    else
    dirs = []

  •      if !Dir.glob(head + "-*").empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
    
  •      if !Dir.glob(head + "-*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
         end
    
  •      if !Dir.glob(head + "[_-]*").empty?
    
  •        dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*").empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
    
  •        dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*").empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
    
  •      if !Dir.glob(head + "[_-]*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
         end
    
         dirs
    

@@ -735,7 +729,7 @@
end
exts << ",dll,lib" if is_win32?
exts << ",bundle,dylib" if is_macosx? || /nextstep|openstep|rhapsody/ =~ RUBY_PLATFORM

  • files = Dir.glob(File.join(path, "{#{heads.join(',')}}.{#{exts}}"))
  • files = Dir.glob(File.join(path, "{#{heads.join(',')}}.{#{exts}}"), File::FNM_CASEFOLD)
    vers.find_all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} }
    end

@@ -1029,9 +1023,10 @@
TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} "
else
dir = Dir.glob(File.join(TkLib_Config["tcltk-framework"],

  •                         'Tcl.framework', '*', 'Headers'))
    
  •                         'Tcl.framework', '*', 'Headers'),
    
  •               File::FNM_CASEFOLD)
    
    TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty?
  • TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "
  • TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'), File::FNM_CASEFOLD)[0]} "
    end
$LDFLAGS << ' -framework Tk -framework Tcl'

@@ -1050,8 +1045,8 @@
defaults =
[ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ]
paths = []

  • opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
  • opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
    st = find_library("X11", "XOpenDisplay", *paths)
    unless st
    puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.")

=end

Actions #8

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30055] Re: [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 21:39:22 +0900
Message-ID:

Yes, I can temporary disable it, but I see that will not solve the
issue for average user in the long run.

From: Jon Forums
Subject: [ruby-core:30056] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 22:22:16 +0900
Message-ID:

My current "fix" is to remove <GIT_INSTALL>\cmd from my PATH and use a non-preferred shell (development irritant) which is not really a fix at all given that I do not have tk or tcl installed on my system.

I see. Can the attached patch fix your problem?

Hidetoshi NAGAI ()

--- extconf.rb~ 2010-05-05 18:48:17.000000000 +0900
+++ extconf.rb 2010-05-06 23:35:23.000000000 +0900
@@ -84,8 +84,8 @@
if update_flag
puts "Configure options for Ruby/Tk may be updated."
puts "So, delete files which depend on old configs."

  • File.delete(Dir.glob(".#{CONFIG['DLEXT']}"))
  • File.delete(Dir.glob(".#{$OBJEXT}"))
  • File.delete(Dir.glob(".#{CONFIG['DLEXT']}", File::FNM_CASEFOLD))
  • File.delete(Dir.glob(".#{$OBJEXT}", File::FNM_CASEFOLD))
    File.delete('Makefile') rescue nil

else
@@ -177,7 +177,7 @@
path_dirs = []

if TkLib_Config["ActiveTcl"].kind_of?(String)  # glob path
  • path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
  • path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
    end
if is_win32?

@@ -199,17 +199,17 @@
next unless File.directory?(dir)

    path_dirs << "#{dir}/lib"
  •  path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*").empty?
    
  •  path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*", File::FNM_CASEFOLD).empty?
    
     dirnames = []
     if TkLib_Config["ActiveTcl"]
    
  •    dirnames.concat ["ActiveTcl","activeTcl","Activetcl","activetcl"]
    
  •    dirnames.concat ["ActiveTcl"]
     end
    
  •  dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk","tcltk","tcl_tk","tcl-tk"]
    
  •  dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk"]
    
     dirnames.each{|name|
       path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}")
    
  •    path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*").empty?
    
  •    path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*", File::FNM_CASEFOLD).empty?
     }
    
    }
    end
    @@ -379,34 +379,26 @@
    dirs << TkLib_Config["ActiveTcl"]
    end
    dirs.concat [
  •    "c:/ActiveTcl*/lib", "c:/Activetcl*/lib", 
    
  •    "c:/activeTcl*/lib", "c:/activetcl*/lib", 
    
  •    "c:/Tcl*/lib", "c:/tcl*/lib", 
    
  •    "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Activetcl*/lib",
    
  •    "c:/Program Files/activeTcl*/lib", "c:/Program Files/activetcl*/lib",
    
  •    "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
    
  •    "/ActiveTcl*/lib", "/Activetcl*/lib", 
    
  •    "/activeTcl*/lib", "/activetcl*/lib", 
    
  •    "/Tcl*/lib", "/tcl*/lib", 
    
  •    "/Program Files/ActiveTcl*/lib", "/Program Files/Activetcl*/lib",
    
  •    "/Program Files/activeTcl*/lib", "/Program Files/activetcl*/lib",
    
  •    "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
    
  •    "c:/ActiveTcl*/lib", "c:/Tcl*/lib",
    
  •    "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Tcl*/lib",
    
  •    "/ActiveTcl*/lib", "/Tcl*/lib",
    
  •    "/Program Files/ActiveTcl*/lib", "/Program Files/Tcl*/lib"
     ]
    
    else
    dirs = [
  •    "c:/Tcl*/lib", "c:/tcl*/lib", 
    
  •    "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
    
  •    "/Tcl*/lib", "/tcl*/lib", 
    
  •    "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
    
  •    "c:/Tcl*/lib", "c:/Program Files/Tcl*/lib",
    
  •    "/Tcl*/lib", "/Program Files/Tcl*/lib"
     ]
    
    end
  • dirs.collect{|d| Dir.glob(d)}.flatten!
  • dirs.collect{|d| Dir.glob(d, File::FNM_CASEFOLD)}.flatten!
    dirs |= dirs
  • ENV['PATH'].split(';').each{|dir|
  • ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
  •  dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
    
  •  next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
     dirs << File.expand_path(File.join(dir, '..', 'lib'))
     dirs << dir
    
  •  dirs << File.expand_path(File.join(dir, '..'))
    
  •  # dirs << File.expand_path(File.join(dir, '..'))
    

    }

    unless TkLib_Config["space-on-tk-libpath"]
    @@ -421,7 +413,7 @@
    else
    if activeTcl = TkLib_Config['ActiveTcl']
    # check latest version at first

  •  config_dir.concat(Dir.glob(activeTcl).sort.reverse)
    
  •  config_dir.concat(Dir.glob(activeTcl, File::FNM_CASEFOLD).sort.reverse)
    

    end

    config_dir.concat [
    @@ -438,25 +430,27 @@
    '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
    '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
    ].map{|dir|

  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*/lib')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}/lib')
    
  •  Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}')
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}[87]*/lib', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}[87]*', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD)
    
  •  Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD)
    
    }.flatten!
  • ENV['PATH'].split(':').each{|dir|
  • ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|

  •  dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
    
  •  next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
     config_dir << File.expand_path(File.join(dir, '..', 'lib'))
    

    }

    for MacOS X

    #config_dir << "~/Library/Tcl"

  • #config_dir.concat(Dir.glob("~/Library/Tcl/*").sort.reverse)
  • #config_dir.concat(Dir.glob("~/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/Library/Tcl"
  • config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/Network/Library/Tcl"
  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    config_dir << "/System/Library/Tcl"
  • config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse)
  • config_dir.concat(Dir.glob("/System/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
    [
    #"~/Library/Frameworks",
    "/Library/Frameworks",
    @@ -483,7 +477,7 @@
    if path.kind_of?(Array)
    config_dir << path
    else
  •    dirs = Dir.glob(path)
    
  •    dirs = Dir.glob(path, File::FNM_CASEFOLD)
       config_dir.concat(dirs.zip(dirs))
     end
    
    }
    @@ -554,7 +548,7 @@
    libpath = $LIBPATH
    tcllibs = nil
    begin
  •    tcllib_ok = Dir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*")).find{|file|
    
  •    tcllib_ok = Dir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
         if file =~ /^.*(tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}(\.|)#{tclconf['TCL_MINOR_VERSION']}.*)\.[^.]*$/
           #puts "check #{file} #{$1} #{tclfunc} #{dir}"
           #find_library($1, tclfunc, dir)
    

@@ -563,7 +557,7 @@
try_func(tclfunc, tcllibs)
end
}

  •    tklib_ok = Dir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*")).find{|file|
    
  •    tklib_ok = Dir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
         if file =~ /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.[^.]*$/
           #puts "check #{file} #{$1} #{tkfunc} #{dir}"
           # find_library($1, tkfunc, dir)
    

@@ -675,10 +669,10 @@
path_list = []

  #if TkLib_Config["ActiveTcl"]
  • path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse

  • path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse

    #end
    if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path
  •  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
    
  •  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
    

    end

    vers = get_shlib_versions
    @@ -691,16 +685,16 @@
    else
    dirs = []

  •      if !Dir.glob(head + "-*").empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
    
  •      if !Dir.glob(head + "-*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
         end
    
  •      if !Dir.glob(head + "[_-]*").empty?
    
  •        dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*").empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
    
  •        dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*").empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
    
  •      if !Dir.glob(head + "[_-]*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*", File::FNM_CASEFOLD).empty?
    
  •        dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
         end
    
         dirs
    

@@ -735,7 +729,7 @@
end
exts << ",dll,lib" if is_win32?
exts << ",bundle,dylib" if is_macosx? || /nextstep|openstep|rhapsody/ =~ RUBY_PLATFORM

  • files = Dir.glob(File.join(path, "{#{heads.join(',')}}.{#{exts}}"))
  • files = Dir.glob(File.join(path, "{#{heads.join(',')}}.{#{exts}}"), File::FNM_CASEFOLD)
    vers.find_all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} }
    end

@@ -1029,9 +1023,10 @@
TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} "
else
dir = Dir.glob(File.join(TkLib_Config["tcltk-framework"],

  •                         'Tcl.framework', '*', 'Headers'))
    
  •                         'Tcl.framework', '*', 'Headers'),
    
  •               File::FNM_CASEFOLD)
    
    TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty?
  • TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "
  • TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'), File::FNM_CASEFOLD)[0]} "
    end
$LDFLAGS << ' -framework Tk -framework Tcl'

@@ -1050,8 +1045,8 @@
defaults =
[ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ]
paths = []

  • opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
  • opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
    st = find_library("X11", "XOpenDisplay", *paths)
    unless st
    puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.")

=end

Actions #9

Updated by luislavena (Luis Lavena) over 14 years ago

=begin
Hello Hidetoshi,

Yes, the provided patch solves the issue. Now time to deal with #3253 but that is another issue.

Thank you

--
Luis Lavena

=end

Actions #10

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30066] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Fri, 7 May 2010 04:33:11 +0900
Message-ID:

Yes, the provided patch solves the issue. Now time to deal with #3253 but that is another issue.

I've committed a patch with some CROSS_COMPILING check.
Luis and Jon, thank you for your reporting.

Hidetoshi NAGAI ()
=end

Actions #11

Updated by nagai (Hidetoshi Nagai) over 14 years ago

=begin
From: Luis Lavena
Subject: [ruby-core:30066] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Fri, 7 May 2010 04:33:11 +0900
Message-ID:

Yes, the provided patch solves the issue. Now time to deal with #3253 but that is another issue.

I've committed a patch with some CROSS_COMPILING check.
Luis and Jon, thank you for your reporting.

Hidetoshi NAGAI ()

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0