### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Cross Compile from Windows to Linux ARM  (Read 9189 times)

#### LA.Center

• Full Member
• Posts: 244
##### Cross Compile from Windows to Linux ARM
« on: March 19, 2012, 01:24:37 am »
Hi I am trying to cross compile on Windows 32 to Linux ARM and I get this message:

Does anyone know where I can find this lib?

#### Andru

• Full Member
• Posts: 112
##### Re: Cross Compile from Windows to Linux ARM
« Reply #1 on: March 19, 2012, 02:10:08 am »
When you compile something from Windows to Linux ARM you should already have some standard libs(libc.so, libdl.so, etc.), and libpthread one of them, so this is a bit strange. You need to get GNU/Linux(with support of ARM) distributive where you want to execute your application and extract from there libpthread.so.

PS: this situation is very familiar to compilation for Android. Unfortunately FreePascal doesn't support threads for Android at all because of different version of pthreads on Android(there are limited functions of it implemented there, and all functions placed in libc.so instead of libpthread.so). And if you want to use threads on Android you need to use pthreads directly.
« Last Edit: March 19, 2012, 02:14:13 am by Andru »

#### LA.Center

• Full Member
• Posts: 244
##### Re: Cross Compile from Windows to Linux ARM
« Reply #2 on: March 19, 2012, 08:16:15 am »
I am actually pointing to android-ndk-r7\platforms\android-8\arch-arm\usr\lib which sould contain all the libs afak.

still getting the same link error.

#### Andru

• Full Member
• Posts: 112
##### Re: Cross Compile from Windows to Linux ARM
« Reply #3 on: March 19, 2012, 09:18:44 am »
Quote
which sould contain all the libs afak.
As I wrote previously in PS - you won't find this library for Android, because there is no libpthread. You need to comment cthreads in uses clause of your project and don't use standard thread functions like BeginThread and so on.
« Last Edit: March 19, 2012, 09:37:09 am by Andru »

#### LA.Center

• Full Member
• Posts: 244
##### Re: Cross Compile from Windows to Linux ARM
« Reply #4 on: March 19, 2012, 09:44:33 am »
thx for the info, but I am only using System and Classes unit to create a library.so I don't use any threads and I don't have cthread in my uses clause.

my config is FPC 2.7 cross compiled for linux-arm.

Is there maybe something I need to specify in project options?

#### Andru

• Full Member
• Posts: 112
##### Re: Cross Compile from Windows to Linux ARM
« Reply #5 on: March 19, 2012, 09:57:59 am »
Quote
Is there maybe something I need to specify in project options?
There is no option for this. Something is definitely using cthreads in your project(because only that unit has {\$linklib pthreads} line), or something changed in FreePascal 2.7.x. E.g. I use FreePascal 2.6.x from fix_2_6 branch and there is no problem with pthread till I'm not using cthreads.

#### LA.Center

• Full Member
• Posts: 244
##### Re: Cross Compile from Windows to Linux ARM
« Reply #6 on: March 19, 2012, 10:07:29 am »
thx a lot for your help, I am giving up and go back to linux for linux-arm development. It would have been cool though to get it working in windows too.

BTW: I tried even this:

library test;
begin
end.

and it still got the link error, so I am guessing 2.7 branch is not suited for arm-linux

#### Andru

• Full Member
• Posts: 112
##### Re: Cross Compile from Windows to Linux ARM
« Reply #7 on: March 19, 2012, 10:19:56 am »
Strange... I will try to build FPC 2.7 here and test it.

#### Andru

• Full Member
• Posts: 112
##### Re: Cross Compile from Windows to Linux ARM
« Reply #8 on: March 19, 2012, 10:39:31 am »
Works for me. I built FreePascal 2.7 and have no problems with pthread(the only problem was path to libdl.so, which is not needed for FreePascal 2.6.x). Custom options of my project contains next:
Code: [Select]
`-Cparmv5-CfSOFT-XParm-linux-androideabi--Xd-FD\${LazarusDir}..\android-ndk-r7\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin-Fu\${LazarusDir}..\android-ndk-r7\platforms\android-3\arch-arm\usr\lib-FL\${LazarusDir}..\android-ndk-r7\platforms\android-3\arch-arm\usr\lib\libdl.so`