【问题标题】:While configuring expect, found source tcl directories instead of its installation location配置期望时,找到源 tcl 目录而不是其安装位置
【发布时间】:2017-12-27 10:56:44
【问题描述】:

我正在从源代码构建gcc。我打算运行测试,这需要dejagnuexpecttcl

我首先configured tcl(为简洁起见,使用dir1而不是实际的目录),

$ cd dir1/unix
$ ./configure --prefix="$HOME/usr/local"

并建造。 然后我configured expect

$ ./configure --prefix="$HOME/usr/local"

此时在dir1中找到了tcl,即,

$ grep tcl config.log
configure:2650: result: found dir1/unix/tclConfig.sh
configure:2656: checking for existence of dir1/unix/tclConfig.sh
configure:5078: result: dir1/generic
...

我的环境产生(为简洁起见使用$HOME

LIBRARY_PATH=$HOME/usr/local/lib:...
LD_LIBRARY_PATH=$HOME/usr/local/lib:...
CPATH=$HOME/usr/local/include:...
PATH=$HOME/usr/local/bin:...

怎么可能找到tcl的源目录? 我预计tcl 可以在$HOME/usr/local 中找到。 可能expect 是在读取tcl 的配置,我觉得很奇怪。

【问题讨论】:

  • expect 的 src 目录与 tcl 的 src 目录在同一个目录中吗?
  • @pynexj - 不,不是。它们是同一级别的目录。
  • 就像/some/dir/tcl-x.x//some/dir/expect-x.x/,对吧?
  • @pynexj - 没错。
  • 它使用默认搜索在同级目录中找到了 Tcl?有什么问题?

标签: build tcl expect configure


【解决方案1】:

如果没有指定--with-tcl,它将首先尝试查看在同一目录级别中是否还有一个 Tcl 的构建目录(实际上它也会尝试更高 2 个目录级别)。例如,如果您有

/src/dir/of/expect-5.xx

然后看看有没有

/src/dir/of/tcl-8.xx
# and 
/src/dir/of/tcl-8.xx/unix/tclConfig.sh

Expect 作者可能认为人们可能先编译 Tcl,然后同时编译 Expect。 :)

查看Expect源代码中的文件tclconfig/tcl.m4,第80~105行:

 63
 64  # First check to see if --with-tcl was specified.
 65  if test x"${with_tclconfig}" != x ; then
 66      case "${with_tclconfig}" in
 67          */tclConfig.sh )
 68              if test -f "${with_tclconfig}"; then
 69                  AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
 70                  with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
 71              fi ;;
 72      esac
 73      if test -f "${with_tclconfig}/tclConfig.sh" ; then
 74          ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
 75      else
 76          AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
 77      fi
 78  fi
 79
 80  # then check for a private Tcl installation
 81  if test x"${ac_cv_c_tclconfig}" = x ; then
 82      for i in \
 83              ../tcl \
 84              `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 85              `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 86              `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 87              ../../tcl \
 88              `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 89              `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 90              `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 91              ../../../tcl \
 92              `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
 93              `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
 94              `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
 95          if test "${TEA_PLATFORM}" = "windows" \
 96                  -a -f "$i/win/tclConfig.sh" ; then
 97              ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
 98              break
 99          fi
100          if test -f "$i/unix/tclConfig.sh" ; then
101              ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
102              break
103          fi
104      done
105  fi
106

【讨论】:

  • 我理解您的意思是:1) 第 100-103 行可能负责 configure:2650: result: found dir1/unix/tclConfig.sh configure:2656: checking for existence of dir1/unix/tclConfig.sh 和,2) 在 dir1 中找到的其他文件遵循类似的行。那是对的吗?如果是这样,将其添加到答案中会很有启发性。
  • 不是以英语为母语的人。对我来说解释这些棘手的事情有点困难。确实更新了我的答案。请看一下。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-22
  • 2011-10-09
  • 2012-01-08
  • 2021-12-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多