问题描述
我有一个包:
$ apt-get source <pkg-name>
现在我正在尝试使用:
$ 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,与plain configure相同,无效。如何覆盖这些值?
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?
推荐答案
您尝试重建的程序包,设置(读取:覆盖)* FLAGS与从 dpkg-buildflags
中检索到的强化特定标志。
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
所以这应该做技巧(填写你自己的*标题):
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!