LongDirtyAnimAlf / Reiniero-fpcup

fpcup (and fpclazup) are installers for FPC (and Lazarus).
52 stars 10 forks source link

crosscompile aarch64 #29

Closed alr1976 closed 7 years ago

alr1976 commented 7 years ago

aarch64Hi!

i have installed pclazup on Windows x64 . i need to cross compile to aarch64 Linux it possible ? can you explain me how can i do? I need to make an application on odroid c2 can you help me?

LongDirtyAnimAlf commented 7 years ago

It is very well possible ! I have multiple apps running on O-C2 compiled from Windows. Look at NewPascal. Under the releases, there are ready made binaries that will do what you want. Please report back any issues. I will try to help.

LongDirtyAnimAlf commented 7 years ago

You have also another possibility, while you have already used fpclazup to install.

Just download the correct aarch64 zip from NewPascal: https://github.com/newpascal/newpascal/releases/download/np_sc-v1.0.24/CrossLinuxAarch64.rar

Inside, you will find a cross-directory containing binary tools and lib for aarch64. Put this directory where your fpclazup is. Or where your installed fpc/lazarus is.

Run: fpclazup.exe --ostarget="linux" --cputarget="aarch64" --only="FPCCleanOnly,FPCBuildOnly" --installdir="whereyourinstallis_orleaveawayfordefault"

alr1976 commented 7 years ago

ok i have copied fpc/bin/aarch64-linux and fpc/units/aarch64-linux in my directory c:\development i have tried to compile but i have error.... i think that i must change fpc.cfg is it correct? Can you help me how configure Lazarus to compile with Odroid C2? Thanks fpcerror option1 option2 option3 option4 option5 option6 option7 option8 option9 option10

LongDirtyAnimAlf commented 7 years ago

I have given you two separate possibilities. Now you are mixing them, which will definitely not work !!

Option 1: use NewPascal ! And follow its install requirements.

Option 2: use fpclazup ! And follow the instructions as given in my previous comment.

My choice would be (in your case): option 2 !

Again, what you have done will definitely not work !

alr1976 commented 7 years ago

Ok this is my step: i have downloaded : https://github.com/newpascal/newpascal/releases/download/np-v1.0.24/newpascal.zip newpascal1 newpascal2

i have installed NewPascal in c:\NewPascal I have downloaded CrossLinuxArcharch64.rar Unrar in c:\NewPascal so i will have c:\NewPascal\Cross\bin\aarch64-linux c:\NewPascal\Cross\Lib\aarch64-linux c:\NewPascal\fpc\bin\aarch64-linux c:\NewPascal\fpc\units\aarch64-linux Correct? execute configure.bat execute run.bat

On Lazarus Configuration path i have warning on make.exe Start Lazarus Go in Project Option Config and Target Target Os : Linux Target Cpu Family : aarch64 Target Processor: Default (I can t change it) Press ok I have message Compiler "c:\NewPascal\fpc\bin\i386-win32\fpc.exe" doesn t support target aarch64-linux

I redo Option 1 step by step but i have same error.

LongDirtyAnimAlf commented 7 years ago

You are a strange person ... I gave you advice to go for option 2. But you go for option 1 and do it completely wrong ...

Option 1 again. https://github.com/newpascal/newpascal/releases/tag/np_sc-v1.0.24 Copy of the instructions:

This is a NewPascal + Lazarus trunk release that is suitable for cross-compiling.

Install notes:

First unpack NPLazBaseWin32.rar in c:\NewPascal please note: it HAS to be installed in c:\NewPascal, otherwise things will not work !!

After unpack, you should have:

c:\NewPascal\ccr c:\NewPascal\config_lazarus c:\NewPascal\fpc c:\NewPascal\fpcbootstrap c:\NewPascal\fpclazup c:\NewPascal\lazarus And a link to start this Lazarus / NewPascal distro. (please note: you have to use this link to start, otherwise things will not work !!)

Start using this link to test your setup. It should give you Win32/64.

If you want to cross-compile, please unpack the desired archive in c:\NewPascal

Have fun.

alr1976 commented 7 years ago

On optional 2 i need to install on Odroid or Windows?

LongDirtyAnimAlf commented 7 years ago

You are kidding me ....

But yes, the above instructions are for Windows.

But, if you want, you can also install FP/Lazarus directly on Odroid. https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/blob/master/bin/aarch64-linux If you just run fpclazup_linux_aarch64 from your home-directory, it should give you FPC and Lazarus on your Odroid-C2. Can be helpfull when debugging.

alr1976 commented 7 years ago

Hi! I don t kidding you.... Option 2 i have tested 2 days ago but i have problem with installation... I have error to install fpclazup fpclazup.exe --ostarget="linux" --cputarget="aarch64" --only="FPCCleanOnly,FPCBuildOnly" --installdir="c:\dev"

Problem will be Windows 10 x64?

This is my error:

fpc
LongDirtyAnimAlf commented 7 years ago

Hmmmm, you know you need a normal FPC first. To be able to build a cross-compiler ?!

To use fpclazup for cross-compiling, do this: fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\mynewfpc" This should give you a normal windows FPC and Lazarus install.

When the above is ready, build the cross-compiler: First, copy the bin-utils and library (inside the cross-directory) from https://github.com/newpascal/newpascal/releases/download/np_sc-v1.0.24/CrossLinuxAarch64.rar into your install-directory. After this copy you have the bin-utils and libs avalaible in: c:\mynewfpc\cross\bin\aarch64-linux and c:\mynewfpc\cross\lib\aarch64-linux

Then run: fpclazup.exe --ostarget="linux" --cputarget="aarch64" --only="FPCCleanOnly,FPCBuildOnly" --installdir="c:\mynewfpc" This will build the cross-compiler. Ready !

alr1976 commented 7 years ago

Please don t kill me....

I have installed option 2 and it compile Project But i have generic Linking problem. I Can compile it But don t linking it. there is some option in Lazarus?

LongDirtyAnimAlf commented 7 years ago

Look here : http://bugs.freepascal.org/view.php?id=30112

I think you need to add this extra linking in your lpr project file !

LongDirtyAnimAlf commented 7 years ago

So, add this: {$ifdef FPC} {$ifdef Linux} {$ifdef FPC_CROSSCOMPILING} {$linklib libc_nonshared.a} {$endif FPC_CROSSCOMPILING} {$endif Linux} {$endif FPC}

alr1976 commented 7 years ago

I have installed option 1 and option 2 and works!!!!! Thank you very much!!!!! When come in Milan you have a beer and pizza free..... Only 2 questions ..... 1) I have downloaded arm-linux but i have linking problem like aarch64 2) How to compile in armhf?

LongDirtyAnimAlf commented 7 years ago

{$IFDEF LINUX} {$IFDEF FPC_CROSSCOMPILING} {$linklib libc_nonshared.a} {$IFDEF CPUARM} // if we have a GUI, uncomment {$linklib GLESv2} {$ENDIF} {$ENDIF} {$ENDIF}

LongDirtyAnimAlf commented 7 years ago

Glad you got it working ! I will collect beer and pizza when nearby. But the folks of FPC and Lazarus are the real heros! You can always make a donation to them !!

alr1976 commented 7 years ago

I will do!!

Thank you.

I m trying to install on odroid c2 to debug my application but i have error when install it. screenshot at 2016-09-30 04 23 47

LongDirtyAnimAlf commented 7 years ago

Looks like the bootstrapper cannor be downloaded or renamed. Does the manual download work ?

Open a browser on the Odroid and enter: https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/raw/master/bin/aarch64-linux/aarch64-linux-ppca64 Or, from the command line, do: wget https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/raw/master/bin/aarch64-linux/aarch64-linux-ppca64

LongDirtyAnimAlf commented 7 years ago

I have fixed an issue on aarch64. Please try newest fpc(laz)up version.

alr1976 commented 7 years ago

I have downloaded last aarch64 but i have same error

LongDirtyAnimAlf commented 7 years ago

As you could know by now, you need FPC trunk for Aarch64:

./fpclazup_linux_aarch64 --fpcURL="trunk" --lazURL="trunk"

alr1976 commented 7 years ago

same error

LongDirtyAnimAlf commented 7 years ago

Then we are out of possibilities (and feedback). And, as I cannot confirm your error on my own Odroid-C2, I am closing this issue.

alr1976 commented 7 years ago

last question..... can you explain step by step how to install on odroid so i redo it. I have tried to use zeos in odroid but doesn t accept libmysqlclient.so/libmysqlclient.so.20/libmysqlclient.so.20.3.2

LongDirtyAnimAlf commented 7 years ago

My friend, if you want help from me, you need to help me by providing me info and do some extra efforts ! So, I asked you two questions about the bootstrapper. Please answer them.

Second, follow the instructions of fpclazup: On failure, cleanup. On failure, use verbose (./fpclazup_linux_aarch64 --fpcURL="trunk" --lazURL="trunk" --verbose).

Or errors, give me a good report back, with extensive info.

alr1976 commented 7 years ago

Hi! It seem that zip have problem...

desktop1 desktop2 desktop3

LongDirtyAnimAlf commented 7 years ago

Yes, this is much more helpfull. And the error is also clear. Its a mistake in fpclazup. I will update it shortly.

In the meantime, if you want to continue, just do the following. 1: Go inside /root/development/fpcbootstrap 2: Get the bootstrapper by doing wget https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/raw/master/bin/aarch64-linux/aarch64-linux-ppca64 3: Rename "aarch64-linux-ppca64" into "ppca64" 4: Chmod it to make it an executable. 5: Run ./fpclazup_linux_aarch64 --fpcURL="trunk" --lazURL="trunk" --verbose --getfullrepo

alr1976 commented 7 years ago

i have new error when compile lazarus...

desktop4

LongDirtyAnimAlf commented 7 years ago

Well, the good news is: its working. You now have FPC native on Aarch64. Your problem is related to Lazarus. Compiling Lazarus consumes an enormous amount of memory. Try to free some memory, or create a swapfile. At the moment, I am trying to reproduce.

alr1976 commented 7 years ago

ok I will try again....

I need use mydac trial version(without source) But it works only with lazarus 1.6. i don t know which lazarus aarch64 version have But I think 1.7. i have problem to make app with mysql. I have used zeos lib But it ask libmysqlclient.so. i have linked with libmysql.so libmysql.so.20 lib mysql. so.20.3.2 But doesn t works. i use mysql 5.7. do you have tried to connect with mysql database?

LongDirtyAnimAlf commented 7 years ago

Yes, just running fpclazup again (in this situation: do not cleanup, just run again) can be helpfull. Sometimes (with trunk) there may be temporary errors while compiling.

As for database access. I am a user of the mORMot framework. http://synopse.info/fossil/wiki?name=SQLite3+Framework Sometimes with Zeos. But mostly without. Works very well on aarch64 ! However, I have not (yet) tested Zeos on aarch64.

alr1976 commented 7 years ago

I have add swap file and now compile lazarus. I have 2 problems: 1) When change a value in property editor it write 2 times..... for example in caption i write "Ciao" I Got "CCIIAAOO". 2) I tried ./fpclazup again to have lazarus 1.6 but i have an error. desktop7 desktop8

LongDirtyAnimAlf commented 7 years ago

Your second image shows me also that you try to use FPC 3.0.0. And again, that will not work on aarch64 ! You need trunk !

alr1976 commented 7 years ago

ok so how Can solve problem about property editor?

LongDirtyAnimAlf commented 7 years ago

Don't know. Aarch64 is still new for FPC and Lazarus. You could try the mailing list, but chances are dimm. Sorry about this. Just keep trying and updating. Welcome to bleeding edge development.

alr1976 commented 7 years ago

Hi it possible to install fpc 3.1.1 and lazarus 1.6 and compile in aarch64? how?

LongDirtyAnimAlf commented 7 years ago

Not possible. FPC < trunk does not support aarch64. Lazarus < trunk does not support aarch64.

LongDirtyAnimAlf commented 7 years ago

I am closing this issue. Fpclazup has given you a working FPC and Lazarus on aarch64. Other issues (e.g. with FPC or Lazarus) are not related to fpclazup. (ps: on my Odroid-C2, no double characters, all working 100%, my distro : arch linux) Thanks for helping debugging and improving fpclazup !

alr1976 commented 7 years ago

ok to fix keboard problem u need to install ibus-gtk and ibus-gtk3