Apache2 安装错误 recipe for target 'all-recursive' failed

本文记录了在编译安装Apache HTTP Server过程中遇到的错误及解决方案,包括缺少依赖库的安装方法和正确的编译安装步骤。


I am getting error while processing make install. My code is as follows:

git clone https://github.com/apache/httpd.git
cd httpd
svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./build libtool && make && make install
./buildconf && ./configure --prefix=/usr/local && make && make install
echo "ServerName localhost" >> /usr/local/conf/httpd.conf

Error is as follow :

...
Building shared: mod_mime.la
make[4]: Entering directory '/httpd/modules/http'
/usr/local/apr/build-2/libtool --silent --mode=compile gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I. -I/httpd/os/unix -I/httpd/include -I/usr/local/apr/include/apr-2 -I/httpd/modules/aaa -I/httpd/modules/cache -I/httpd/modules/core -I/httpd/modules/database -I/httpd/modules/filters -I/httpd/modules/ldap -I/httpd/modules/loggers -I/httpd/modules/lua -I/httpd/modules/proxy -I/httpd/modules/session -I/httpd/modules/ssl -I/httpd/modules/test -I/httpd/server -I/httpd/modules/arch/unix -I/httpd/modules/dav/main -I/httpd/modules/generators -I/httpd/modules/mappers -prefer-pic -c mod_mime.c && touch mod_mime.slo
/usr/local/apr/build-2/libtool --silent --mode=link gcc -std=gnu99  -g -O2 -pthread           -o mod_mime.la -rpath /usr/local/modules -module -avoid-version  mod_mime.lo
make[4]: Leaving directory '/httpd/modules/http'
make[3]: Leaving directory '/httpd/modules/http'
make[3]: Entering directory '/httpd/modules/http2'
Building shared: mod_http2.la
make[4]: Entering directory '/httpd/modules/http2'
/usr/local/apr/build-2/libtool --silent --mode=compile gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I. -I/httpd/os/unix -I/httpd/include -I/usr/local/apr/include/apr-2 -I/httpd/modules/aaa -I/httpd/modules/cache -I/httpd/modules/core -I/httpd/modules/database -I/httpd/modules/filters -I/httpd/modules/ldap -I/httpd/modules/loggers -I/httpd/modules/lua -I/httpd/modules/proxy -I/httpd/modules/session -I/httpd/modules/ssl -I/httpd/modules/test -I/httpd/server -I/httpd/modules/arch/unix -I/httpd/modules/dav/main -I/httpd/modules/generators -I/httpd/modules/mappers -prefer-pic -c mod_h2.c && touch mod_h2.slo
mod_h2.c:25:29: fatal error: nghttp2/nghttp2.h: No such file or directory
 #include <nghttp2/nghttp2.h>
                             ^
compilation terminated.
/httpd/build/rules.mk:213: recipe for target 'mod_h2.slo' failed
make[4]: *** [mod_h2.slo] Error 1
make[3]: *** [shared-build-recursive] Error 1
make[4]: Leaving directory '/httpd/modules/http2'
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[3]: Leaving directory '/httpd/modules/http2'
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[2]: Leaving directory '/httpd/modules'
make[2]: *** [shared-build-recursive] Error 1
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[1]: Leaving directory '/httpd'
make[1]: *** [shared-build-recursive] Error 1
/httpd/build/rules.mk:75: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Please provide me the solution

share improve this question
 
 
Rollback. Why? After your edit it's a completely different question. –  A.B.  Sep 24 '15 at 14:10

1 Answer

The part

git clone https://github.com/apache/httpd.git
cd httpd
svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./build libtool && make && make install
./buildconf && ./configure --prefix=/usr/local && make && make install
echo "ServerName localhost" >> /usr/local/conf/httpd.conf

is pretty confusing. But because of the error message:

Install the missing libraries via

sudo apt-get install libnghttp2-dev
sudo apt-get install libxml2-dev

And you have to use

sudo make install

instead of

make install

at the end of your command queue. Otherwise you will probably get immediately the next error.

share improve this answer
 
 
still getting error as follow –  Ravi _SS  Sep 24 '15 at 13:29
 
checking Expat 1.0/1.1... no setting LDFLAGS to "-L/usr/local/lib" setting INCLUDES to "-I/usr/local/include" checking Expat 1.95.x in /usr/local... no nulling LDFLAGS nulling INCLUDES setting APRUTIL_EXPORT_LIBS to "" configure: error: No XML parser found! Please specify --with-expat or --with-libxml2 time="2015-09-24T18:57:58+05:30" level=info msg="The command [/bin/sh -c svn co svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./configure && make && make install] returned a non-zero code: 1" –  Ravi _SS  Sep 24 '15 at 13:29
 
sudo apt-get install libxml2-dev –  A.B.  Sep 24 '15 at 13:31
 
But already you realize that this is a new problem? –  A.B.  Sep 24 '15 at 13:32
1  
@Ravi_SS: you cannot keep on asking questions in the comments, please edit your original question and remove all these comments or just ask a new question for well... every new question you have! –  Fabby  Sep 24 '15 at 14:19 

I am getting error while processing make install. My code is as follows:

git clone https://github.com/apache/httpd.git
cd httpd
svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./build libtool && make && make install
./buildconf && ./configure --prefix=/usr/local && make && make install
echo "ServerName localhost" >> /usr/local/conf/httpd.conf

Error is as follow :

...
Building shared: mod_mime.la
make[4]: Entering directory '/httpd/modules/http'
/usr/local/apr/build-2/libtool --silent --mode=compile gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I. -I/httpd/os/unix -I/httpd/include -I/usr/local/apr/include/apr-2 -I/httpd/modules/aaa -I/httpd/modules/cache -I/httpd/modules/core -I/httpd/modules/database -I/httpd/modules/filters -I/httpd/modules/ldap -I/httpd/modules/loggers -I/httpd/modules/lua -I/httpd/modules/proxy -I/httpd/modules/session -I/httpd/modules/ssl -I/httpd/modules/test -I/httpd/server -I/httpd/modules/arch/unix -I/httpd/modules/dav/main -I/httpd/modules/generators -I/httpd/modules/mappers -prefer-pic -c mod_mime.c && touch mod_mime.slo
/usr/local/apr/build-2/libtool --silent --mode=link gcc -std=gnu99  -g -O2 -pthread           -o mod_mime.la -rpath /usr/local/modules -module -avoid-version  mod_mime.lo
make[4]: Leaving directory '/httpd/modules/http'
make[3]: Leaving directory '/httpd/modules/http'
make[3]: Entering directory '/httpd/modules/http2'
Building shared: mod_http2.la
make[4]: Entering directory '/httpd/modules/http2'
/usr/local/apr/build-2/libtool --silent --mode=compile gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I. -I/httpd/os/unix -I/httpd/include -I/usr/local/apr/include/apr-2 -I/httpd/modules/aaa -I/httpd/modules/cache -I/httpd/modules/core -I/httpd/modules/database -I/httpd/modules/filters -I/httpd/modules/ldap -I/httpd/modules/loggers -I/httpd/modules/lua -I/httpd/modules/proxy -I/httpd/modules/session -I/httpd/modules/ssl -I/httpd/modules/test -I/httpd/server -I/httpd/modules/arch/unix -I/httpd/modules/dav/main -I/httpd/modules/generators -I/httpd/modules/mappers -prefer-pic -c mod_h2.c && touch mod_h2.slo
mod_h2.c:25:29: fatal error: nghttp2/nghttp2.h: No such file or directory
 #include <nghttp2/nghttp2.h>
                             ^
compilation terminated.
/httpd/build/rules.mk:213: recipe for target 'mod_h2.slo' failed
make[4]: *** [mod_h2.slo] Error 1
make[3]: *** [shared-build-recursive] Error 1
make[4]: Leaving directory '/httpd/modules/http2'
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[3]: Leaving directory '/httpd/modules/http2'
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[2]: Leaving directory '/httpd/modules'
make[2]: *** [shared-build-recursive] Error 1
/httpd/build/rules.mk:117: recipe for target 'shared-build-recursive' failed
make[1]: Leaving directory '/httpd'
make[1]: *** [shared-build-recursive] Error 1
/httpd/build/rules.mk:75: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Please provide me the solution

share improve this question
 
    
Rollback. Why? After your edit it's a completely different question. –  A.B.  Sep 24 '15 at 14:10

1 Answer

The part

git clone https://github.com/apache/httpd.git
cd httpd
svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./build libtool && make && make install
./buildconf && ./configure --prefix=/usr/local && make && make install
echo "ServerName localhost" >> /usr/local/conf/httpd.conf

is pretty confusing. But because of the error message:

Install the missing libraries via

sudo apt-get install libnghttp2-dev
sudo apt-get install libxml2-dev

And you have to use

sudo make install

instead of

make install

at the end of your command queue. Otherwise you will probably get immediately the next error.

share improve this answer
 
    
still getting error as follow –  Ravi _SS  Sep 24 '15 at 13:29
    
checking Expat 1.0/1.1... no setting LDFLAGS to "-L/usr/local/lib" setting INCLUDES to "-I/usr/local/include" checking Expat 1.95.x in /usr/local... no nulling LDFLAGS nulling INCLUDES setting APRUTIL_EXPORT_LIBS to "" configure: error: No XML parser found! Please specify --with-expat or --with-libxml2 time="2015-09-24T18:57:58+05:30" level=info msg="The command [/bin/sh -c svn co svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && cd srclib/apr && ./buildconf && ./configure && make && make install] returned a non-zero code: 1" –  Ravi _SS  Sep 24 '15 at 13:29
    
sudo apt-get install libxml2-dev –  A.B.  Sep 24 '15 at 13:31
    
But already you realize that this is a new problem? –  A.B.  Sep 24 '15 at 13:32
1  
@Ravi_SS: you cannot keep on asking questions in the comments, please edit your original question and remove all these comments or just ask a new question for well... every new question you have! –  Fabby  Sep 24 '15 at 14:19 
<think>我们面对的是构建过程中Makefile执行失败的问题,错误指向build/Makefile的第34行,目标'all'失败。这通常发生在编译项目时,可能由多种原因引起,如编译错误、依赖缺失、环境配置问题等。以下将详细展开解决方案。 </think>### 解决 `build/Makefile:34: recipe for target 'all' failed` 错误指南 此错误表明在运行 `make all` 命令时,Makefile 第 34 行的目标规则执行失败。核心修复流程如下: #### 关键诊断步骤: ```bash # 1. 获取精确错误位置 sed -n '34p' build/Makefile # 查看第34行具体内容 # 2. 分析完整错误链 make all V=s 2>&1 | tee build.log # 保存详细日志 grep -A 10 -B 5 "recipe for target 'all' failed" build.log ``` #### 高频错误解决方案: - **场景1:命令执行失败** ```makefile all: dependency1 dependency2 $(CC) -o output source.c # 第34行 ``` → 检查编译器路径、文件权限(`chmod +x gcc`)、源文件是否存在 - **场景2:依赖缺失** ```makefile dependency1: @echo "Building dep..." # 第34行之前的依赖失败 ``` → 运行 `make -dnd` 查看依赖树,确认前置目标是否完成 - **场景3:变量未定义** ```bash make --eval="CC=gcc" all # 临时指定变量值 ``` - **场景4:并行编译冲突** ```bash make -j1 all # 禁用并行编译 ``` #### 高级修复技巧: 1. **Makefile 调试模式**: ```bash make -p > make_rules.db # 导出所有规则和变量 make -n all # 空运行显示执行序列 ``` 2. **路径修正技术**: ```makefile # 修复常见路径错误 INCLUDES := -I$(PWD)/include OBJ_DIR ?= build/obj ``` 3. **依赖关系验证**: ```bash # 检查时间戳问题 find . -name "*.o" -exec touch {} + make clean && make all ``` 4. **环境隔离测试**: ```bash # 最小化环境变量 env -i PATH=/usr/bin:/bin make all ``` > **重要提示**:第 34 行错误可能是前序错误的连锁反应,需向上追溯至少 10 行日志
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值