制作rpm包的过程可能会遇见的一些问题

文章是转载的Terry_Tsang ,文末附有链接。今天在做RPM包时遇见了一个问题,一直提示这个错误

./configure: error: invalid option "--host=x86_64-redhat-linux-gnu",在网上找了很久才看到这篇文章,所以转发一下,顺便留存一份以供以后自己参考

参见编译错误信息
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"

./configure: error: invalid option "--host=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 进行取代,最好是直接将这一字段删除掉,因为我刚开始注释掉貌似还是提示这个错误,后来删除掉了才没有提示了

--------------------- 
作者:Terry_Tsang 
来源:CSDN 
原文:https://blog.csdn.net/signmem/article/details/18974587 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值