nginx 编译错误解决方法 [备忘]

简介: 参见编译错误信息can not detect int size 增加参数可以跳过--with-ld-opt="-lstdc++" --with-cpp_test_module   参考编译错误信息 make[3]: Leaving directory `/apps/lib/openssl-1.0.0k/crypto'make[2]: Leaving directory `/
参见编译错误信息
can not detect int size

增加参数可以跳过
--with-ld-opt="-lstdc++" --with-cpp_test_module


 

参考编译错误信息

make[3]: Leaving directory `/apps/lib/openssl-1.0.0k/crypto'
make[2]: Leaving directory `/apps/lib/openssl-1.0.0k'
make[1]: *** [/apps/lib/openssl-1.0.0k/.openssl/include/openssl/ssl.h] Error 2
make[1]: Leaving directory `/root/rpmbuild/BUILD/nginx-1.4.4'
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.uh3FA8 (%build)


 

解决方法

直接下载 openssl-%{version} 对应源码, 并解压至对应目录如 /usr/local/openssl-1.0.0k

另外需要修改 $nginx-1.4.4_source/auto/lib/openssl/conf 文件

注释 #           CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include" #           CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" #           CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" #           CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" 修改成下面样子             CORE_INCS="$CORE_INCS $OPENSSL/include"             CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"             CORE_LIBS="$CORE_LIBS $OPENSSL/libssl.a"             CORE_LIBS="$CORE_LIBS $OPENSSL/libcrypto.a"             CORE_LIBS="$CORE_LIBS $NGX_LIBDL"


参考下面编译错误信息

### 参考下面编译错误信息
+ make -j2
make -f objs/Makefile
make[1]: Entering directory `/root/rpmbuild/BUILD/nginx-1.4.4'
cd /apps/lib/pcre-8.31 \
        && if [ -f Makefile ]; then make distclean; fi \
        && CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
        ./configure --disable-shared
/bin/sh: line 2: ./configure: No such file or directory
make[1]: *** [/apps/lib/pcre-8.31/Makefile] Error 127
make[1]: Leaving directory `/root/rpmbuild/BUILD/nginx-1.4.4'
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.ATriVy (%build)


解决方法

直接下载 pcre-8.31 源码, 并解压至 /usr/local/ 目录下, 重新通过参数 --with-pcre=/usr/local/pcre-xxxx 可通过编译


 

参考编译错误信息 [注:只有 rpmbuild 才出现]

+ ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/apps/svr/nginx-1.4.4 --exec-prefix=/apps/svr/nginx-1.4.4 --bindir=/apps/svr/nginx-1.4.4/bin --sbindir=/apps/svr/nginx-1.4.4/sbin --sysconfdir=/etc --datadir=/apps/svr/nginx-1.4.4/share --includedir=/apps/svr/nginx-1.4.4/include --libdir=/apps/svr/nginx-1.4.4/lib64 --libexecdir=/apps/svr/nginx-1.4.4/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --prefix=/apps/svr/nginx-1.4.4 --user=apps --group=apps --with-pcre=/apps/lib/pcre-8.34 --with-openssl=/apps/lib/openssl-1.0.0k --with-http_ssl_module --with-http_stub_status_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --add-module=/apps/lib/ngx_cache_purge-1.5 --add-module=/apps/lib/nginx-http-concat-master --prefix=/apps/svr/nginx-1.4.4 --sbin-path=/apps/svr/nginx-1.4.4/sbin/nginx --conf-path=/apps/conf/nginx-1.4.4/nginx.conf --error-log-path=/apps/logs/nginx/error.log --http-log-path=/apps/logs/nginx/access.log --pid-path=/apps/run/nginx/nginx.pid --lock-path=/apps/run/nginx/nginx.lock
./configure: error: invalid option "--build=x86_64-redhat-linux-gnu"
error: Bad exit status from /var/tmp/rpm-tmp.fvZLVc (%build)


 

解决方法
在 RMP 创建时候, 由于 nginx 不按照常规定义, 不可以定义 %{_prefix} 之类参数, 也不可以使用 %configure 这个参数进行 rpm 编译
一旦定义该参数, 会导致编译自动增加下面参数, 导致报错

+ ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= 

上述参数都不被 nginx-1.4.4 编译所支持

因此必须屏蔽 spec 文件中 %configure 字段, 使用 ./configure 进行取代

目录
相关文章
|
2月前
|
前端开发 Java 应用服务中间件
Nginx访问异常的解决方法
Nginx访问异常的解决方法
|
1月前
|
前端开发 应用服务中间件 Apache
【nginx】405 not allowed问题解决方法
【nginx】405 not allowed问题解决方法
18 0
|
5月前
|
应用服务中间件 nginx
nginx405异常原因与解决方法,最详细解释
nginx405异常原因与解决方法,最详细解释
137 1
|
安全 应用服务中间件 网络安全
用Nginx在win2008服务器部署ssl后xmlhttp异常(msxml6.dll 错误 ‘80072f7d‘ )的解决方法
用Nginx在win2008服务器部署ssl后xmlhttp异常(msxml6.dll 错误 ‘80072f7d‘ )的解决方法
174 1
用Nginx在win2008服务器部署ssl后xmlhttp异常(msxml6.dll 错误 ‘80072f7d‘ )的解决方法
|
Web App开发 安全 应用服务中间件
【建站知识】360安全检测出轻微 X-Frame-Options头未设置,iis、apache、nginx使用X-Frame-Options防止网页被Frame的解决方法
当然也是因为被360检测到了示"X-Frame-Options头未设置",根据360的提示与百度了一些网上的一些资料整理了下,完美解决问题。
2596 0
|
Web App开发 前端开发 应用服务中间件