Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-10

Cross-compiling -> MIPS

40 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

SkyDiablo

hiho!

i search a solution to build my "hello world" source from my windows x64 system to a openWRT (linux) with a MIPS CPU system -> cross-compiling?

i do not find a working solution :( now i'm trying to build with a debian system, but is dosnt work for now :(

greez & thx,
sky...

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote 7 lines
hiho! i search a solution to build my "hello world" source from my windows x64 system to a openWRT (linux) with a MIPS CPU system -> cross-compiling? i do not find a working solution :( now i'm trying to build with a debian system, but is dosnt work for now :(

First, this is the Lazarus conf and while FPC now works (subject to some potential code generation issues) targeting little-endian MIPS it's probably some while before Lazarus will. The issue here is that building Lazarus requires the current stable version of FPC (2.6.0), while MIPS is only available for trunk (2.7.1 from svn).

I suggest that this is better-discussed in the fpc-pascal mailing list, but you'll find notes on building MIPS binutils etc. at http://wiki.lazarus.freepascal.org/Native_MIPS_Systems (these are applicable to Linux). I suggest that you could usefully review the thread at
http://lists.freepascal.org/lists/fpc-devel/2012-October/030071.html which might be a better place to discuss things if you have problems building the compiler.

Note that I'm a long way down the list as far as skill is concerned, and make no claim to understand what I'm doing.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd: First, this is the Lazarus conf and while FPC now works (subject to some potential code…
Mark Morgan Lloyd wrote 15 lines
SkyDiablo wrote: > hiho! > > i search a solution to build my "hello world" source from my windows > x64 system to a openWRT (linux) with a MIPS CPU system -> > cross-compiling? > > i do not find a working solution :( now i'm trying to build with a > debian system, but is dosnt work for now :( First, this is the Lazarus conf and while FPC now works (subject to some potential code generation issues) targeting little-endian MIPS it's probably some while before Lazarus will. The issue here is that building Lazarus requires the current stable version of FPC (2.6.0), while MIPS is only available for trunk (2.7.1 from svn).

I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say 2.6.0 is needed?

Henry

Reply by email

Mark Morgan Lloyd
to Michael Schnell: I suggest first seeking for help to do a command line "Hello World" for your MIPS system…
Michael Schnell wrote 6 lines
Hi, I suggest first seeking for help to do a command line "Hello World" for your MIPS system in the fpc developer's mailing ( ) list and when this works, try to do a Lazarus application, as same involves compiling the LCL for MIPS which I suppose is a decent challenge.

I've not attempted compiling Lazarus for MIPS yet because of the FPC version issue and because at present I'm only running MIPS as a Qemu guest and performance is poor (in fact, I suspect is worse than when I first installed it). It runs well on SPARC which is one of the more demanding platforms in terms of alignment requirements etc.

Much of the performance issue could be sidestepped by doing a cross-build, but that's something that I've always managed to avoid. Note that for non-x86 targets there are a couple of IDE issues relating to the target processor type, opcode formats and so on (just leave these set to the default).

http://mantis.freepascal.org/view.php?id=20310
http://mantis.freepascal.org/view.php?id=20311

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Henry Vermaak: I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say 2.6.0 is needed?…
Henry Vermaak wrote 8 lines
> First, this is the Lazarus conf and while FPC now works (subject to some > potential code generation issues) targeting little-endian MIPS it's > probably some while before Lazarus will. The issue here is that building > Lazarus requires the current stable version of FPC (2.6.0), while MIPS > is only available for trunk (2.7.1 from svn). I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say 2.6.0 is needed?

Because of the feeling with which most developers insist that 2.6.0 is the one true way :-)

OK, I'll try it for MIPS in a couple of days. I presume you were using Lazarus trunk.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 6 lines
Henry Vermaak wrote: > I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say > 2.6.0 is needed? Because of the feeling with which most developers insist that 2.6.0 is the one true way :-)

Yes, I tend to use 2.6.0, too, but armhf port doesn't exist in 2.6.0 (afaik) :)

OK, I'll try it for MIPS in a couple of days. I presume you were using Lazarus trunk.

Yes. I remember a rule that lazarus trunk is supposed to compile with both the latest fpc release and fpc trunk. Don't know if that's still the case, though.

Henry

Reply by email

Vincent Snijders
to Henry Vermaak

2012/10/22 Henry Vermaak :

Yes. I remember a rule that lazarus trunk is supposed to compile with both the latest fpc release and fpc trunk. Don't know if that's still the case, though.

And with fixes head, because that is likely to be used by the next FPC release.

Vincent

Reply by email

SkyDiablo
to Mark Morgan Lloyd: Because of the feeling with which most developers insist that 2.6.0 is the one true way…

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

and now ? what i have to do now ? how can i compile my hello-world project for linux with a MIPS CPU ?

greez & thx,
sky...

Mark Morgan Lloyd wrote 19 lines
Henry Vermaak wrote: >> First, this is the Lazarus conf and while FPC now works (subject to >> some >> potential code generation issues) targeting little-endian MIPS it's >> probably some while before Lazarus will. The issue here is that >> building >> Lazarus requires the current stable version of FPC (2.6.0), while MIPS >> is only available for trunk (2.7.1 from svn). > > I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say > 2.6.0 is needed? Because of the feeling with which most developers insist that 2.6.0 is the one true way :-) OK, I'll try it for MIPS in a couple of days. I presume you were using Lazarus trunk.

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote 11 lines
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 and now ? what i have to do now ? how can i compile my hello-world project for linux with a MIPS CPU ?

Have you checked the compiler you've built using the -i option? Have you compiled the RTL?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to SkyDiablo: okay, what i have to try: 1. use lazarus 1.1 with FPC 2.7.1 (i386-win32-win32/win64)…
SkyDiablo wrote 8 lines
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

Reply by email

SkyDiablo
to Sven Barth

wow ! thats amazing!

okay, i create the follow batch-file:

======================================================= set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc
set PREFIX=mips-linux-
set BINUTILSDIR="C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin" set INSTALLDIR="D:\fpc\install"

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc

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%

pause
=======================================================

so, it runs and runs and runs... but then:

======================================================= C:/lazarus/fpc/2.6.0/bin/i386-win32/rm.exe -rf units_bs make[4]: Leaving directory
`D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/packages/fpmkunit '
make[3]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/packages' make[2]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make rtl_smart
FPC=D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/compiler/ppcrossmips.exe R ELEASE=1
make[2]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make -C rtl smart
make[3]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl' make -C linux smart
make[4]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' make all LINKSMART=1 CREATESMART=1
make[5]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' C:\Program Files (x86)\CodeSourcery\Sourcery G++
Lite\bin/mips-linux-as.exe -EB
-o D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/units/mips-linux/prt0.o mips/prt0.as
process_begin: CreateProcess((null), C:\Program Files (x86)\CodeSourcery\Sourcer
y G++ Lite\bin/mips-linux-as.exe -EB -o
D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/u
nits/mips-linux/prt0.o mips/prt0.as, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden. make[5]: *** [prt0.o] Error 2
make[5]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' make[4]: *** [fpc_smart] Error 2
make[4]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' make[3]: *** [linux_smart] Error 2
make[3]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl' make[2]: *** [rtl_smart] Error 2
make[2]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make[1]: *** [build-stamp.mips-linux] Error 2
make[1]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make: *** [crossinstall] Error 2
=======================================================

ERROR ALARM !!!! *fu...*

so i checked the path:

D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\rtl\units\mips-linux

the path exists, but it is emty !!! so i dont know what should i do now ? a another path exists too:

D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\rtl\units\i386-win32

there are many files inside... Sven Barth, can you held me again ?

greez & big thx,
sky...

Sven Barth wrote 74 lines
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 -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Sven Barth
to SkyDiablo
"SkyDiablo" wrote 7 lines
wow ! thats amazing! okay, i create the follow batch-file: ======================================================= set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files

(x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc

set PREFIX=mips-linux- set BINUTILSDIR="C:\Program Files (x86)\CodeSourcery\Sourcery G++

Lite\bin"

Show quoted text 5 lines
set INSTALLDIR="D:\fpc\install" cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc 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%

Show quoted text 6 lines
pause ======================================================= so, it runs and runs and runs... but then:

The error says that it can't find the "mips-linux-as" executable which is because there are spaces in the path to it. This is something make handles rather badly...

But you have already a part of the solution: you added the path to PATH. With that you can now simply remove the "CROSSBINDIR=%BINUTILSDIR%" from both commands and it should work.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121025/2136ca56/attachment.html>

Reply by email

SkyDiablo
to Sven Barth

so, next one. there was an fail PREFIX at all so i change it to "mips-linux-gnu-", this scrips works at first:

=================================================== set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin
set PREFIX=mips-linux-gnu-
set INSTALLDIR="D:\fpc\install"

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc

make all OS_TARGET=linux CPU_TARGET=mips BINUTILSPREFIX=%PREFIX% make crossinstall OS_TARGET=linux CPU_TARGET=mips
BINUTILSPREFIX=%PREFIX% INSTALL_PREFIX=%INSTALLDIR% ===================================================

but now, i get the following error:

=================================================== C:/lazarus/fpc/2.6.0/bin/i386-win32/ginstall.exe -m 755 -d D:\fpc\install/bin/i386-win32
C:/lazarus/fpc/2.6.0/bin/i386-win32/cp.exe -fp ppcrossmips.exe D:\fpc\install/bin/i386-win32/ppcrossmips.exe
make[4]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/compiler' make[3]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make rtl_install
FPC=D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/compiler/ppcrossmips.exe ZIPDESTDIR=D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc
FPCMAKE=C:/lazarus/fpc/2.6.0/bin/i386-win32/fpcmake.exe make[3]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make -C rtl install
make[4]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl' make -C linux all
make[5]: Entering directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' make[5]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl/linux' C:/lazarus/fpc/2.6.0/bin/i386-win32/fpcmake.exe -p -Tmips-linux Makefile.fpc Processing Makefile.fpc
Error: No targets set
make[4]: *** [fpc_install] Error 1
make[4]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc/rtl' make[3]: *** [rtl_install] Error 2
make[3]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make[2]: *** [installbase] Error 2
make[2]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make[1]: *** [installall] Error 2
make[1]: Leaving directory `D:/fpc/trunc/2.7.x/fpcbuild/fpcsrc' make: *** [crossinstall] Error 2
===================================================

any idea ?

greez & thx,
sky...

Sven Barth wrote 48 lines
Am 24.10.2012 22:08 schrieb "SkyDiablo" < <mailto:>>: > > wow ! thats amazing! > > okay, i create the follow batch-file: > > ======================================================= > set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc > set PREFIX=mips-linux- > set BINUTILSDIR="C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin" > set INSTALLDIR="D:\fpc\install" > > cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc > > 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% > > pause > ======================================================= > > so, it runs and runs and runs... but then: > The error says that it can't find the "mips-linux-as" executable which is because there are spaces in the path to it. This is something make handles rather badly... But you have already a part of the solution: you added the path to PATH. With that you can now simply remove the "CROSSBINDIR=%BINUTILSDIR%" from both commands and it should work. Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121025/7bbdf8c1/attachment.html>

Reply by email

Sven Barth
to SkyDiablo
SkyDiablo wrote 19 lines
so, next one. there was an fail PREFIX at all so i change it to "mips-linux-gnu-", this scrips works at first: =================================================== set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin set PREFIX=mips-linux-gnu- set INSTALLDIR="D:\fpc\install" cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc make all OS_TARGET=linux CPU_TARGET=mips BINUTILSPREFIX=%PREFIX% make crossinstall OS_TARGET=linux CPU_TARGET=mips BINUTILSPREFIX=%PREFIX% INSTALL_PREFIX=%INSTALLDIR% =================================================== but now, i get the following error:

[snip]

Show quoted text 5 lines
C:/lazarus/fpc/2.6.0/bin/i386-win32/fpcmake.exe -p -Tmips-linux Makefile.fpc Processing Makefile.fpc Error: No targets set

This is related to the fact that 2.6.0's fpcmake does not support mips-linux yet. Possible solution:

First do (once, independantly) the following:

(assuming the current dir is your 2.7.1 source directory) cd utils\fpcm
make all

And then add "FPCMAKE=%YOURSOURCEDIR%\utils\fpcm\fpcmake.exe" to the "crossinstall" line. This should hopefully help...

Regards,
Sven

Show quoted text 57 lines
Am 25.10.2012 08:39, schrieb Sven Barth: > > Am 24.10.2012 22:08 schrieb "SkyDiablo" < > <mailto:>>: > > > > wow ! thats amazing! > > > > okay, i create the follow batch-file: > > > > ======================================================= > > set PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;C:\Program Files > (x86)\CodeSourcery\Sourcery G++ Lite\lib\gcc > > set PREFIX=mips-linux- > > set BINUTILSDIR="C:\Program Files (x86)\CodeSourcery\Sourcery G++ > Lite\bin" > > set INSTALLDIR="D:\fpc\install" > > > > cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc > > > > 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% > > > > pause > > ======================================================= > > > > so, it runs and runs and runs... but then: > > > > The error says that it can't find the "mips-linux-as" executable > which is because there are spaces in the path to it. This is > something make handles rather badly... > > But you have already a part of the solution: you added the path to > PATH. With that you can now simply remove the > "CROSSBINDIR=%BINUTILSDIR%" from both commands and it should work. > > Regards, > Sven > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121025/135d3895/attachment.html>

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd: Because of the feeling with which most developers insist that 2.6.0 is the one true way…
Mark Morgan Lloyd wrote 10 lines
Henry Vermaak wrote: > I built lazarus with fpc 2.7.1 for armhf this weekend. Why do you say > 2.6.0 is needed? Because of the feeling with which most developers insist that 2.6.0 is the one true way :-) OK, I'll try it for MIPS in a couple of days. I presume you were using Lazarus trunk.

Lazarus trunk (r39158) builds OK with 2.7.1 as described in the wiki (noting the fairly strict requirement for binutils version etc.), although I note warnings like

/usr/bin/ld: /usr/lib/crti.o: warning: linking abicalls files with non-abicalls files

on the major programs (lazbuild, lazarus). Lazarus build time (i.e. excluding the compiler/RTL/FCL) was about 20 hours, emphasising the limitations of Qemu.

IDE startup showed the splash and configuration dialogue, after that it appeared to lock up taking minimal CPU, final messages were

SearchDebuggerCandidates Value=gdb File=/usr/bin/gdb NOTE: help options config file not found - using defaults TApplication.HandleException Access violation
Stack trace:
$01630294 TINDEXCURSOR__VARIANTTOBUFFER, line 168 of ./fcl-db/src/dbase/dbf_idxcur.pas
[TMainIDE.Destroy] A
[TMainIDE.Destroy] B -> inherited Destroy... TMainIDE [TMainIDE.Destroy] END

until I killed it with a ^C. Restarting resulted in an IDE which approximately ran, but was raising that exception every few seconds. It wasn't possible to "OK" past this, it would recur and either this or something else appeared to be messing up e.g. the IDE's ability to store/access ~/.lazarus configuration settings: because of this lazbuild wasn't able to build a trivial test project prepared on a different system.

Redoing with a simple make all still resulted in approximately similar behaviour, but without a reported error line etc.

Unless somebody knows that that revision had issues, I think that some more of the compiler's residual code generation issues need to be wrung out before trying Lazarus again.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Bernd
to Mark Morgan Lloyd

2012/10/25 Mark Morgan Lloyd :

something else appeared to be messing up e.g. the IDE's ability to store/access ~/.lazarus configuration settings: because of this lazbuild wasn't able to build a trivial test project prepared on a different system.

You can put environmentoptions.xml pointing to valid lazarus directory into /etc/lazarus/ (lazbuild only needs the lazarus directory, otherwise the xml file can be completely empty) and lazbuild should be able to build LCL applications without existing ~/.lazarus

Reply by email

SkyDiablo
to Sven Barth: [snip] This is related to the fact that 2.6.0's fpcmake does not support mips-linux yet.…
Show quoted text 15 lines
This is related to the fact that 2.6.0's fpcmake does not support mips-linux yet. Possible solution: First do (once, independantly) the following: (assuming the current dir is your 2.7.1 source directory) cd utils\fpcm make all And then add "FPCMAKE=%YOURSOURCEDIR%\utils\fpcm\fpcmake.exe" to the "crossinstall" line. This should hopefully help... Regards, Sven

okay, thats works fine! thx! and now, it is possible to say "lazarus" is to use this new crosscompiler?

greez & thx,
sky...

Reply by email

Sven Barth
to SkyDiablo
SkyDiablo wrote 19 lines
> This is related to the fact that 2.6.0's fpcmake does not support > mips-linux yet. Possible solution: > > First do (once, independantly) the following: > > (assuming the current dir is your 2.7.1 source directory) > cd utils\fpcm > make all > > And then add "FPCMAKE=%YOURSOURCEDIR%\utils\fpcm\fpcmake.exe" to the > "crossinstall" line. This should hopefully help... > > Regards, > Sven > okay, thats works fine! thx! and now, it is possible to say "lazarus" is to use this new crosscompiler?

You can change the compiler that Lazarus uses in "Tools" => "Options" => "Environment" => "Files" => "Compiler path".

Here you have two possiblities:
1. Do additionally a "make all install INSTALL_PREFIX=%INSTALLDIR%" and point Lazarus to the "fpc.exe" binary in the %INSTALLDIR%\bin\i386-win32 directory (this way you can also compile for Windows in your case)
2. Simply point Lazarus to the "ppcrossmips.exe"

In both cases you also need to change your target OS to "Linux" and your target CPU to "MIPS" in "Project" => "Project Options" => "Compiler Options" => "Code Generation" and then compile as usual (Ctrl + F9), but you might want to avoid using "Run" (F9) as then you'll get a "debugger has crashed" error dialog, because of the different executable format ;)

Regards,
Sven

Reply by email

Sven Barth
to Bernd: 2012/10/25 Mark Morgan Lloyd : You can put environmentoptions.xml pointing to valid…
Bernd wrote 10 lines
2012/10/25 Mark Morgan Lloyd : > something else appeared to be messing up e.g. the IDE's ability to > store/access ~/.lazarus configuration settings: because of this lazbuild > wasn't able to build a trivial test project prepared on a different system. You can put environmentoptions.xml pointing to valid lazarus directory into /etc/lazarus/ (lazbuild only needs the lazarus directory, otherwise the xml file can be completely empty) and lazbuild should be able to build LCL applications without existing ~/.lazarus

Mark can try that, but it won't help much if the error is located in the MIPS code generator ;) (and little bugs there can lead to big problems when running as I've learned with m68k ^^)

Regards,
Sven

Reply by email

Mark Morgan Lloyd
to Sven Barth
Sven Barth wrote 16 lines
On 25.10.2012 20:03, Bernd wrote: > 2012/10/25 Mark Morgan Lloyd : > >> something else appeared to be messing up e.g. the IDE's ability to >> store/access ~/.lazarus configuration settings: because of this lazbuild >> wasn't able to build a trivial test project prepared on a different >> system. > > You can put environmentoptions.xml pointing to valid lazarus directory > into /etc/lazarus/ (lazbuild only needs the lazarus directory, > otherwise the xml file can be completely empty) and lazbuild should be > able to build LCL applications without existing ~/.lazarus Mark can try that, but it won't help much if the error is located in the MIPS code generator ;) (and little bugs there can lead to big problems when running as I've learned with m68k ^^)

I'm pretty sure there are underlying problems, it appears to have been bombing out part-way through setting up the content of ~/.lazarus which contains an incomplete set of files.

I think that some of the performance problem might be an emulation or a guest kernel issue: I can see one of the kernel processes throwing a regular exception and this is probably wasting a lot of time.

I'm dropping this one for the moment to get back to rebuilding a test system and trying to re-run the SPARC tests. Apart from that I've got to get back onto other things I'm trying to work on (programmer's block )-:

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Sven Barth: You can change the compiler that Lazarus uses in "Tools" => "Options" => "Environment" =>…

ok, i play around with this stuff, but now i get this error at compiling:

project1.lpr(0,0) Fatal: Can not find unit system used by Project1.

i cant fix it :(

Sven Barth wrote 47 lines
On 25.10.2012 20:05, SkyDiablo wrote: > >> This is related to the fact that 2.6.0's fpcmake does not support >> mips-linux yet. Possible solution: >> >> First do (once, independantly) the following: >> >> (assuming the current dir is your 2.7.1 source directory) >> cd utils\fpcm >> make all >> >> And then add "FPCMAKE=%YOURSOURCEDIR%\utils\fpcm\fpcmake.exe" to the >> "crossinstall" line. This should hopefully help... >> >> Regards, >> Sven >> > > okay, thats works fine! thx! and now, it is possible to say "lazarus" is > to use this new crosscompiler? You can change the compiler that Lazarus uses in "Tools" => "Options" => "Environment" => "Files" => "Compiler path". Here you have two possiblities: 1. Do additionally a "make all install INSTALL_PREFIX=%INSTALLDIR%" and point Lazarus to the "fpc.exe" binary in the %INSTALLDIR%\bin\i386-win32 directory (this way you can also compile for Windows in your case) 2. Simply point Lazarus to the "ppcrossmips.exe" In both cases you also need to change your target OS to "Linux" and your target CPU to "MIPS" in "Project" => "Project Options" => "Compiler Options" => "Code Generation" and then compile as usual (Ctrl + F9), but you might want to avoid using "Run" (F9) as then you'll get a "debugger has crashed" error dialog, because of the different executable format ;) Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Sven Barth
to SkyDiablo
"SkyDiablo" wrote 6 lines
ok, i play around with this stuff, but now i get this error at compiling: project1.lpr(0,0) Fatal: Can not find unit system used by Project1. i cant fix it :(

There are three things you can try:
1. Ensure that your project settings ate correctly set to mips-linux and that the correct compiler is used. You can check this by doing a compile in Lazarus and when it reports the error you right click on the message window and select "copy all messages including hidden" (or so) and paste them somewhere you can read them (e.g. after the final "end." of your project) and check whether the compiler version is correct, the compiler date (your compilation date) and that the target is set correctly

2. Maybe your search path is wrong. Take a look at your 2.7.1 fpc.cfg and search for a -Fu option with "rtl" at the end and verify that this is the correct path and that a "system.ppu" and "system.o" is located there.

3. Add the option "-vut" to the "other settings" memo in the compiler options, copy the output as in 1. and check whether the compiler indeed searches in the correct directory for "system.ppu"

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121026/060cde96/attachment-0001.html>

Reply by email

SkyDiablo
to Sven Barth

ok, now i can compile some binaries, but they dont run on my target system, i get this error:

helloWorld4MIPS: line 1: syntax error: unexpected "("

so i'm not sure about the right "toolchain"? i get a binary thats starts with "?ELF", what does it mean this "ELF" ? by the way, i have switch to "mipsel".

maybe, should i change to a debian system for cross-compile?

greez & thx,
sky...

Sven Barth wrote 40 lines
Am 26.10.2012 18:59 schrieb "SkyDiablo" < <mailto:>>: > > ok, i play around with this stuff, but now i get this error at compiling: > > project1.lpr(0,0) Fatal: Can not find unit system used by Project1. > > i cant fix it :( There are three things you can try: 1. Ensure that your project settings ate correctly set to mips-linux and that the correct compiler is used. You can check this by doing a compile in Lazarus and when it reports the error you right click on the message window and select "copy all messages including hidden" (or so) and paste them somewhere you can read them (e.g. after the final "end." of your project) and check whether the compiler version is correct, the compiler date (your compilation date) and that the target is set correctly 2. Maybe your search path is wrong. Take a look at your 2.7.1 fpc.cfg and search for a -Fu option with "rtl" at the end and verify that this is the correct path and that a "system.ppu" and "system.o" is located there. 3. Add the option "-vut" to the "other settings" memo in the compiler options, copy the output as in 1. and check whether the compiler indeed searches in the correct directory for "system.ppu" Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121027/0f0c9ed5/attachment.html>

Reply by email

waldo kitty
to SkyDiablo
SkyDiablo wrote
ok, now i can compile some binaries, but they dont run on my target system, i get this error:

i cannot help very much with your goals but...

helloWorld4MIPS: line 1: syntax error: unexpected "(" so i'm not sure about the right "toolchain"? i get a binary thats starts with "ELF", what does it mean this "ELF" ?

i googled "elf binary" (sans quotes) and got this URL...

http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

by the way, i have switch to "mipsel".

if it isn't *nix, ELF binaries won't run on it...

Show quoted text 32 lines
maybe, should i change to a debian system for cross-compile? greez & thx, sky... Am 26.10.2012 23:24, schrieb Sven Barth: > > Am 26.10.2012 18:59 schrieb "SkyDiablo" < > <mailto:>>: > > > > ok, i play around with this stuff, but now i get this error at compiling: > > > > project1.lpr(0,0) Fatal: Can not find unit system used by Project1. > > > > i cant fix it :( > > There are three things you can try: > 1. Ensure that your project settings ate correctly set to mips-linux and that > the correct compiler is used. You can check this by doing a compile in Lazarus > and when it reports the error you right click on the message window and select > "copy all messages including hidden" (or so) and paste them somewhere you can > read them (e.g. after the final "end." of your project) and check whether the > compiler version is correct, the compiler date (your compilation date) and > that the target is set correctly > > 2. Maybe your search path is wrong. Take a look at your 2.7.1 fpc.cfg and > search for a -Fu option with "rtl" at the end and verify that this is the > correct path and that a "system.ppu" and "system.o" is located there. > > 3. Add the option "-vut" to the "other settings" memo in the compiler options, > copy the output as in 1. and check whether the compiler indeed searches in the > correct directory for "system.ppu"

Reply by email

SkyDiablo
to waldo kitty

it is a simple openWRT linux system. okay, i think i need other "binunits/toolchain" for compiling? can anyone help me to compile the right toolchain for windows?

the task is: create a crosscompile compiler for FPC from windows to linux MIPS systems... in the past i have learn to compile the compiler, but i have use some pre-compiles toolchains, i think this was the failur. i need some toolchain for non-ELF systms!

some help?

greez & thx,
sky...

waldo kitty wrote 72 lines
On 10/27/2012 15:37, SkyDiablo wrote: > ok, now i can compile some binaries, but they dont run on my target > system, i > get this error: i cannot help very much with your goals but... > helloWorld4MIPS: line 1: syntax error: unexpected "(" > > so i'm not sure about the right "toolchain"? i get a binary thats > starts with > "ELF", what does it mean this "ELF" ? i googled "elf binary" (sans quotes) and got this URL... http://en.wikipedia.org/wiki/Executable_and_Linkable_Format > by the way, i have switch to "mipsel". if it isn't *nix, ELF binaries won't run on it... > maybe, should i change to a debian system for cross-compile? > > greez & thx, > sky... > > Am 26.10.2012 23:24, schrieb Sven Barth: >> >> Am 26.10.2012 18:59 schrieb "SkyDiablo" < >> <mailto:>>: >> > >> > ok, i play around with this stuff, but now i get this error at >> compiling: >> > >> > project1.lpr(0,0) Fatal: Can not find unit system used by Project1. >> > >> > i cant fix it :( >> >> There are three things you can try: >> 1. Ensure that your project settings ate correctly set to mips-linux >> and that >> the correct compiler is used. You can check this by doing a compile >> in Lazarus >> and when it reports the error you right click on the message window >> and select >> "copy all messages including hidden" (or so) and paste them >> somewhere you can >> read them (e.g. after the final "end." of your project) and check >> whether the >> compiler version is correct, the compiler date (your compilation >> date) and >> that the target is set correctly >> >> 2. Maybe your search path is wrong. Take a look at your 2.7.1 >> fpc.cfg and >> search for a -Fu option with "rtl" at the end and verify that this >> is the >> correct path and that a "system.ppu" and "system.o" is located there. >> >> 3. Add the option "-vut" to the "other settings" memo in the >> compiler options, >> copy the output as in 1. and check whether the compiler indeed >> searches in the >> correct directory for "system.ppu" -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote 8 lines
it is a simple openWRT linux system. okay, i think i need other "binunits/toolchain" for compiling? can anyone help me to compile the right toolchain for windows? the task is: create a crosscompile compiler for FPC from windows to linux MIPS systems... in the past i have learn to compile the compiler, but i have use some pre-compiles toolchains, i think this was the failur. i need some toolchain for non-ELF systms!

I suggest going back to the wiki page (applicable to Debian) I cited earlier in the thread, and my pointer to the ML thread where somebody said how he'd done it under Windows.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Mark Morgan Lloyd

i cant see the solution, i think it is the wrong "binutils"pack, right?

Mark Morgan Lloyd wrote 14 lines
SkyDiablo wrote: > it is a simple openWRT linux system. okay, i think i need other > "binunits/toolchain" for compiling? can anyone help me to compile the > right toolchain for windows? > > the task is: create a crosscompile compiler for FPC from windows to > linux MIPS systems... in the past i have learn to compile the > compiler, but i have use some pre-compiles toolchains, i think this > was the failur. i need some toolchain for non-ELF systms! I suggest going back to the wiki page (applicable to Debian) I cited earlier in the thread, and my pointer to the ML thread where somebody said how he'd done it under Windows.

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote
i cant see the solution, i think it is the wrong "binutils"pack, right?

What do you mean?

Show quoted text 14 lines
Am 28.10.2012 21:40, schrieb Mark Morgan Lloyd: > SkyDiablo wrote: >> it is a simple openWRT linux system. okay, i think i need other >> "binunits/toolchain" for compiling? can anyone help me to compile the >> right toolchain for windows? >> >> the task is: create a crosscompile compiler for FPC from windows to >> linux MIPS systems... in the past i have learn to compile the >> compiler, but i have use some pre-compiles toolchains, i think this >> was the failur. i need some toolchain for non-ELF systms! > > I suggest going back to the wiki page (applicable to Debian) I cited > earlier in the thread, and my pointer to the ML thread where somebody > said how he'd done it under Windows.
Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Mark Morgan Lloyd

okay, again from scratch. I downloaded and installed the bintuils for windows:

Sourcery CodeBench Lite 2012.03-63 for MIPS GNU / Linux -> https://sourcery.mentor.com/GNUToolchain/release2190

Then I looked at the "FPC 2.7.x Sources" downloaded (daily snapshot) -> http://www.freepascal.org/develop.var

Now I write a batch file which I want to create a corresponding linux-mips FPC compiler.

========================================================== set
PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;D:\Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux_Toolchain\lib\gcc;D:\Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux_Toolchain\bin set PREFIX=mips-linux-gnu-
set INSTALLDIR="D:\fpc\install"
set FPCMAKE="D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\utils\fpcm\fpcmake.exe" set CPU_TARGET=mips
set OS_TARGET=linux

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc
make distclean

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\utils\fpcm
make all

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc

make all OS_TARGET=%OS_TARGET% CPU_TARGET=%CPU_TARGET% BINUTILSPREFIX=%PREFIX%
make crossinstall OS_TARGET=%OS_TARGET% CPU_TARGET=%CPU_TARGET% BINUTILSPREFIX=%PREFIX% INSTALL_PREFIX=%INSTALLDIR% FPCMAKE=%FPCMAKE% make all install INSTALL_PREFIX=%INSTALLDIR%

pause
==========================================================

deposited these new FPC compiler and Lazarus in a simple "hello world" application compiled with it. the compile runs without any problems but only the binary cant be run on my router. I have the binary viewed more closely, and the first character in the file are "ELF". "ELF" stands for "Executable and Linkable Format" and describing an a file. is it possible that my router is recorded with openWRTthat is not 'ELF' supported? how could I implement it that I create files without this "ELF" format? here are the "binutils" to blame?

# cat /proc/cpuinfo
system type : Atheros AR9132 rev 2
machine : TP-LINK TL-WR1043ND
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 266.24
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ff8]
ASEs implemented : mips16
shadow register sets : 1
core : 0
VCED exceptions : not available
VCEI exceptions : not available

# cat /proc/version
Linux version 2.6.32.27 (gcc version 4.3.3 (GCC) )

# sh helloWorld4MIPS
helloWorld4MIPS: line 1: syntax error: unexpected "("

what can or should I do now that I can programs under lazarus for my router which is recorded with openWRT?

greez & thx,
sky...

Mark Morgan Lloyd wrote 20 lines
SkyDiablo wrote: > i cant see the solution, i think it is the wrong "binutils"pack, right? What do you mean? > Am 28.10.2012 21:40, schrieb Mark Morgan Lloyd: >> SkyDiablo wrote: >>> it is a simple openWRT linux system. okay, i think i need other >>> "binunits/toolchain" for compiling? can anyone help me to compile >>> the right toolchain for windows? >>> >>> the task is: create a crosscompile compiler for FPC from windows to >>> linux MIPS systems... in the past i have learn to compile the >>> compiler, but i have use some pre-compiles toolchains, i think this >>> was the failur. i need some toolchain for non-ELF systms! >> >> I suggest going back to the wiki page (applicable to Debian) I cited >> earlier in the thread, and my pointer to the ML thread where >> somebody said how he'd done it under Windows.

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote
okay, again from scratch. I downloaded and installed the bintuils for windows:

No. You've already said that you've got a Debian (presumably x86) system available. Use that, and follow the instructions I put in the wiki page: I wrote those line-by-line as I was doing the job (there might be a minor glitch in there somewhere because I changed a directory layout part way through, but apart from the the commands are still the same).

You start off with a /specific/ version of binutils, slightly older won't work and somebody's already said in the ML that newer ones are problematic (you /have/ read that thread I pointed you at, haven't you?). You build yourself a cross-compiler, you then use that to build yourself an RTL. I did that about a week ago, it works.

Having the cross compiler and RTL, you should then be able to either build a native compiler etc. or to compile trivial programs (some fancy stuff won't work yet because you haven't built the full FCL). The native compiler can be copied onto your mipsel system, and is currently good enough to recompile itself.

As LBSC used to write, "follow the words and music and you won't go wrong". However if you continue to guess and not to follow the advice people are giving you you won't get anywhere: the compiler has only been working for a few weeks and everything is still comparatively fragile.

Apologies if I sound slightly less patient than Henry, Michael et al, but the basic compiler *DOES* work (I certainly don't have the experience to apply non-standard fixes on the fly, and if I did I'd have mentioned it). However as I described in a different thread a few days ago there are still problems running Lazarus natively on MIPS, so don't try that unless you've got time to start investigating the outstanding code generation issues.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Mark Morgan Lloyd
Show quoted text 5 lines
Having the cross compiler and RTL, you should then be able to either build a native compiler etc. or to compile trivial programs (some fancy stuff won't work yet because you haven't built the full FCL). The native compiler can be copied onto your mipsel system, and is currently good enough to recompile itself.

ok, i want to create a little peace of software with multi-thread and maybe use some indy (TidTCP) stuff? it this possible with this MIPS crosscompiler port?

greez & thx,
sky...

Reply by email

Lukasz Sokol
to SkyDiablo: okay, again from scratch. I downloaded and installed the bintuils for windows: Sourcery…
SkyDiablo wrote
okay, again from scratch. I downloaded and installed the bintuils for windows:

[snip]

Show quoted text 6 lines
# sh helloWorld4MIPS helloWorld4MIPS: line 1: syntax error: unexpected "(" what can or should I do now that I can programs under lazarus for my router which is recorded with openWRT?

You produced an /executable/ ?
Then why not just do

./helloWorld4MIPS

in the dir where the binary is copied to ....?
(yes, dot-slash is needed unless you have this directory added to PATH)

AFAIK, doing

sh $file

will attempt to run it as shell script, WHICH IT ISN'T ?

greez & thx, sky...

el es

Reply by email

Mark Morgan Lloyd
to SkyDiablo: ok, i want to create a little peace of software with multi-thread and maybe use some indy…
SkyDiablo wrote 9 lines
> Having the cross compiler and RTL, you should then be able to either > build a native compiler etc. or to compile trivial programs (some > fancy stuff won't work yet because you haven't built the full FCL). > The native compiler can be copied onto your mipsel system, and is > currently good enough to recompile itself. ok, i want to create a little peace of software with multi-thread and maybe use some indy (TidTCP) stuff? it this possible with this MIPS crosscompiler port?

I think threads etc. is premature at the moment. Get a "Hello, World!" running as a confidence builder, and then see what else works. If you have time and expertise see if there's anything you can help with in fixing the compiler so that more of the tests run properly (the fpc-devel ML is the place to discuss this).

Apologies if this is brusque- I'd got a longer response ready to send and then we had a power failure and weren't able to get a generator running before the UPSes shut everything down. Add that to rather a lot of other problems...

The point is that the MIPS (specifically, mipsel) compiler has only been approximately intact for a few weeks, and there are still a lot of test cases failing. Since I've already seen that something wasn't working properly during Lazarus's startup and since I think that the IDE uses background code scanning directories etc. I think there's a whole lot of underpinnings that need to be got right first. It would be particularly unfair to get e.g. Indy involved until we're sure the compiler is error-free.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Lukasz Sokol: [snip] You produced an /executable/ ? Then why not just do ./helloWorld4MIPS in the dir…
Lukasz Sokol wrote 13 lines
You produced an /executable/ ? Then why not just do ./helloWorld4MIPS in the dir where the binary is copied to ....? (yes, dot-slash is needed unless you have this directory added to PATH) AFAIK, doing sh $file will attempt to run it as shell script, WHICH IT ISN'T ?

yes, i have tested this befor but now i realize what going on.

# chmod +x helloWorld4MIPS
# ./helloWorld4MIPS

after this, NOTHING happens! no output and no shell-promt! now i have look at "top" ->

process "helloWorld4MIPS" -> 100% CPU load!

this is the helloWorld Code:
================================
program helloWorld4MIPS;
begin
   WriteLn('helloWorld');
end.
================================

if compiled for windows, all works fine...

maybe i should try with a debian/ubuntu as origin and not windows... if someone have a idea for me, please post!

greez & thx,
sky...

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote 31 lines
Am 29.10.2012 15:53, schrieb Lukasz Sokol: > You produced an /executable/ ? > Then why not just do > > ./helloWorld4MIPS > > in the dir where the binary is copied to ....? > (yes, dot-slash is needed unless you have this directory added to PATH) > > AFAIK, doing > > sh $file > > will attempt to run it as shell script, WHICH IT ISN'T ? yes, i have tested this befor but now i realize what going on. # chmod +x helloWorld4MIPS # ./helloWorld4MIPS after this, NOTHING happens! no output and no shell-promt! now i have look at "top" -> process "helloWorld4MIPS" -> 100% CPU load! this is the helloWorld Code: ================================ program helloWorld4MIPS; begin WriteLn('helloWorld'); end.

A possibility there is that the FPC runtimes are incompatible with OpenWRT (assuming that that's what you're running on). I was running on Debian hosted by Qemu (on an x86 Debian system) which appeared OK.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 36 lines
SkyDiablo wrote: > Am 29.10.2012 15:53, schrieb Lukasz Sokol: >> You produced an /executable/ ? >> Then why not just do >> >> ./helloWorld4MIPS >> >> in the dir where the binary is copied to ....? >> (yes, dot-slash is needed unless you have this directory added to PATH) >> >> AFAIK, doing >> >> sh $file >> >> will attempt to run it as shell script, WHICH IT ISN'T ? > > yes, i have tested this befor but now i realize what going on. > > # chmod +x helloWorld4MIPS > # ./helloWorld4MIPS > > after this, NOTHING happens! no output and no shell-promt! now i have > look at "top" -> > > process "helloWorld4MIPS" -> 100% CPU load! > > this is the helloWorld Code: > ================================ > program helloWorld4MIPS; > begin > WriteLn('helloWorld'); > end. A possibility there is that the FPC runtimes are incompatible with OpenWRT (assuming that that's what you're running on). I was running on Debian hosted by Qemu (on an x86 Debian system) which appeared OK.

I've just compiled and run a test "Hello, World!" and a do-nothing program on mipsel, they both behaved as expected. I suggest I mail them to you, the stripped binaries are about 33K in a tar.gz.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to SkyDiablo: okay, again from scratch. I downloaded and installed the bintuils for windows: Sourcery…

Red herring alert :-)

SkyDiablo wrote:

[Built what he believed was a binary for mipsel, and on running it on the target got]

Show quoted text 6 lines
# cat /proc/version Linux version 2.6.32.27 (gcc version 4.3.3 (GCC) ) # sh helloWorld4MIPS helloWorld4MIPS: line 1: syntax error: unexpected "("

I've just had something very similar on a different platform, and think that message might be Bash getting seriously confused. I built a minimal test program on Solaris SPARC V8 and moved it onto a V7 system. I get:

$ file product
product: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, stripped
$ ./product
./product: syntax error at line 1: `(' unexpected

I'll continue that in fpc-devel where there's alreasy a thread on -i, -Cp etc.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

SkyDiablo
to Mark Morgan Lloyd: I've just compiled and run a test "Hello, World!" and a do-nothing program on mipsel,…

YES, i think i got it!

okay, i was not sure over the hole time if my toolchain is the right choise... but now, i know it, yes it is! i use this toolchain to compiling a helloWorld c++ application and got the same error with fpc. some time later, i get a response from my test-system:

FPU emulator disabled, make sure your toolchain was compiled with software floating point support (soft-float)

so i added the switch "-msoft-float" to compile my c++ application. all works fine! i have compile a linux/MIPS binary under my windows developer system. and now, i think, i have to say FPC that is use to this switch too, but i dont know how?

any idea?

greez & thx,
sky...

Mark Morgan Lloyd wrote 43 lines
Mark Morgan Lloyd wrote: > SkyDiablo wrote: >> Am 29.10.2012 15:53, schrieb Lukasz Sokol: >>> You produced an /executable/ ? >>> Then why not just do >>> >>> ./helloWorld4MIPS >>> >>> in the dir where the binary is copied to ....? >>> (yes, dot-slash is needed unless you have this directory added to >>> PATH) >>> >>> AFAIK, doing >>> >>> sh $file >>> >>> will attempt to run it as shell script, WHICH IT ISN'T ? >> >> yes, i have tested this befor but now i realize what going on. >> >> # chmod +x helloWorld4MIPS >> # ./helloWorld4MIPS >> >> after this, NOTHING happens! no output and no shell-promt! now i >> have look at "top" -> >> >> process "helloWorld4MIPS" -> 100% CPU load! >> >> this is the helloWorld Code: >> ================================ >> program helloWorld4MIPS; >> begin >> WriteLn('helloWorld'); >> end. > > A possibility there is that the FPC runtimes are incompatible with > OpenWRT (assuming that that's what you're running on). I was running > on Debian hosted by Qemu (on an x86 Debian system) which appeared OK. I've just compiled and run a test "Hello, World!" and a do-nothing program on mipsel, they both behaved as expected. I suggest I mail them to you, the stripped binaries are about 33K in a tar.gz.

Reply by email

Mark Morgan Lloyd
to SkyDiablo
SkyDiablo wrote 14 lines
YES, i think i got it! okay, i was not sure over the hole time if my toolchain is the right choise... but now, i know it, yes it is! i use this toolchain to compiling a helloWorld c++ application and got the same error with fpc. some time later, i get a response from my test-system: FPU emulator disabled, make sure your toolchain was compiled with software floating point support (soft-float) so i added the switch "-msoft-float" to compile my c++ application. all works fine! i have compile a linux/MIPS binary under my windows developer system. and now, i think, i have to say FPC that is use to this switch too, but i dont know how?

Take a look at fpc -h output, the -Ce option might be what you need if implemented.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email