nginx 1.3.6 编译报错 [-Werror=unused-but-set-variable]的解决

遇到类似 [-Werror=unused-but-set-variable]的错误:

/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:529:22: error: variable ‘level_indication’ set but not used [-Werror=unused-but-set-variable]
/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:528:22: error: variable ‘ profile_compatibility’ set but not used [-Werror=unused-but-set-variable]
/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:527:22: error: variable ‘ profile_indication’ set but not used  [-Werror=unused-but-set-variable]
/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/ mp4_reader.c:526:22: error: variable ‘ configuration_version’ set but not used  [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[2]: *** [objs/addon/src/mp4_reader.o] Error 1
make[2]: Leaving directory `/home/zhangbin/mserver/nginx/nginx-1.3.6'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/home/zhangbin/mserver/nginx/nginx-1.3.6'
make: *** [all] Error 2
root@ubuntu:/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7# 


直接修改nginx_mod_h264_streaming-2.2.7/的Makefile,没看到Werror啊。


Makefile是:

all:
cd $(NGINX) && ./configure --sbin-path=/usr/local/sbin --add-module=$(PWD) --with-debug --with-http_flv_module
make --directory=$(NGINX)


CONFIG里有CFLAGS:

CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -DBUILDING_NGINX"


Makefile会去读CONFIG么?




nginx的Makefile:

default: build


clean:
rm -rf Makefile objs


build:
$(MAKE) -f objs/Makefile
$(MAKE) -f objs/Makefile manpage



objs的Makefile:

CC = gcc
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -D_LARGEFILE_SOURCE -DBUILDING_NGINX
CPP = gcc -E
LINK = $(CC)



ALL_INCS = -I src/core \
-I src/event \
-I src/event/modules \
-I src/os/unix \
-I objs \
-I src/http \
-I src/http/modules \
-I src/mail

去掉Werror就可以了。




实际使用的编译指令是:


objs/addon/src/mp4_reader.o: $(ADDON_DEPS) \
/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c
$(CC) -c $(CFLAGS)  $(ALL_INCS) \
-o objs/addon/src/mp4_reader.o \
/home/zhangbin/mserver/nginx/nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c



所以264_mod的编译是nginx的Makefile控制的,与264内部自带的Makefile无关。

你可能感兴趣的:(多媒体/流媒体/live555)