【发布时间】:2015-01-23 07:51:30
【问题描述】:
在 Arch Linux 上的 GNUStep 下,我在全新安装时遇到了一个有趣的错误。
使用我运行的构建系统
gcc `gnustep-config --debug-flags` [other command line args]
为了根据操作系统的必要标志构建命令行。
这在 Ubuntu 下运行良好,但在 Arch Linux 上我得到一个相当随机的错误:
/usr/include/features.h:328:4: 错误:#warning _FORTIFY_SOURCE 需要使用优化编译 (-O) [-Werror=cpp]
好吧,gnustep-config --debug-flags 吐出以下内容:
-MMD -MP -D_FORTIFY_SOURCE=2 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -pthread -fPIC -g -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -march=x86-64 -mtune=generic -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fgnu-运行时 -fconstant-string-class=NSConstantString -fexec-charset=UTF-8 -I。 -I/home/qix/GNUstep/Library/Headers -I/usr/include -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/include -I/usr/include -I/ usr/lib/libffi-3.1/include/ -I/usr/lib/libffi-3.1/include -I/usr/include/libxml2 -I/usr/include/p11-kit-1
同样,我不希望对我的调试版本进行优化(后来我什至将 GNUStep 的 -g 参数覆盖为 -g2)。
有没有办法在调用gnustep-config 之后,稍后在命令行中显式取消定义 -D_FORTIFY_SOURCE?
例如,类似
gcc `gnustep-config --debug-flags` -U_FORTIFY_SOURCE ...
-U 在哪里取消定义之前定义的宏?
有什么要提的;我特意启用了-Werror,我想保留它。
【问题讨论】:
标签: gcc command-line preprocessor-directive gnustep