PDA

View Full Version : How to configure gcc for command line use?




DavidInNH
Oct 6, 2009, 07:45 PM
Hi all and sorry if this is too basic a question for this group. I've programmed for many (too many?) years but now find myself doing some command line programming of an SDK under OSX. I've successfully built the SDK on Linux and on a borrowed MacBook Pro. I now have a new MacBook Pro and can't get the code to build.

The code is not built with Xcode but gcc from a terminal window after running autogen.sh and configure to set up the environment. These files built properly under the same toolset on two other MacBooks but they'd previously been used by other programmers to do Xcode work.

Is there a tool to configure how autogen and configure generate makefiles? Is there somewhere to point me to such documentation as will make this work clear to me? Thanks to all in advance.



Cromulent
Oct 6, 2009, 09:59 PM
You need to install Xcode to get all the developer tools.

DavidInNH
Oct 7, 2009, 07:51 PM
You need to install Xcode to get all the developer tools.
I understand that. I've installed all the tools but I don't see how to configure gcc to (for example,) not treat warnings as errors.

Do you have insight into how to do this for command line use or where I could find such information? Thanks.

electroshock
Oct 7, 2009, 08:10 PM
I understand that. I've installed all the tools but I don't see how to configure gcc to (for example,) not treat warnings as errors.

Do you have insight into how to do this for command line use or where I could find such information? Thanks.

That's kind of strange because by default, gcc only stops on errors and treats warnings as, well, warnings. :) Can you paste a compile session (for at least the cc/gcc invocation and any subsequent messages) showing gcc treating a warning as an error?

P.S. 'man gcc' for info on all the available gcc command line options. On MacOS X, it has some additional MacOS X-specific arguments along with the stock stuff.

Ti_Poussin
Oct 7, 2009, 09:06 PM
Ensure that the version of gcc is the same on both machine. Maybe some "warning" you get have been change to error with a newer version of gcc (gcc 3 was way too permissive with bad code). Next verify that the flags use when compiling, treating warning with error is the -pedantic and -Wall or stuff like.

But you want my advice, nearly all error reported by gcc is a real code problem hidden somehow, you should fix those. We use pedantic and report warning as errors at my current job, medical software and in the end it's totally worth it.

N.B.: Check you're not compiling universal binary or for multiple platform or 32-64 bits.

N.B.: Maybe remove the -O3 to an -O2 if you have bad code may be badly optimize.

May help more if you give the command that failed and the context of error you get.

Cromulent
Oct 7, 2009, 11:44 PM
I understand that. I've installed all the tools but I don't see how to configure gcc to (for example,) not treat warnings as errors.

Do you have insight into how to do this for command line use or where I could find such information? Thanks.

Ah, your terminology confused me.

See the gcc man page for all the information you need regarding command line switches (and quite a bit more besides).