如何覆盖 dpkg-buildflags CFLAGS? [英] How to override dpkg-buildflags CFLAGS?
问题描述
我收到了一个包裹:
$ apt-get source <pkg-name>
现在我正在尝试构建它:
and now I am trying to build it with:
$ dpkg-buildpackage -uc -us -j8
在输出的开头,声明:
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro
我想覆盖这些 CFLAGS(也就是 LDFLAGS).我已经尝试导出 CFLAGS envvar,就像我们使用普通配置一样,但无济于事.如何覆盖这些值?
I would like to override these CFLAGS (also, the LDFLAGS). I have tried exporting the CFLAGS envvar, the same way we do with plain configure, at no avail. How can I override these values?
推荐答案
您尝试重建的包,使用从 dpkg-buildflags 检索到的强化特定标志设置(读取:覆盖)*FLAGS
.
the package you are trying to rebuild, sets (read: overrides) the *FLAGS with hardening-specifics flags retrieved from dpkg-buildflags
.
如果您出于自己的目的需要覆盖这些标志,您应该告诉 dpkg-buildflags
提供您想要的标志,而不是(强化)默认值.查看 man dpkg-buildflags
,您会找到关于环境变量的部分,尤其是.见 DEB_flag_SET
和 DEB_flag_APPEND
if you need to override those flags for your own purposes, you should tell dpkg-buildflags
to provide the flags you want, rather than the (hardening) defaults.
looking at man dpkg-buildflags
, you find the section about environment variables, esp. see DEB_flag_SET
and DEB_flag_APPEND
所以这应该可以解决问题(填写您自己的 *FLAGS):
so this should do the trick (fill in your own *FLAGS):
$ DEB_CPPFLAGS_SET="-I/foo/bar/baz" DEB_CFLAGS_SET="-g -O6" DEB_LDFLAGS_SET="-L/fruzzel/frazzel/" dpkg-buildpackage -uc -us -j8 -rfakeroot
这篇关于如何覆盖 dpkg-buildflags CFLAGS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!