无法从automake关闭gcc优化器,Makefile

vla*_*417 9 automake gcc compiler-optimization zbar-sdk

我试图让ZBar进入调试会话.我能够这样做,但我无法关闭优化器,因此我的调试会话意外跳转,许多变量都标记为optimized-outEclipse Indigo.我在Ubuntu中运行.

我尝试尽可能在Makefile中的任何gcc调用中添加-O0,因为最后一个-O是代理的.我使用-Q --help = optimizers来查找要查找的内容,但它的输出有点奇怪:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I./include -I./zbar -I./include -O0 -O0 -Q --help=optimizers -Wall -Wno-parentheses -O0 -g -O0 -Q --help=optimizers -MT zbar/zbar_libzbar_la-config.lo -MD -MP -MF zbar/.deps/zbar_libzbar_la-config.Tpo -c zbar/config.c  -fPIC -DPIC -o zbar/.libs/zbar_libzbar_la-config.o
The following options control optimizations:
make[1]: *** [zbar/zbar_libzbar_la-config.lo] Error 1
  -O<number>                        
make: *** [all] Error 2
  -Ofast                            
  -Os                               
  -falign-functions                 [disabled]
  -falign-jumps                     [disabled]
  -falign-labels                    [disabled]
  -falign-loops                     [disabled]
  -fasynchronous-unwind-tables      [enabled]
  -fbranch-count-reg                [enabled]
  -fbranch-probabilities            [disabled]
  -fbranch-target-load-optimize     [disabled]
  -fbranch-target-load-optimize2    [disabled]
  -fbtr-bb-exclusive                [disabled]
  -fcaller-saves                    [disabled]
  -fcombine-stack-adjustments       [disabled]
  -fcommon                          [enabled]
  -fcompare-elim                    [disabled]

etc...
Run Code Online (Sandbox Code Playgroud)

显然,我一直把-O0放在几个地方.我对使用ZBar的automake没有任何经验.我试图避免从头开始创建自己的Makefile,是否有关于在何处查看禁用优化器的建议?我已经搜查了Makefile文件对所有-O的和任何-f的相关优化; 我没找到.在Makefile修改尝试完成后清理了项目.

Wil*_*ell 19

运行configure或运行make时,最容易实现禁用优化.或

configure CFLAGS='-g -O0' CXXFLAGS='-g -O0'
Run Code Online (Sandbox Code Playgroud)

要么

make CFLAGS='-g -O0' CXXFLAGS='-g -O0' clean all
Run Code Online (Sandbox Code Playgroud)

应该做你想做的事.如果在配置期间设置CFLAGS/CXXFLAGS,那么这些值将用于不覆盖它们的make的所有调用,而在make时设置它们是一次性交易.

  • 都没有效果.请注意,我不是代码的作者,而只是尝试完成算法分析.将-O0与make调用放在一起会将-O0放在任何其他标志之前以启用优化,使其无效.我没有看到在数千行Makefile代码中设置了任何优化标志...... (2认同)