zog
Posts: 213
Joined: Sun Nov 20, 2011 5:43 pm

Impossible to upgrade the free pascal compiler on raspbian

Sat Dec 29, 2012 10:58 am

You can't upgrade the free pascal compiler on raspian because I think its shipped with the wrong arm libraries. If you try to make fpc on raspian this is what you get.

as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/prt0.o arm/prt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/dllprt0.o arm/dllprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/cprt0.o arm/cprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/gprt0.o arm/gprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/ucprt0.o arm/ucprt0.as
/home/pi/fpc-2.6.0/compiler/ppc1 -Ur -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../un ix -Fiarm -FE. -FU/home/pi/fpc-2.6.0/rtl/units/arm-linux -darm -dRELEASE -Us -Sg system.pp
An unhandled exception occurred at $0002F054 :
EAccessViolation : Access violation
$0002F054
$000213A0
$0001DC64


I think i've figured out what is going wrong. I need a new compiler for raspian wheezy as it is an arm hard float system armhf. In other words I think what is needed is a new target "linux armhf", or "raspbian armhf" for free pascal.

The arm libraries supplied with fpc 2.6.0 don't work with the raspberry pi running raspian. When I tried to compile fpc 2.6.0 this is what happend.

as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/prt0.o arm/prt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/dllprt0.o arm/dllprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/cprt0.o arm/cprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/gprt0.o arm/gprt0.as
as -o /home/pi/fpc-2.6.0/rtl/units/arm-linux/ucprt0.o arm/ucprt0.as
/home/pi/fpc-2.6.0/compiler/ppc1 -Ur -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../un ix -Fiarm -FE. -FU/home/pi/fpc-2.6.0/rtl/units/arm-linux -darm -dRELEASE -Us -Sg system.pp
An unhandled exception occurred at $0002F054 :
EAccessViolation : Access violation
$0002F054
$000213A0
$0001DC64

I strongly suspect this is why the debugger won't compile for lazarus as well. I haven't been using free pascal for long and I don't have the expertise yet, to sort these errors out for myself. I can compile most programs using fpc, but signicantly I can't make a new version of fpc or lazarus. I may try a soft float wheezy image to see if I can compile fpc ( the free pascal compiler ).

Obviously somebody managed to make the current fpc version using a cross compiler, but I don't think its currently possible to make an upgraded version using the zipped sources from the free pascal web site under raspbian.

plugwash
Forum Moderator
Forum Moderator
Posts: 3614
Joined: Wed Dec 28, 2011 11:45 pm

Re: Impossible to upgrade the free pascal compiler on raspbi

Sat Dec 29, 2012 1:31 pm

The version of free pascal in the raspbian repository is specially patched to work correctly on raspbian. It can (or at least could last time I tried it) build itself on the Pi. The binaries in our repo are NOT cross-compiled (though they are built on armv7 hardware).

Upstream 2.6.0 will not work correctly on raspbian because it doesn't have these patches. Freepascal trunk should work on raspbian though if bootstrapped with the compiler from the raspbian repositories.

I suspect whatever lazarus problems you are having are unrelated.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Impossible to upgrade the free pascal compiler on raspbi

Sat Dec 29, 2012 5:55 pm

Freepascal trunk should work on raspbian though if bootstrapped with the compiler from the raspbian repositories.
It does. I installed fpc 2.6 from the raspbian repository and built fpc trunk, then used fpc trunk to build lazarus trunk.

The only problem I had was building lazarus on a 256MB pi. IIRC I did see some errors relating to the debugger support.
No problems building it on a 512MB pi though...

Gr.
Dirk.

zog
Posts: 213
Joined: Sun Nov 20, 2011 5:43 pm

Re: Impossible to upgrade the free pascal compiler on raspbi

Sat Dec 29, 2012 9:29 pm

Okay I too have managed to build fpc from the source.

I used svn to get the trunk version

svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
make clean all
make install ( just for the hell of it )

This worked on my 256 Mb pi

Then I tried to upgrade lazarus by fetching the latest svn tunk of that and trying to build it

I got this when it tried to compile main.pp. It might be time to get the 512Mb pi.

linux -Fu../lcl/units/arm-linux -Fu../lcl/units/arm-linux/gtk2 -Fu../ideintf/units/arm-linux/gtk2 -Fu../components/synedit/units/arm-linux/gtk2 -Fu../components/lazcontrols/lib/arm-linux/gtk2 -Fu../units/arm-linux/gtk2 -darm lazarus.pp
Free Pascal Compiler version 2.6.0-6+rpi1 [2012/11/16] for arm
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for ARMHF
Compiling lazarus.pp
Compiling main.pp
Killed
make[2]: *** [lazarus] Error 137
make[2]: Leaving directory `/home/pi/lazarus-svn/ide'
make[1]: *** [ide] Error 2
make[1]: Leaving directory `/home/pi/lazarus-svn/ide'
make: *** [ide] Error 2

I think error 137 is something to do with the resource compiler, or being too low on memory. I will try to compile a differnt version of lazarus. Thanks everyone for your help.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Impossible to upgrade the free pascal compiler on raspbi

Sat Dec 29, 2012 10:39 pm

You should not compile main.pp directly. Just do a 'make all' or 'make clean all'
It might be time to get the 512Mb pi.
That's exactly what I did a couple of weeks ago :)

Gr.
Dirk

plugwash
Forum Moderator
Forum Moderator
Posts: 3614
Joined: Wed Dec 28, 2011 11:45 pm

Re: Impossible to upgrade the free pascal compiler on raspbi

Sun Dec 30, 2012 2:16 am

When you see "Killed" in a build log it nearly always means you ran out of memory/swap and got hit by the OOM killler.

Either add more swap (and be prepared to wait a while) or get a 512M Pi.

zog
Posts: 213
Joined: Sun Nov 20, 2011 5:43 pm

Re: Impossible to upgrade the free pascal compiler on raspbi

Sun Dec 30, 2012 6:26 pm

A good excuse to buy a new pi:)
I won't be able to play with my pi for a few days now. I am keen to see if I can get the castle game engine running on the pi, although I don't know if the pi will be able to handle it. The castle game engine won't work with Lazarus 0.934 but does compile with Lazarus 1.04

Return to “Raspberry Pi OS”