Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

How to compile Code::Blocks 20.03 in 32-bit mode with TDM-GCC

(1/2) > >>

SiZiOUS:
Hello to all,

This is my first post here so let me introduce myself in summary,
I'm SiZiOUS, french hobbyist developer. I'm the author of the DreamSDK package, a project which provides a full environment for developing on Sega Dreamcast (an old video-game console released back in 1998) under Windows. This package supports Code::Blocks as the default IDE so that's why I'm here... ;)

I did a special version of the 17.12 release (which can be found here) in order to add some features to Code::Blocks, including, but not limited to:

* New compiler/options file (dc-gcc) which specify the GNU GCC Compiler for Sega Dreamcast compiler.
* The compiler and debugger plugins have been patched to run a loader before running the target.
* The Sega Dreamcast Project (dc) wizard template has been added (Note: a new sdk (codeblocks.dll) module is needed to expose the required CallHooks function in the Squirrel script, that's why almost all compiled binaries are provided in the generated patch).
I want to port my changes from the 17.12 to the 20.03 release but the difficulty here is the 20.03 release is available in both 32-bit and 64-bit targets. I've successfully compiled the 64-bit release using TDM-GCC-64 (based on MinGW-w64 project) but for the 32-bit release is much more difficult.

Indeed, building the 32-bit release is made with TDM-GCC-64 too (with the -m32 switch) because the TDM-GCC-32 is too old (based on the original MinGW.org project) and doesn't support some features needed by C::B. I finally successfully compiled C::B 20.03 in 32-bit after digging on the whole process; the issue is when I start the compiled C::B 32-bit binary, it crashes immediately with the following Windows message:


--- Code: ---0xC000007B STATUS INVALID IMAGE FORMAT
--- End code ---

This kind of error is typically happening when a 32-bit process try to load a 64-bit dependency. The thing is, I don't know where the issue is located...

So my question is simple, what is the process for building a working C::B 20.03 release for 32-bit under Windows?

Thank you very much!

PS: I think that I will commit my changes to the official trunk if you think these useful.

sodev:
Is there any specific reason why you are using the TDM-GCC toolchain? I am using the plain MinGW-w64 builds from the official site and both architectures build without problem. Just don't forget to add the required DLL's to the output directory and you are good to go.

About your issue, how did you set the -m32 switch? At the global compiler settings level? Or on project level?

stahta01:

--- Quote ---what is the process for building a working C::B 20.03 release for 32-bit under Windows?
--- End quote ---

Use an 32 bit compiler is the first step!!

The option "-m32" does not work for any of the MinGW GCC 64 bit toolchains I know about!
Edit: The MinGW GCC 64 bit toolchains I know about are all missing the 32 bit libraries needed to build Code::Blocks.

Tim S.

SiZiOUS:
First of all, thanks for the answers :)


--- Quote from: sodev on October 08, 2020, 10:29:04 pm ---Is there any specific reason why you are using the TDM-GCC toolchain?
--- End quote ---
Because it was the recommanded toolchain at least for 17.12 release. Plus, the TDM-GCC-64 toolchain can compile both 32-bit and 64-bit binaries.


--- Quote from: sodev on October 08, 2020, 10:29:04 pm ---I am using the plain MinGW-w64 builds from the official site and both architectures build without problem. Just don't forget to add the required DLL's to the output directory and you are good to go.
--- End quote ---
Thank you for your tip! I've just installed MinGW-w64 and successfully built the 32-bit release of Code::Blocks, but there is some remaining issues:

* I needed to build wxWidgets 3.1.3 with TDM-GCC-64 in both 32-bit and 64-bit flavour as I can't build that library under MinGW-w64... The windres utility included in the MinGW-w64 package can't find the main wx include dir. Which is wierd as it works with TDM-GCC-64...
* When I build the C::B executable I need to copy some of the MinGW-w64 DLL in the same directory of the target C::B, but I think I need to put somewhere the -static switch... I guess...

--- Quote from: sodev on October 08, 2020, 10:29:04 pm ---About your issue, how did you set the -m32 switch? At the global compiler settings level? Or on project level?

--- End quote ---
In the C::B GCC Compiler definition, I've just checked the -m32 checkbox, then I added some additional parameters for windres (i.e. "-F pe-i386").

For information I'm using Boost 1.64 for 32-bit C::B (as I don't want to remove Windows XP support) and Boost 1.74 for 64-bit C::B. I've compiled these with TDM-GCC-64 too.

I found this forum thread but I'm not sure if it would help me... :(


--- Quote from: stahta01 on October 08, 2020, 11:33:27 pm ---
--- Quote ---what is the process for building a working C::B 20.03 release for 32-bit under Windows?
--- End quote ---

Use an 32 bit compiler is the first step!!
--- End quote ---
MinGW-w64 and TDM-GCC-64 are both 32-bit/64-bit toolchains... but maybe you're right, it isn't the best process to follow. :(

Edit: Now, with MinGW-w64, I have an issue with the 64-bit release of C::B :o The same error message as above. Of course, I changed the definition in the GCC Compiler to point to the mingw64 directory of my MinGW-w64 toolchain...  ???

stahta01:
Does the MinGW GCC toolchain have an i686-w64-mingw32 folder to match the x86_64-w64-mingw32 folder?

If not, then you are [likely] missing the 32 bit libraries needed to build any program that is very complex.

Edit: You are likely wanting an MinGW GCC built with "--enable-multilib".

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version