Bug "File too big" in debug mode

wick

Member
3rd Party Module Dev
Tutorial Author
Patreon Bronze
Joined
Jul 17, 2017
Messages
69
I'm porting over my rather-large project from Monkey to Cerberus, and getting a new error when I compile for glfw in debug mode:

Semanting...
Translating...
Building...
g++ -m64 -O0 -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Debug64/main.o ../main.cpp
C:/MinGW/bin/........./x86_64-w64-mingw32/bin/as.exe: build/Debug64/main.o: too many sections (43479)
C:\.........\gcc_winnt\build\Debug64\ccr26HyC.s: Assembler messages:
C:\.........\gcc_winnt\build\Debug64\ccr26HyC.s: Fatal error: can't write build/Debug64/main.o: File too big
C:/........./x86_64-w64-mingw32/bin/as.exe: build/Debug64/main.o: too many sections (43479)
C:\.........\gcc_winnt\build\Debug64\ccr26HyC.s: Fatal error: can't close build/Debug64/main.o: File too big
Makefile:59: recipe for target 'build/Debug64/main.o' failed
mingw32-make: *** [build/Debug64/main.o] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O0" LDOPTS=" -m64 -LC:/Cerberus/libs/Win64" LIBOPTS=" -lopenal32 -lcurldll" OUT="Debug64/CerberusGame"', return code=2
Abnormal program termination.
Exit code: -1

(truncated for clarity & emphasis mine)

Compiles in html5 fine, and release-mode for glfw. I'm on windows. Any thoughts?
 
Last edited:

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
795
This is one of the major flaws with how Monkey/Cerberus works when using any GCC compiler. You will have to use a Visual Studio compiler to compile large projects. The original design of Monkey using MinGW as far as I can gather, was only meant to be used to compile simple command line applications such as transcc. I guess the main reason MinGW was chosen over the Microsoft native compiler tool chains (not MSBUILD) for this task was that it requires a bit of shell environment trickery to set up.

Google: MinGW object file too large too many sections.

One solution would be to have the debug information as an external file, thus reducing the size of the object file.
 

wick

Member
3rd Party Module Dev
Tutorial Author
Patreon Bronze
Joined
Jul 17, 2017
Messages
69
did it compile fine in debug mode in MX?
Excellent question, should have double-checked before I posted. But yeah, I just compiled it with Ted in MX versus CX, and I only get the error in CX debug mode.

For comparison, here's the readout I get when compiling in MX debug mode (again, which works):
Semanting...
Translating...
Building...
g++ -m32 -O0 -Wno-free-nonheap-object -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Debug32/main.o ../main.cpp
g++ -m32 -Wl,--subsystem,windows -L../openal/libs/Win32 -L../openal/libs/Win64 -o Debug32/MonkeyGame build/Debug32/context.o build/Debug32/init.o build/Debug32/input.o build/Debug32/monitor.o build/Debug32/wgl_context.o build/Debug32/win32_init.o build/Debug32/win32_monitor.o build/Debug32/win32_time.o build/Debug32/win32_tls.o build/Debug32/win32_window.o build/Debug32/window.o build/Debug32/winmm_joystick.o build/Debug32/stb_vorbis.o build/Debug32/stb_image.o build/Debug32/main.o -lcomdlg32 -lgdi32 -lopengl32 -lOpenAL32 -lws2_32

Compiler commands are pretty much black magic to me, but is there a difference between the -m64 in the CX message versus -m32 in MX?

@dawlane:
Thanks --- I found this stackoverflow. They say to "pass -Wa,-mbig-obj to gcc", but I'm really not sure how to do that. Or, alternatively, how I'd go about telling CX to use a visual studio compiler. I see a couple of references in the mojolabs archives (one two three), do you think I should just poke around and try to follow those directions?
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
795
Thanks --- I found this stackoverflow. They say to "pass -Wa,-mbig-obj to gcc", but I'm really not sure how to do that. Or, alternatively, how I'd go about telling CX to use a visual studio compiler. I see a couple of references in the mojolabs archives (one two three), do you think I should just poke around and try to follow those directions?

Online Docs App configs.

#GLFW_USE_MINGW=True 'Set to false on Windows to use MSVC instead of MinGW to build glfw apps. Needs VS 2015 installed.
#GLFW_GCC_CC_OPTS="" 'Pass compiler options to GCC type compilers
#GLFW_GCC_LD_OPTS="" 'Pass linker options to GCC type compilers

but is there a difference between the -m64 in the CX message versus -m32 in MX?
From https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options
These ‘-m’ switches are supported in addition to the above on x86-64 processors in 64-bit environments.

-m32
-m64
-mx32
-m16
-miamcu
Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32 option sets int, long, and pointer types to 32 bits, and generates code that runs on any i386 system.

The -m64 option sets int to 32 bits and long and pointer types to 64 bits, and generates code for the x86-64 architecture. For Darwin only the -m64 option also turns off the -fno-pic and -mdynamic-no-pic options.

The -mx32 option sets int, long, and pointer types to 32 bits, and generates code for the x86-64 architecture.

The -m16 option is the same as -m32, except for that it outputs the .code16gcc assembly directive at the beginning of the assembly output so that the binary can run in 16-bit mode.

The -miamcu option generates code which conforms to Intel MCU psABI. It requires the -m32 option to be turned on.
 
Last edited:
Top Bottom