[fpc-pascal]cross compiler potential ?

Nikolay Nikolov nickysn1983 at netscape.net
Sun Jun 29 01:08:53 CEST 2003


Harald Houppermans wrote:

> A step by step tutorial how to create such a cross compiler would be 
> quite handy :D
>  
> 1. Where do I get binutils from windows to linux ? Compiling it myself 
> seems impossible... so many errors I am ready to give up on that.
> ( I tried mingw and cygwin, both with no luck )
>  
> 2. What do I do after I have bin utils from windows to linux. ?
>  
> Later.
>  

Never done that, but in theory it should happen this way (I think :) )

you need binutils for linux (elf) target, compiled for windows. you 
don't need all of the binutils, only the linker - "ld". (and also "as" - 
the assembler, but it's not really necessary since free pascal can use 
NASM instead, you can download it from nasm.sourceforge.net)

suppose you have ld.exe (for linux target), and nasm, you should install 
free pascal for win32, then download free pascal for linux, extract it 
to some directory and copy the RTL and the other units to 
c:\pp\units\linux  (suppose fpc is installed in c:\pp which is the default)

then compile for linux with:
fpc -TLINUX -Anasmelf filename.pas

I have only cross-compiled units this way, not programs, since I don't 
have the linker from binutils - "ld", and fpc needs it to create an 
executable binary for linux.

Isn't it just simpler to install linux on your pc? (I mean linux is 
free, etc... that's why there are many resources on the web for 
cross-compiling from linux to windows or even from linux to dos and 
(almost) nothing for windows-->linux)
And you'll need linux for testing your programs anyway, because there 
are differences. :)

for tcp/ip you can use the sockets unit which is implemented on both 
windows and linux.





More information about the fpc-pascal mailing list