对BIND进行configure配置,加入-Wall与-Werror编译选项,通过–help查询如何添加
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
CPP C preprocessor
使用CFLAGS环境变量即可
配置如下
./configure CFLAGS="-Wall -Werror" --without-openssl
但是在配置过程中出现错误,最后的错误如下:
checking st_mtim.tv_nsec... no
checking for type rlim_t... no
checking type of rlim_cur... configure: error: unable to determine sizeof rlim_cur
通过在BIND目录下config.log
配置log观察
vim config.log
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
main() { struct rlimit r; exit(!(sizeof(r.rlim_cur) == sizeof(long int)));}
configure:20435: gcc -o conftest -Wall -Werror -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -D__APPLE_USE_RFC_3542 conftest.c -l pthread -L/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm >&5
conftest.c:90:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
在对rlim_cur进行编译检测时,因为打开了-Wall 与 -Werror,导致自检的程序出错,配置失败。
那么如何打开-Werror的编译配置呢?再通过–help观察:
--enable-warn-error turn on -Werror when compiling
需要添加这个配置,不要传入-Werror
./configure CFLAGS="-Wall" --without-openssl --enable-warn-error
配置通过。
查看输出对比
checking st_mtim.tv_nsec... no
checking for type rlim_t... yes
checking for strings.h... (cached) yes
假如刚才的配置通过,对于后续的编译,会产生不可预测的问题,这里检查rlim_t是可用,而刚才的配置检测是no,这个与configure检测有关,有些生成代码检测失败不会退出,只是标注无法使用。