我正在尝试重新编译已经拥有Windows端口的应用程序(所以它应该可以工作)
当然,您仍然需要运行./configure
,因此您需要MSYS或MSYS2。
配置部分运行良好。现在当我运行make -n
(因此它显示执行了哪些规则)时,我得到:
$ make -n
if test ! -f config.h; then \
rm -f stamp-h1; \
make stamp-h1; \
else :; fi
! was unexpected
make: *** [config.h] Error 255
! was unexpected
是法语消息的近似翻译(因此可能略有不同),但非常提醒我一些神秘的Windows批处理文件消息。所以我认为make
使用windows native shell运行它的命令行(对于大多数简单的命令来说这不是问题,但是当它依赖于类似bash的shell时却不是这样),这个假设通过使用make debug来确认模式:
$ make -d
GNU Make 3.82
Built for i686-pc-mingw32
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
<I'll spare you that boring part then:>
Invoking recipe from Makefile:164 to update target `config.h'.
Creating temporary batch file C:\msys64\tmp\make11752-1.bat
Batch file contents:
@echo off
if test ! -f config.h; then rm -f stamp-h1; make stamp-h1; else :; fi
从make文档中,make
获取SHELL
env。变量考虑在内。
SHELL
设置为unix样式路径,但我尝试使用$ export SHELL="C:/msys64/usr/bin/bash.exe"
更改它以反映本机Windows路径(make
可能不知道MSYS2)但是没有用)
那么如何告诉make
使用bash
shell而不是Windows shell?
答案 0 :(得分:1)
专为i686-pc-mingw32而打造
该行表示您使用的是错误版本的GNU Make。您正在使用为MinGW运行时构建的一个而不是为MSYS2运行时构建的一个(Cygwin的一个分支)。
确保运行pacman -S make
以安装正确版本的GNU Make,然后运行which make
并确保它返回/usr/bin/make
。新的make应该标识为“Built for x86_64-pc-msys”。