我最近遇到了两个开源项目 GNU GetText 和 W3M 的配置步骤的问题。
两个项目的配置步骤在同一位置失败。
检查 GCC 使用的 ld ......
系统详情:
- 操作系统:Windows 10 Pro 64 位
- MSYS2
- gcc --version: gcc.exe (Rev4, Built by MSYS2 project) 5.2.0
- gcc -dumpmachine: x86_64-w64-mingw32
- bash --version:GNU bash,版本 4.3.42(2)-release (x86_64-pc-msys)
关于可能导致这种情况的任何想法?
以下是 configure 用于执行此测试的代码。
# Check if gcc -print-prog-name=ld gives a path.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
$as_echo_n "checking for ld used by GCC... " >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
我添加了调试代码以确定问题发生的确切位置。它发生在调用 grep 的 while 循环中。