I decided to start migrating from assembly language to C for OSdev. I have MinGW installed on my Win7 laptop, and I have been trying to build my kernel, and I am getting the error message above. I have a batch file set up to build everything. The link command is like so:
ld -Ttext 0x10000 --oformat binary -o kernel.bin kernelstart.o kernel.o
How can I get my linker to link the files properly? I think I may need to make a cross-compiler (I even kind of know what that means), and I read the wiki page on GCC Cross-Compiler, but I have no idea how to make one. I looked at crosstool, but it was still full of confusing *nix gobbledy-gook. If I make a cross-compiler, I know I my host is Win7, but I have no idea what my target would be. I would appreciate someone who has done OSdev on Windows to help me with this.
ld: cannot perform PE operations on non PE output file.
Re: ld: cannot perform PE operations on non PE output file.
You do need a cross-compiler. And to build a cross-compiler you are recommended to begin by installing Cygwin. Once you have Cygwin it's easy. You can follow the tutorial line-by-line and because the tutorial is tested on Cygwin, it will work.
If a trainstation is where trains stop, what is a workstation ?
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: ld: cannot perform PE operations on non PE output file.
I followed the instructions on the wiki and made a cross compiler. I now have i586-elf versions of cpp, gcc, gcc-4.6.2, and gcov in /usr/local/cross/bin. Shouldn't there be ld and other binutils as well? I can't find them. I noticed something about Error 2 when building binutils. Is that my problem?
Re: ld: cannot perform PE operations on non PE output file.
Tried it again, and it worked. I have my binutils now. Will gcc work if my binutils weren't made when I built it? I will assume so, unless I hear otherwise.
Re: ld: cannot perform PE operations on non PE output file.
Seems to be working. I have my C kernel running now. Thanks everyone!
Re: ld: cannot perform PE operations on non PE output file.
Well done. Life will be much easier now.
Did you use Cygwin ?
Did you use Cygwin ?
If a trainstation is where trains stop, what is a workstation ?
Re: ld: cannot perform PE operations on non PE output file.
Yes I did. And I must say that although it was confusing to a non-Unixer, I have to recommend it.