centos 7.2 make: *** No rule to make target `build', needed by `default'. Stop.

在新的服务器安装nginx,在make编译时报错:

make: *** No rule to make target `build', needed by `default'. Stop.

错误重现

进入nginx的目录,先编译参数:

./configure \

--prefix=/usr/local/nginx \

--pid-path=/usr/local/nginx/run \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--with-pcre \

--with-http_image_filter_module \

--with-debug \

 

然后  make

报错如下:

 

百度上说是要安装前置依赖,像gcc ,openssl等,但是我make之前已经安装了这些依赖。

我的解决方式:

更新yum

yum update

更新完成后,先删除之前准备make的nginx包,然后重新解压一个。

 

安装前置库:

[root@cqakserver local]# yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel

进入nginx目录重新编译一次参数:

./configure \

--prefix=/usr/local/nginx \

--pid-path=/usr/local/nginx/run \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--with-pcre \

--with-http_image_filter_module \

--with-debug \

 

再次 make && make install 

成功了。

 

 

### 解决`make install`时报错"No rule to make target 'install'" 当遇到`make: *** No rule to make target ‘install’. Stop.`这样的错误提示时,通常意味着当前Makefile中并没有定义`install`目标。这可能是由于配置脚本未正确执行或是源码包本身不支持直接的`make install`操作。 对于特定于Nginx的情况,在编译安装过程中如果遇到了类似的错误,则可能是因为缺少必要的开发库文件或者是configure阶段未能成功完成所致[^2]。为了确保能够顺利地进行到`make install`步骤,建议先确认已经安装了所有必需的依赖项: ```bash yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel ``` 此外,还需要注意的是某些软件包可能会因为版本差异或者其他原因而导致默认的构建流程有所变化。例如,在处理gawk这类工具的时候,除了上述提到的基础依赖外,还应该考虑是否需要额外指定一些选项来调整其行为模式,比如通过添加`--disable-fortran`参数给configure命令可以绕过Fortran相关部分从而避免潜在的问题[^4]。 针对具体的Nginx安装过程中的此类问题,还可以尝试以下方法之一: - **重新运行 configure 脚本**:有时候简单的重复一次configure就能解决问题。 - **检查官方文档或社区资源**:查阅最新的官方指南或者论坛帖子往往能提供更针对性的帮助信息。 - **验证下载源码完整性**:确保所使用的tarball没有损坏,并且是从可信渠道获取而来。 最后值得注意的一点是在CentOS环境下有时会受到YUM插件的影响而造成意想不到的结果,可以通过修改配置文件暂时禁用fastestmirror插件来看看是否有改善效果[^5]。 ```bash sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf ``` 以上措施有助于排查并最终解决`make install`失败的问题。
评论 24
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值