无法在 Windows Subsystem for Linux(Ubuntu 18.04)中运行 Makefile 目标

无法在 Windows Subsystem for Linux(Ubuntu 18.04)中运行 Makefile 目标

我觉得我已经尝试了一切,但我觉得我错过了一些非常简单的东西。我正尝试在运行 WSL 的 Windows 机器上运行项目(在 Mac 上运行良好)的 makefile,但出现奇怪的错误。

我注意到 WSL 中的 make 版本0.8.1似乎比较旧,因此我尝试3.81按照以下步骤进行升级:

wget http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tarxvf make-3.81.tar.gz
cd make-3.81/
./configure
make

但是,我每次都会得到这个输出。当我对项目运行 make 命令时,我得到的输出与安装脚本的输出相同。

davidn0rman@WSL-Ubuntu:/tmp/make-3.81$ make
make ℹ info Invoking all target
make ℹ info Invoking config.h target
make ℹ info Invoking stamp-h1 target
(node:13860) UnhandledPromiseRejectionWarning: undefined
(node:13860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13860) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not
handled will terminate the Node.js process with a non-zero exit code.
make ✖ ERR  not found: make-$(srcdir)/config.h.in

  $ make <target...> [options]

  Options:
    --help             Show this help output
    --version          Show package version
    --debug            Enable extended log output

  Targets:
    [targets in the Makefile list here]

如果我尝试,make -v我得到以下内容,但在 Mac 上我得到版本和版权声明。

davidn0rman@WSL-Ubuntu:/tmp$ make -v
make ✖ ERR  Missing Makefile / Bakefile
make ℹ info Run "make init" to generate a Makefile.

说它令人沮丧还只是轻描淡写,想知道是否有人在 WSL 或 Ubuntu 中遇到过这种情况?Node 和 npm 都是最新的。

答案1

作为@steeldriver在这条评论中提到,我似乎让 npm make 与 make 本身一起运行。

  • 运行type -a make。理想情况下,你/usr/bin/make只想出现,我也有/usr/local/bin/make不需要的。
  • npm uninstall make -g删除后面这个 make 实例。

这解决了这个问题。

相关内容