无法从automake关闭gcc优化器,Makefile [英] Can't turn off gcc optimizer, Makefile from automake

查看:439
本文介绍了无法从automake关闭gcc优化器,Makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在调试会话中获得 ZBar 。我可以这样做,但是我无法关闭优化器,因此我的调试会话意外跳转,并且Eclipse中的许多变量被标记为 optimized-out 靛青。我在Ubuntu上运行。



我已经尽可能在Makefiles的任何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-括号-O0 -g -O0 -Q --help =优化器-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 
以下选项控制优化:
make [1]:*** [zbar / zbar_libzbar_la-config.lo]错误1
-O< number>
make:*** [all]错误2
- 快
- $
- falign-functions [禁用]
- falign-jumps [禁用]
-falign-labels [禁用]
-falign-loops [禁用]
-fasynchronous-unwind-tables [启用]
--fbranch-count-reg [启用]
-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]

等...

显然,我已经在几个地方放置了-O0。我对ZBar使用的automake没有任何经验。我试图避免从头开始制作自己的Makefile,有没有关于在哪里寻找禁用优化器的建议?我已经在Makefiles中搜索了与优化有关的所有 -O 和任何 -f ;我找不到。

解决方案

禁用优化可以在运行configure时轻松完成,或者当你运行make时。无论是

 配置CFLAGS =' -  g -O0'CXXFLAGS =' -  g -O0'



$ b $ $ $ $ $ $ CFLAGS =' -g -O0'CXXFLAGS =' - g -O0'clean all

应该做你想做的事。如果你在配置期间设置了CFLAGS / CXXFLAGS,这些值将被用于make的所有调用,而不会覆盖它们,而在make时设置它们是一次性处理。


I am trying to get ZBar in a debug session. I am able to do so, but I can't get the optimizer to turn off, so my debug session jumps around unexpectedly and many variables are labeled as optimized-out in Eclipse Indigo. I am running in Ubuntu.

I have tried adding -O0 as far right in any gcc call in the Makefiles as possible, since the last -O is the acting one. I used -Q --help=optimizers to find what to be looking for, but its output is a bit odd:

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...

Obviously, I've been putting -O0 in several places. I don't have any experience with automake, which is used by ZBar. I'm trying to avoid having to make my own Makefile from scratch, are there any suggestions on where to look to disable the optimizer? I have already searched the Makefiles for all the -O's and any -f's related to optimization; I've found none. The project was cleaned after the Makefile modification attempts were made.

解决方案

Disabling optimizations can most easily be done when you run configure, or when you run make. Either

configure CFLAGS='-g -O0' CXXFLAGS='-g -O0'

or

make CFLAGS='-g -O0' CXXFLAGS='-g -O0' clean all

should do what you want. If you set CFLAGS/CXXFLAGS during configure, those values will be used for all invocations of make that do not override them, while setting them at make time is a one-time deal.

这篇关于无法从automake关闭gcc优化器,Makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆