[Lazarus] *** GMX Spamverdacht *** Re: Cross-compiling -> MIPS
Sven Barth
pascaldragon at googlemail.com
Tue Oct 23 23:09:45 CEST 2012
On 23.10.2012 15:49, SkyDiablo wrote:
> okay, what i have to try:
>
> 1. use lazarus 1.1 with FPC 2.7.1 (i386-win32-win32/win64) SVN-Revision
> 39124
> 2. download current fpc-build trunk 2.7.x -> D:\pas\trunc\fpcbuild\
> 3. compile with lazarus:
> D:\pas\trunc\fpcbuild\fpcsrc\compiler\ppmipsel.lpi ->
> D:\pas\trunc\fpcbuild\fpcsrc\compiler\mipsel\pp.exe
The first step is wrong. Compiling trunk is only supported by the last
release of FPC which currently is 2.6.0.
Also the last step is wrong. That is only for compiler developers.
The correct way is the following:
Open a command line and navigate to D:\pas\trunc\fpcbuild\fpcsrc.
Execute the following command (placeholders that you need to replace
correctly are marked as %...% and commented on below):
make all OS_TARGET=linux CPU_TARGET=mips BINUTILSPREFIX=%PREFIX%
CROSSBINDIR=%BINUTILSDIR%
make crossinstall OS_TARGET=linux CPU_TARGET=mips
BINUTILSPREFIX=%PREFIX% CROSSBINDIR=%BINUTILSDIR%
INSTALL_PREFIX=%INSTALLDIR%
PREFIX is the prefix of the GNU binutils you have either downloaded or
build yourself. For MIPS it should be something like "mips-elf-" or
"mips-linux-".
BINUTILSDIR is the directory where the binutils binaries are located.
Most especially "as" and "ld" (both with the %PREFIX% given above).
INSTALLDIR is the directory where you want to install that FPC to. It
should be a different directory from the "fpcsrc" directory. E.g.:
D:\pas\trunc\fpcbuild\fpcsrc-install
Note: If your FPC 2.6.0 installation is not in "PATH" you need to add
"FPC=path\to\your\fpc.exe" to your the commands containing "all".
Eventually you'll might also want to do a "make all install
INSTALL_PREFIX=%INSTALLDIR%" before all that to install a win32 compiler
and (to ease usage) the "fpc" binary.
You then need to add a fpc.cfg to %INSTALLDIR%\bin\i386-win32 (or to be
more precise: the directory where the ppcrossmips binary is located).
You can e.g. copy the one from your 2.6.0 installation and adjust the
paths in it.
Then it should work to call either "INSTALLDIR\bin\i386-win32\fpc
-Pmips" or "ppcrossmips" to compile for MIPS. You also need to either
specify the values given for %PREFIX% and %BINUTILSDIR% either on the
command line (using -XP%PREFIX% (e.g. "-XPmips-elf-") and
-FD%BINUTILSDIR%) or in the fpc.cfg in the following way:
ifdef CROSSCOMPILING
ifdef CPUMIPS
-XP%PREFIX%
-FD%BINUTILSDIR%
endif
endif
If you use any Linux libraries (e.g. libc, sqlite, etc.) you need to
have those available on your development system as well and pass the
correct paths to the compiler (I don't remember the correct parameters
though as I'm rather seldomly doing a cross compile... :( )
Regards,
Sven
More information about the Lazarus
mailing list