Bug #3248

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

Added by Luis Lavena almost 4 years ago. Updated almost 3 years ago.

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

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

config.log.zip (28.7 KB) Luis Lavena, 05/05/2010 03:09 PM

config.status (27 KB) Luis Lavena, 05/05/2010 03:09 PM

mkmf.log.zip (1.95 KB) Luis Lavena, 05/05/2010 03:09 PM

History

#1 Updated by Hidetoshi Nagai almost 4 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

#2 Updated by Luis Lavena almost 4 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

#3 Updated by Hidetoshi Nagai almost 4 years ago

=begin
From: Luis Lavena redmine@ruby-lang.org
Subject: [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 (nagai@ai.kyutech.ac.jp)
=end

#4 Updated by Hidetoshi Nagai almost 4 years ago

=begin
From: Luis Lavena redmine@ruby-lang.org
Subject: [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 (nagai@ai.kyutech.ac.jp)

=end

#5 Updated by Luis Lavena almost 4 years ago

=begin
On Thu, May 6, 2010 at 7:09 AM, Hidetoshi NAGAI nagai@ai.kyutech.ac.jp 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

#6 Updated by Jon Forums almost 4 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 \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

#7 Updated by Hidetoshi Nagai almost 4 years ago

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

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 redmine@ruby-lang.org
Subject: [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 \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 (nagai@ai.kyutech.ac.jp)

--- 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 updateflag
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
  • pathdirs.concat Dir.glob(TkLibConfig["ActiveTcl"]).sort.reverse
  • pathdirs.concat Dir.glob(TkLibConfig["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 TkLibConfig["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)

  • #configdir.concat(Dir.glob("~/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/Library/Tcl"

  • config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/Network/Library/Tcl"

  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/Network/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/System/Library/Tcl"

  • config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/System/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    [
    #"~/Library/Frameworks",
    "/Library/Frameworks",
    @@ -483,7 +477,7 @@
    if path.kindof?(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"]

  • # pathlist.concat Dir.glob(TkLibConfig["ActiveTcl"]).sort.reverse

  • # pathlist.concat Dir.glob(TkLibConfig["ActiveTcl"], File::FNMCASEFOLD).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 = getshlibversions
    @@ -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 iswin32?
    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::FNMCASEFOLD)
    vers.find
    all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} }
    end

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

  •                         'Tcl.framework', '*', 'Headers'))
    
  •                         'Tcl.framework', '*', 'Headers'),
    
  •               File::FNM_CASEFOLD)
    

    TclConfigInfo['TCLINCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty?

  • TkConfigInfo['TKINCLUDESPEC'] = "-I#{Dir.glob(File.join(TkLibConfig['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "

  • TkConfigInfo['TKINCLUDESPEC'] = "-I#{Dir.glob(File.join(TkLibConfig['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('/')))}

  • optpaths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNMCASEFOLD))}

  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNMCASEFOLD))}
    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

#8 Updated by Hidetoshi Nagai almost 4 years ago

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

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 redmine@ruby-lang.org
Subject: [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 \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 (nagai@ai.kyutech.ac.jp)

--- 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 updateflag
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
  • pathdirs.concat Dir.glob(TkLibConfig["ActiveTcl"]).sort.reverse
  • pathdirs.concat Dir.glob(TkLibConfig["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 TkLibConfig["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)

  • #configdir.concat(Dir.glob("~/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/Library/Tcl"

  • config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/Network/Library/Tcl"

  • config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/Network/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    config_dir << "/System/Library/Tcl"

  • config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse)

  • configdir.concat(Dir.glob("/System/Library/Tcl/*", File::FNMCASEFOLD).sort.reverse)
    [
    #"~/Library/Frameworks",
    "/Library/Frameworks",
    @@ -483,7 +477,7 @@
    if path.kindof?(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"]

  • # pathlist.concat Dir.glob(TkLibConfig["ActiveTcl"]).sort.reverse

  • # pathlist.concat Dir.glob(TkLibConfig["ActiveTcl"], File::FNMCASEFOLD).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 = getshlibversions
    @@ -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 iswin32?
    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::FNMCASEFOLD)
    vers.find
    all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} }
    end

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

  •                         'Tcl.framework', '*', 'Headers'))
    
  •                         'Tcl.framework', '*', 'Headers'),
    
  •               File::FNM_CASEFOLD)
    

    TclConfigInfo['TCLINCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty?

  • TkConfigInfo['TKINCLUDESPEC'] = "-I#{Dir.glob(File.join(TkLibConfig['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "

  • TkConfigInfo['TKINCLUDESPEC'] = "-I#{Dir.glob(File.join(TkLibConfig['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('/')))}

  • optpaths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNMCASEFOLD))}

  • defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNMCASEFOLD))}
    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

#9 Updated by Luis Lavena almost 4 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

#10 Updated by Hidetoshi Nagai almost 4 years ago

=begin
From: Luis Lavena redmine@ruby-lang.org
Subject: [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 (nagai@ai.kyutech.ac.jp)
=end

#11 Updated by Hidetoshi Nagai almost 4 years ago

=begin
From: Luis Lavena redmine@ruby-lang.org
Subject: [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 (nagai@ai.kyutech.ac.jp)

=end

Also available in: Atom PDF