Trying to compile a C++ kernel project with MinGW & NASM (formerly DJGPP & NASM). Have actually tried Cygwin too, with the exact same results below:
- First, just swapped out
\DJGPP\bin
for\MinGW\bin
. Got the following link error:target coff-go32 not found.
- Swapped target to
elf32-i386
, and gotcannot perform PE operations on non PE output file 'build/kernel.elf'
This was a bit of a weird error, since to my knowledge I'm not doing any 'PE operations'. - Changed target again, to
pe-i386
, got a new errorbuild/Common.o:Common.cc:(.text+0x2a): undefined reference to 'atexit'
It seems MinGW is generating atexit
calls for static classes. DJGPP did not. The kernel does it's own DTOR handling during shutdown. I am aware that defining atexit
would 'solve' this, but that would be more of a hack at this point, and not a longterm solution. I want rather to get MinGW compiling the existing code without any (or minimal) modifications.
Frankly, I'm not that familiar with the Windows build environment and could use any tips on what to do. The project (minus the changes listed above) compiles and boots fine under DJGPP. The difference seems to be in the way DJGGP and MinGW handle compile-time class declarations?
EDIT: Finally broke down and built a cross-compiler on Cygwin. All working now.