Problem with code generated with cmake vs. make files

Post Reply
bim
Posts: 6
Joined: Fri Nov 03, 2017 6:56 pm

Problem with code generated with cmake vs. make files

Post by bim » Wed Feb 07, 2018 12:14 pm

I tried creating cmake files for my old GBA project to have a bit more convenience and flexibility. I have the problem though, that the code generated with the CMake files is not the same as with the regular Makefiles - The later works, but the CMake-generated .gba crashes in the emulator after a short while, although compiler and linker options "should be" the same.
I diff'ed the object files. The all the object files generated by the assembler (from .s) are binary identical. The data object files, generated with the MaxMOD utility are binary identical. Some of the object files generated from .cpp files are identical, except the order of the compiler arguments (in the .o file due to debug output generated by "-g"). Some object files generated from .cpp are very different though and I got no idea why. Also the .elfs differ slightly in size and are linked differently when you take a look at the .map files generated.
The .gba crashes in the player routines somewhere in the emulator (visualboyadvance-m 2.0.1 on Ubuntu) with a noticeable click in the music. If I comment out the MaxMOD player routines (as-in setting IRQs, vblank-handlers etc. up, but simply not calling mmStart() to play a mod), the CMake-generated .gba does not crash...

I attached a zip with the build files and the .map, .elf and .gba files generated. I would appreciate if someone had a clue as to why the code generated is different and what could cause the problem.

WinterMute
Site Admin
Posts: 1369
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Problem with code generated with cmake vs. make files

Post by WinterMute » Sat Jun 16, 2018 7:09 pm

We've had an awful lot of trouble with cmake builds like this which is why generally we don't support it's use.

Size differences in ELF files can be a side effect of linking in a different order due to alignment and padding, it's not usually anything to worry about. We've seen similar things with different versions of Make and variances in globbing order between OSes.

object files being very different are quite concerning though. Can you determine if the compile flags are somehow different?
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests