Page 1 of 1
Linking fpc files error
Posted: Thu Jul 31, 2008 8:12 am
by System123
I recently converted my os to free pascal. It compiles fine however when i try link the files i get an error 'PE operations in non PE file' or 'kernel.o is an unknown type'. The second one is when i use linux-i386 LD. I link with this command LD -T linker.ld -o kernel.Exe kernel.o console.o
Re: Linking fpc files error
Posted: Thu Jul 31, 2008 8:16 am
by Laksen
Doing this on windows?
Let's see the linker script.
What's your commandline for fpc?
Re: Linking fpc files error
Posted: Thu Jul 31, 2008 8:40 am
by AJ
Hi,
I wonder if you would benefit from the
GCC Cross-Compiler tutorial? I know you are using Pascal, but perhaps you could just cross compile binutils and use ld from there?
Cheers,
Adam
Re: Linking fpc files error
Posted: Thu Jul 31, 2008 8:58 am
by System123
When i compile pascal now it says 'ppc complied for a different system' is this because i am not using linux? If i try link using the win32 version of ld i get a whole bunch of undefined reference errors
Re: Linking fpc files error
Posted: Thu Jul 31, 2008 11:07 am
by Laksen
Could we by any chance see the whole commandline?
Re: Linking fpc files error
Posted: Fri Aug 01, 2008 2:58 am
by leledumbo
PE operations in non PE file
I assume you're targetting ELF and you're using ld that comes from MinGW (the one in FPC distribution comes from MinGW). This won't work! Though ld --help shows that it supports ELF, it actually doesn't. You need cross binutils for this (which you already have as i386-linux-ld).
kernel.o is an unknown type
This is because you're compiling the kernel without any -T or -A command line option. The default target for Win32 is of course pe(i)-i386. i386-linux-ld will target elf32-i386, check your linker script for OUTPUT_FORMAT.
Re: Linking fpc files error
Posted: Fri Aug 01, 2008 9:09 am
by System123
I compile using -AElf and -TLinux but then FPC gives me the error saying ppc32 was compiled for use on another system

Re: Linking fpc files error
Posted: Fri Aug 01, 2008 12:47 pm
by Laksen
What's ppc32? Are you sure you have the newest version?
Re: Linking fpc files error
Posted: Fri Aug 01, 2008 10:06 pm
by System123
Yes i have the latest version. If u go and look in the FPC directory u will see the exe called ppc32 i have no idea what it does. Or why it runs when i use fpc. The other thing is when i use fpc with -Tlinux and -Aelf i get an error saying it can not find the system file used. I will post a shot of the error screen
Re: Linking fpc files error
Posted: Sat Aug 02, 2008 2:41 am
by System123
Ok i finally fixed the problem. My system.o file was not compiled for linux and thus i could not use it. I recompiled it and made the changes and now it works fine. Still one or two bugs to sort out in the includes but im almost done. Thanks for your help