Sign in Join

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

Mailing lists / lazarus / 2017-06

Cross Compile to Arm

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Steve Gatenby

Having trouble cross compiling an fpc library.

(Linux x86_64 -> Linux Arm using install from fpcupDeluxe) Lazarus 1.9.0 r55116M FPC 3.1.1 x86_64-linux-gtk2

library Project1;
{$mode objfpc}{$H+}
uses cmem, Classes;
begin
end.

This fails with error code 256 and 'error whilst linking' Sometimes gives msg of 'add -fPIC' which I have done, but then moves on to different errors.

It is the 'cmem' addition causing the problem, but not cmem itself (just within a library)

The same system cross compiles standard applications (fpc and lazarus) correctly, seems related to libraries only.

Any ideas at all appreciated (probably a compiler/linker switch I need to pass - but there I am lost)

ps. kudos to whomever created fpcupDeluxe.

Reply by email

Steve Gatenby
to Alfred
Alfred wrote
For a library, add: -FLld-linux-armhf.so.3 into the custom options of your project compiler options.

Thank you Alfred - a little further now.

I have pasted the full output from lazbuild for reference. It seems the linker is trying to use 'crtbeginS.o' for my base system (x86_64)
I guess I need to tell it to redirect to 'crtbegin' in '/mnt/Shared/Apps/fpcupDeluxe/cross/lib/arm-linux', but I dont know how (as yet)

Still working at it though :)

/mnt/Shared/Apps/fpcupDeluxe/lazarus/lazbuild --os=Linux --cpu=arm project1.lpi
using config file /mnt/Shared/Apps/fpcupDeluxe/lazarus/lazarus.cfg SetPrimaryConfigPath
NewValue="/mnt/Shared/Apps/fpcupDeluxe/config_lazarus" -> "/mnt/Shared/Apps/fpcupDeluxe/config_lazarus"
Hint: (lazarus) [RunTool]
/mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/fpc.sh "-iWTOTP" "-Parm" "-Tlinux"
Hint: (lazarus) [RunTool]
/mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/fpc.sh "-va" "-Parm" "-Tlinux" "compilertest.pas"
Info: (lazarus) Execute Title="Compile Project, CPU: arm, Target: libproject1.so"
Info: (lazarus) Working Directory="/home/steve-gatenby/Temp1/LibTest/" Info: (lazarus)
Executable="/mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/fpc.sh" Info: (lazarus) Param[0]="-Tlinux"
Info: (lazarus) Param[1]="-Parm"
Info: (lazarus) Param[2]="-MObjFPC"
Info: (lazarus) Param[3]="-Scghi"
Info: (lazarus) Param[4]="-O1"
Info: (lazarus) Param[5]="-g"
Info: (lazarus) Param[6]="-gl"
Info: (lazarus) Param[7]="-l"
Info: (lazarus) Param[8]="-vewnhibq"
Info: (lazarus)
Param[9]="-Fi/home/steve-gatenby/Temp1/LibTest/lib/arm-linux" Info: (lazarus) Param[10]="-Fu/home/steve-gatenby/Temp1/LibTest/" Info: (lazarus)
Param[11]="-FU/home/steve-gatenby/Temp1/LibTest/lib/arm-linux/" Info: (lazarus) Param[12]="-olibproject1.so"
Info: (lazarus) Param[13]="-fPIC"
Info: (lazarus) Param[14]="-FLld-linux-armhf.so.3" Info: (lazarus) Param[15]="project1.lpr"
Hint: (11030) Start of reading config file
/mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/fpc.cfg Hint: (11031) End of reading config file
/mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/fpc.cfg Free Pascal Compiler version 3.1.1 [2017/06/06] for arm Copyright (c) 1993-2017 by Florian Klaempfl and others (1002) Target OS: Linux for ARMHF
(3104) Compiling project1.lpr
(9015) Linking libproject1.so
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtbeginS.o: file not recognized: File format not recognized
/home/steve-gatenby/Temp1/LibTest/project1.lpr(20,1) Error: (9013) Error while linking
/home/steve-gatenby/Temp1/LibTest/project1.lpr(20,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /mnt/Shared/Apps/fpcupDeluxe/fpc/bin/x86_64-linux/ppcrossarm returned an error exitcode
Error: (lazarus) Compile Project, CPU: arm, Target: libproject1.so: stopped with exit code 256
Error: (lazbuild) failed compiling of project
/home/steve-gatenby/Temp1/LibTest/project1.lpi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170607/a7353233/attachment.html>

Reply by email

Alfred

Hi Steve,

The file crtbeginS.o was definitely missing from the arm-lib archive !

I have added it. Together with crtendS.so .

https://github.com/newpascal/fpcupdeluxe/releases/download/crosslibs_v1.0/CrossLibsLinuxARM.rar or
https://github.com/newpascal/fpcupdeluxe/releases/download/crosslibs_v1.0/CrossLibsLinuxARM.zip

Or, if you are very lazy like me ... delete the cross/lib/arm-linux directory, and run fpcupdeluxe again ... ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170607/f060d856/attachment.html>

Reply by email

Steve Gatenby
to Alfred
Alfred wrote 13 lines
Hi Steve, The file crtbeginS.o was definitely missing from the arm-lib archive ! I have added it. Together with crtendS.so . https://github.com/newpascal/fpcupdeluxe/releases/download/crosslibs_v1.0/CrossLibsLinuxARM.rar or https://github.com/newpascal/fpcupdeluxe/releases/download/crosslibs_v1.0/CrossLibsLinuxARM.zip Or, if you are very lazy like me ... delete the cross/lib/arm-linux directory, and run fpcupdeluxe again ... ;-)

Thank you Alfred - now working perfectly.

Appreciate your time on this. Makes a persons day (mine) better all round :)

SteveG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170607/2413c5d7/attachment.html>

Reply by email