PDA

View Full Version : I want to disable compile optimisation linux gcc



forsubhi
April 16th, 2012, 08:19 PM
I don't know if this forums accept programming Question , so if one know please tell me that

I want to disable compile optimisation in linux gcc compiler and then debug that code with eclipse cdt , any one know how to do that ?

lovinglinux
April 16th, 2012, 10:55 PM
Moved to Packaging and Compiling Programs

r-senior
April 16th, 2012, 11:56 PM
The option to pass to gcc is '-O0'. That's minus, capital-O, zero. But that's the default for gcc anyway, unless the build settings in Eclipse overrride it with -O1, -O2, etc.

forsubhi
April 17th, 2012, 12:58 AM
I have imported my project in eclipse using new --> make file project from existing resource

so I have Question , DO I have to go to make file and edit it or go to eclipse and then to project properties .

My project is SphinxTrain which is open source project available at
http://sourceforge.net/projects/cmusphinx/files/sphinxtrain/1.0.7/

r-senior
April 17th, 2012, 10:47 AM
In that case, the setting is probably in the Makefile.

If it's using GNU autotools be careful where you make the change because the Makefile may be generated. You'll know it is if you have configure.in, Makefile.am, etc.

forsubhi
April 18th, 2012, 02:25 PM
thamks r-senior I use
configure CFLAG '-O0' CXXFLAF '-O0' , and the optimisation become less than before , but I still have the following problems

http://ubuntuforums.org/showthread.php?t=1960624

please help me

bregma
April 18th, 2012, 02:54 PM
configure CFLAG '-O0' CXXFLAF '-O0'
That should be ./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3' and make sure there is no space around the '='. Make sure you do a full rebuild after this (make clean; make).

forsubhi
April 18th, 2012, 03:07 PM
oh sorry this is the command that I used


./configure CXXFLAGS='-g -O0' CFLAGS='-g -O0'
what is the difference between this command and


./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3' note : I choose linux GCC from toolchain when I make project with eclipse

forsubhi
April 18th, 2012, 03:12 PM
I use
./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3'
but I still see variable without values and eclipse show me optimized out , it there any additional steps to do in eclipse?

MadCow108
April 19th, 2012, 07:16 PM
please don't open two threads on the same subject, the answer has been posted here:
http://ubuntuforums.org/showthread.php?t=1961086

forsubhi
April 20th, 2012, 06:12 AM
thank you MadCow108