User forums > Using Code::Blocks

SConstruct (Scons)

<< < (4/6) > >>

Mad Scientist:

--- Quote ---Actually, this is a Linux project and I'm using gcc compiler.
--- End quote ---
O ok cool, then you could use the options "-Wall -O3 -pipe" ( warnings all treated as errors, level 3 opts, and pipe data instead of files ) instead of the "-0x". Also note though that scons will default to the msvc compiler if it is installed and in the PATH env var.

As to 16 bit 32 bit and 64 bit builds, I don't know about msvc but with gcc I haven't seen it as an option. I believe it would be considered a cross-compile if you are on a 32 bit computer just as mingw32 is a cross compile on Linux. So you would need to get a compiler built for 16 bit, probably would be a define in the build but I dont know how it is done.

johne53:
Today I decided to cheat and read the manual..!! I discovered that for my particular platform (x86) the g++ compiler can accept the optional parameters -m32 and -m64. So I'm assuming that in the absence of these it might default to 16-bit compilation. There's also an option called -mcmodel (which stands for "code model") but exactly what that is, doesn't seem to be explained anywhere.

If I wanted to experiment, how would I go about passing these parameters to the compiler from within Code::Blocks?

oBFusCATed:

--- Quote from: johne53 on July 30, 2007, 05:33:45 pm ---So I'm assuming that in the absence of these it might default to 16-bit compilation.

--- End quote ---
You are totally wrong :)

The default value depends on the architecture the compiler was build for(x86 -> 32bits, amd64/x86_64 -> 64bits).

I think linux can't be built for a 16bit architecture. :)

To be sure what is happening try to make scons and C::B print the commands they are executing (eg: gcc .... ).
For scons I don't know how to do it, but for C::B there is options in options->compiler & debugger -> other -> full compiler output ( I'm not 100% sure that the menus are named that, no C::B in front of me).

johne53:
This is slowly driving me nuts..! Here's the command that gets sent to g++ (by Scons) for compiling one of the relevant source files:-


--- Code: ---g++ -o libs/sigc++2/sigc++/connection.os -c -g -DARCH_X86 -msse -mfpmath=sse -DUSE_XMMINTRIN
-DBUILD_SSE_OPTIMIZATIONS -Wall -DHAVE_LIBLO -DENABLE_NLS -Woverloaded-virtual -fPIC -Ilibs/sigc++2 libs/sigc++2/sigc++/connection.cc
--- End code ---

As you can see, this is to compile the Debug version of connection.cc. There's only one copy of connection.cc on my sysem. I opened up a terminal window and typed that exact same command (except with a different name for the target file). Then I compared the size of my 'manual' compile with the Scons compile. Both object files were absolutely the same size. Next I entered all those parameters into my C::B project, being very careful to ensure that all the preprocessor directives were the same and all the include folders were in the same order.

And yet, the C::B object file is a different size!?! In fact, all the object files come out at a different size. Mostly bigger though occasionally smaller.

I've even checked that I haven't inadvertantly got 2 versions of gcc/g++ on my system (which I haven't). So why on earth are the C::B modules not coming out at the right size?? Could C::B be re-ordering things? Or sending some additional parameters to the compiler that I don't know about?

Is there any way to view what C::B is sending to the compiler, so I can see if there's a difference?

[Edit...] Oops, oBFusCATed - I just noticed your last sentence. I'll try that now...!

johne53:

--- Code: ---gcc -Wall -g -c -msse -mfpmath=sse -Woverloaded-virtual -fPIC -Ilibs/sigc++2 -DARCH_X86 -DUSE_XMMINTRIN -DBUILD_SSE_OPTIMIZATIONS -DHAVE_LIBLO -DENABLE_NLS
 -I/opt/gnome/lib/glib-2.0/include -I/media/SHAREDDATA/ardour2/libs/sigc++2 -I/media/SHAREDDATA/ardour2/libs/glibmm2 -I/opt/gnome/include/glib-2.0
-I/media/SHAREDDATA/ardour2/libs/pbd -I/usr/include/libxml2 -I/usr/include -I/media/SHAREDDATA/ardour2/libs
-c /media/SHAREDDATA/ardour2/libs/sigc++2/sigc++/connection.cc -o obj/Debug/sigc++/connection.o
--- End code ---

Well, there's one difference immediately obvious.... it's using the wrong compiler!! C::B is compiling ".cc" files, using gcc, whereas Scons is using g++.

Any way to force C::B to use g++ ? It doesn't seem to appear in my list of compiler options.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version