FPC fixes 3 0 fails to build on linux arm

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

FPC fixes 3 0 fails to build on linux arm

Anthony Walter-3
I am attempting to configure Free Pascal 3.0 and Lazarus packages for Raspberry Pi and am running into a failure when making fpc.

Here are the steps leading to the failure:

I am starting with a working copy of fpc 2.6.4 linux arm on my Raspberry Pi.

I check out fpc branch fixes_3_0 from the free pascal subversion server  on my Raspberry Pi.

I change to the fpc folder (containing branch fixes_3_0)and type "make all" on my Raspberry Pi.

After about five minutes of build time, the make process stops with the following output:

fpmake.pp(49) Warning: "crtend.o" not found, this will probably cause a linking failure
fpmake.pp(49) Warning: "crtn.o" not found, this will probably cause a linking failure
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/Development/Base/fpc/rtl/units/arm-linux/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/home/pi/Development/Base/fpc/rtl/units/arm-linux/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
fpmake.pp(49) Error: Error while linking
fpmake.pp(49) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Makefile:1658: recipe for target 'fpmake' failed
make[2]: *** [fpmake] Error 1
make[2]: Leaving directory '/home/pi/Development/Base/fpc/packages'
Makefile:2616: recipe for target 'packages_smart' failed
make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory '/home/pi/Development/Base/fpc'
Makefile:2812: recipe for target 'build-stamp.arm-linux' failed
make: *** [build-stamp.arm-linux] Error 2

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Anthony Walter-3
Okay, this issue was related to:


The solution was:

make all OPT="-dNO_THREADING -Fl/usr/lib/arm-linux-gnueabihf -Fl/usr/lib/gcc/arm-linux-gnueabihf/4.6"

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Jonas Maebe-2
In reply to this post by Anthony Walter-3
On 01/12/15 21:35, Anthony Walter wrote:
> I am attempting to configure Free Pascal 3.0 and Lazarus packages for
> Raspberry Pi and am running into a failure when making fpc.
>
> Here are the steps leading to the failure:
>
> I am starting with a working copy of fpc 2.6.4 linux arm on my Raspberry Pi.

There are
a) the official FPC 2.6.4 for Linux ARM, which is for the ARMEL EABI
while the Raspberry Pi uses ARMHF EABI (it can run ARMEL EABI binaries
too, but you quickly get into trouble when you have to link against
libraries, unless you install ARMEL EABI versions of all libraries too)
b) the FPC 2.6.4 + Debian patches for the ARMHF EABI, which is broken
and which cannot be used to compile FPC 3.0.0 without disabling the
optimiser (otherwise you get a crash while compiling the system unit
with ppc1)

Which version of FPC 2.6.4 are you using?

> I check out fpc branch fixes_3_0 from the free pascal subversion server
>   on my Raspberry Pi.
>
> I change to the fpc folder (containing branch fixes_3_0)and type "make
> all" on my Raspberry Pi.

I guess this means you are using the official FPC 2.6.4, otherwise you
wouldn't get as far as the errors below. In that case, you must add
OPT=-dFPC_ARMHF to your make invocation to compile FPC for the ARMHF EABI.

> After about five minutes of build time, the make process stops with the
> following output:
>
> fpmake.pp(49) Warning: "crtend.o" not found, this will probably cause a
> linking failure
> fpmake.pp(49) Warning: "crtn.o" not found, this will probably cause a
> linking failure

That's probably because the compiler is looking for the ARMEL EABI
versions of these files, which are most likely not installed on your
system. Make sure to install the "libc-dev" package to get the ARMHF
versions of these object files.

> /usr/bin/ld: warning: link.res contains output sections; did you forget -T?
> /home/pi/Development/Base/fpc/rtl/units/arm-linux/cprt0.o: In function
> `_haltproc_eabi':
> (.text+0x88): undefined reference to `_fini'
> /home/pi/Development/Base/fpc/rtl/units/arm-linux/cprt0.o: In function
> `_haltproc_eabi':
> (.text+0x90): undefined reference to `_init'

That's as predicted by the warnings above.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Jonas Maebe-2
In reply to this post by Anthony Walter-3
On 01/12/15 22:08, Anthony Walter wrote:
> Okay, this issue was related to:
>
> http://lists.freepascal.org/fpc-devel/2014-October/034592.html
>
> The solution was:
>
> make all OPT="-dNO_THREADING -Fl/usr/lib/arm-linux-gnueabihf
> -Fl/usr/lib/gcc/arm-linux-gnueabihf/4.6"

1) you don't need -dNO_THREADING
2) those -Fl paths are detected automatically by fpmake if your system
is set up properly (in particular, a C compiler is installed) and if you
are building the correct EABI variant of the compiler

The above is a hack that papers over the real problems, and should not
be used to just hide them.


Jonas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Anthony Walter-3
In reply to this post by Jonas Maebe-2
Jonas, thanks for the reply. I got fpc 3.0 to compiler ad verified it works (by writing a hello world test program) per the solution in my last reply. I'll keep your response in mind, and others should as well, when I attempt to build Lazarus and compile a few more sophisticated tests.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Anthony Walter-3
In reply to this post by Jonas Maebe-2
Okay good to know. I'll probably delete my entire fpc tree and rebuild using your notes. Thanks again.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Mark Morgan Lloyd-5
In reply to this post by Jonas Maebe-2
Jonas Maebe wrote:

> On 01/12/15 22:08, Anthony Walter wrote:
>> Okay, this issue was related to:
>>
>> http://lists.freepascal.org/fpc-devel/2014-October/034592.html
>>
>> The solution was:
>>
>> make all OPT="-dNO_THREADING -Fl/usr/lib/arm-linux-gnueabihf
>> -Fl/usr/lib/gcc/arm-linux-gnueabihf/4.6"
>
> 1) you don't need -dNO_THREADING
> 2) those -Fl paths are detected automatically by fpmake if your system
> is set up properly (in particular, a C compiler is installed) and if you
> are building the correct EABI variant of the compiler

The -Fl might be needed for older versions of Raspbian. They aren't
needed for the current release, as I noted here a couple of days ago
when I reported a successful build.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC fixes 3 0 fails to build on linux arm

Anthony Walter-3
A follow up...

make all OPT="-dFPC_ARMHF"

Works

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal