问题原文
原帖链接 · user3448600 · CC BY-SA 3.0
When I run nginx -V I get something like this in the output.
--with-ld-opt='-lrt -ljemalloc -Wl,-z,relro' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion'
What is this and how to know which values need to go here when compiling nginx from source code ?
已采纳解答
原帖链接 · Antoine Albertelli · CC BY-SA 3.0
Out of the box you probably do not need to provide any flags yourself, the configure script should detect automatically some reasonable defaults.
However, in order to optimize for speed and/or security, you should probably provide a few compiler flags. Red Hat published an article about the flag collections they consider good. The flags starting with -Wl are used by the linker, so you should provide them using --with-ld-opt. E.g. -Wl,-pie would become --with-ld-opt="-pie".
Another reasonable way to do it would be to copy the options used by your distribution provided packages. The maintainer probably knows what he was doing, and you at least know it works for your use case.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
