【问题标题】:NginX 0.9.6 Frustrating Compile Issues Ubuntu/GCC 4.6.1NginX 0.9.6 令人沮丧的编译问题 Ubuntu/GCC 4.6.1
【发布时间】:2011-03-27 18:14:27
【问题描述】:

今天我一直在设置额外的 VPS 克隆,但在使用最新的 nginx 开发版本 (0.9.6) 时遇到了一个奇怪且令人沮丧的编译时错误。

我正在运行 Ubuntu 10.04.2 LTS x86_64,但是,我已将 GCC 升级到 4.6.1。 ./configure 运行时没有错误,但在运行 make -j4 时出现以下错误:

gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event -I src/事件/模块 -I src/os/unix -I objs \ -o objs/src/core/ngx_open_file_cache.o \ src/core/ngx_open_file_cache.c src/core/ngx_resolver.c:在函数中 'ngx_resolver_process_ptr': src/core/ngx_resolver.c:1425:43: 错误:变量 'qclass' 已设置但未设置 使用 [-Werror=unused-but-set-variable] src/core/ngx_resolver.c:1425:36: 错误:变量 'qtype' 已设置但未设置 使用 [-Werror=unused-but-set-variable] cc1:所有警告都被视为 错误

制作[1]: * [objs/src/core/ngx_resolver.o] 错误 1 make[1]: * 等待未完成 工作.... make[1]: 离开目录 `/root/nginx-0.9.6' make: *** [build] 错误 2

(最好在 pastebin 看到:http://pastebin.com/g0bNS2nY

我尝试将 --with--cc-opt="-W" 添加到 ./configure 选项,但没有结果。谁能解释一下这个节目的终结者?

提前非常感谢!

【问题讨论】:

  • 嗯,是的,这是 gcc-4.6.0 的候选版本。顺便说一句,4.6.0 已在四天后发布。

标签: gcc nginx compilation


【解决方案1】:

更好的方法是将以下内容传递给 ./configure

--with-cc-opt=-Wno-error

【讨论】:

  • 当我的 nginx 编译开始抛出 src/core/nginx.c:1118: warning: unused parameter ‘cmd’ 错误时,这非常有效。
【解决方案2】:

编辑Makefile,删除-Werror。该选项意味着:如果某些事情看起来不正确,请立即退出编译器。或者手动运行出错的编译命令,再次不带-Werror 标志:

gcc -c -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function \
 -Wunused-variable -Wunused-value -g  -Isrc/core -Isrc/event \
 -Isrc/event/modules -Isrc/os/unix -Iobjs \
 -o objs/src/core/ngx_open_file_cache.o src/core/ngx_open_file_cache.c

【讨论】:

  • 谢谢 - 对于其他遇到此问题的人,请运行您的 ./configure 选项,然后编辑生成的 objs/Makefile 并删除 -Werror 开关。之后运行 make -j4 就像做梦一样!
  • @Peter:这个包真的把-Werror 放在它的生产构建设置中了吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-19
  • 2011-05-08
  • 2012-04-03
  • 1970-01-01
  • 2012-10-25
  • 1970-01-01
相关资源
最近更新 更多