Page 1 of 1

Compilation/Link Error with cygwin

Posted: Fri Dec 26, 2003 4:30 pm
by chrisa128
Hi all,

I just started using cygwin after hardware problems with my linux box on which my kernel compiled fine.

However with CYGWIN with gcc, nasm, and make installed I get the following error when it comes to link it...

Code: Select all

PE Operations on non PE file.
collect2: ld returned 1 exit status
make: *** [kernel32] Error 1
Any ideas appreciated people, thanks in advance.

Re:Compilation/Link Error with cygwin

Posted: Fri Dec 26, 2003 6:29 pm
by beyondsociety
PE Operations on non PE file.
collect2: ld returned 1 exit status
make: *** [kernel32] Error 1
With cygwin, ld isnt compiled to support elf out the gate. You would have to either cross-compile it to supprt elf or what I have done is set the OUTPUT_FORMAT in the linker script to "pe-i386" and compile the kernel to .exe format.

Code: Select all

OUTPUT_FORMAT = pe-i386
kernel_name = kernel.exe
Then use OBJCOPY to convert to whatever file format you want.

Code: Select all

OBJCOPY -O elf32-i386 kernel.exe kernel.elf
Hope this helps.

Re:Compilation/Link Error with cygwin

Posted: Sat Dec 27, 2003 4:40 am
by df
I think I'll put something in the FAQ about this..... it seems to pop up all the time..