Recent

Author Topic: Cross Compilation For ARM:Success! Now Win32 Broken :-/  (Read 20251 times)

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« on: August 30, 2007, 05:58:47 pm »
Hello everyone.

I am new to Lazarus and the whole FreePascal way of doing things. Last time i wrote a program in Pascal was ca 1995  and back then it was all about getting the VGA to Mode X and having fun with graphics.

Anyway, this post is about getting both ARM and Win32 Applications / Programs to compile correctly from within Lazarus.

I got the ARM part working but now Win32 is broken and this is where i need your help.

Getting Lazarus To Compile an ARM Program:
Download and install FPC2.1.4 for i384-win32 (in C:\FPC)
Download and install the FPC 2.1.4 WinCE add on (Adds arm-* to your C:\FPC)
Download and Install Lazarus (Lazarus brings FPC 2.0.4 with it)
Download and Install the Lazarus WinCE Add On (This will add FPC 2.1.5 to your {LazarusDir}/fpc/)

An entry in the wiki prompts users wanting to compile applications for the ARM target to download a snapshot of lazarus with WinCE tried and tested. The link is broken and this is what started everything for me

So, with the current configuration you can compile and run Win32 Programs but you get some errors (can not execute ppcarm.exe, etc) when trying to compile ARM applications.

Since all i wanted was to run a simple ARM console program, i figured that since i have the FPC 2.1.4 with the ARM add-on installed i should be able to do so by telling Lazarus to use that compiler.

I did that by changing the Compiler Path to my FPC2.1.4 directory.
I also changed the Architecture and Target OS to arm and WinCE respectively.

Hit the play button and i had myself my simple ARM compiled console application.

Now, with the same settings (But obviously the win32 arch), i started a new Application project with the intention to compile and run a Win32 GUI application with the FPC2.1.4 compiler.

Unfortunately, this does not work as i get the error:
Can't find unit interfaces
The error is emmitted at the Use CThreads point.
(Additionaly, when i try to compile an ARM GUI application i get the same error :-( )

My questions are these:
Which fpc.cfg does Lazarus use? Does it use a default cfg or does it pick up the correct cfg from the compiler's directory?

Which Unit interfaces does this error refer to? Within my FPC2.1.4 directory there are all the neccessary unit files for both i386 and arm architectures.

Is there a walk-through on how to direct lazarus to use another FPC version for compilation?

Should i have the GUI components pre-compiled somewhere?

Looking forward to hearing from you

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #1 on: August 30, 2007, 06:46:20 pm »
Quote from: "HasTheBlues"

An entry in the wiki prompts users wanting to compile applications for the ARM target to download a snapshot of lazarus with WinCE tried and tested. The link is broken and this is what started everything for me


Which link is broken? This wiki page:

http://wiki.lazarus.freepascal.org/Windows_CE_Interface

has a link to ftp://ftp.hu.freepascal.org/pub/lazarus/cross/

Which works for me

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #2 on: August 30, 2007, 10:06:00 pm »
Hello

Thanks for your response.

No, the link you are posting (and ofcourse works) is the Lazarus Add On for wince. This is the one which brings fpc 2.1.5 with it.

The link i am refering to is this:
http://www.see-cure.de/files/lazarus-arm-wince-20060707.7z
And is supposed to be an older version of lazarus precompiled WITH WinCE support.

The quest is on :-)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2648
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #3 on: August 31, 2007, 12:47:13 pm »
when compiling for win32, did you swithc back the compiler, target, cpu and widgetset settings ? Failing to do so for one of them results in a "Can't find unit interfaces"
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #4 on: August 31, 2007, 01:01:26 pm »
Hello Marc

Thanks for your reply, to which i can only say that

"Yes Marc when i switch the target i switch everything back to (Including GUI settings) what they are supposed to be for the specific architecture i am trying to compile for" :-)

Anyway, is there a walkthrough for updating the compiler that Lazarus uses? So for example, right now i have FPC 2.1.4 at some location on my disk and i am trying to get Lazarus to use THAT FPC instead of the "internal" ({LazarusDir}/fpc") compiler it uses. I have a feeling that i am forgetting some setting, although i have gone through most of the settings numerous times.

I welcome any help at this point :-)

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #5 on: August 31, 2007, 01:23:04 pm »
If you change the compiler version on the same target, you need to recompile the LCL.

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #6 on: August 31, 2007, 01:29:50 pm »
Brilliant!

Thanks for your reply Vincent, i feel that i am getting somewhere.

So, now i can compile and run:
Console Applications for ARM/WinCE using FPC 2.1.4
GUI Applications for i386/Win32

I presume that i should have the LCL compiled for the WinCE interface as well if i want to compile GUI Applications for ARM/WinCE, correct?

Looking forward to hearing from you ;-)

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #7 on: August 31, 2007, 01:33:01 pm »
It doesn't hurt, but if you used the lazarus add on, they will contain matching fpc units and lcl units.

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #8 on: August 31, 2007, 01:41:34 pm »
Hello again Vincent

I did download and install Lazarus with the WinCE add-on.

However, in the {LazarusDir}/fpc i had "two versions" of fpc. These were 2.0.4 and 2.1.5. The 2.1.5 directory contained only the arm-* set of buildutils.

The lcl/{units, widgets} directories do contain separate trees for the wince and win32 OSs.

Since i executed "make" on the top level directory is it safe to assume that it has been called recursively and that the wince part should have been compiled as well with FPC2.1.4?


(By the way, switching to GUI Elements:WinCE, Target {OS, Arch} to {WinCE, ARM} still gives me a "Interface not found" kind of error)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2648
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #9 on: August 31, 2007, 01:44:14 pm »
Quote from: "HasTheBlues"
Hello Marc

Thanks for your reply, to which i can only say that

"Yes Marc when i switch the target i switch everything back to (Including GUI settings) what they are supposed to be for the specific architecture i am trying to compile for" :-)


It happened to me more than once that I forgot one of them (usually widgetset). Thats why I asked.

Quote


Anyway, is there a walkthrough for updating the compiler that Lazarus uses? So for example, right now i have FPC 2.1.4 at some location on my disk and i am trying to get Lazarus to use THAT FPC instead of the "internal" ({LazarusDir}/fpc") compiler it uses. I have a feeling that i am forgetting some setting, although i have gone through most of the settings numerous times.

I welcome any help at this point :-)


Lazarus always uses the compiler which you specify in compiler options. (and only that one)
However, as vincent already pointed out, the LCL you use must match the exact compiler version. If not, you need to recompile the LCL whith that specific compiler. It is not necesary to recompile lazarus.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #10 on: August 31, 2007, 01:51:57 pm »
Hello Marc

Thanks for coming back about this. I understand that in frustrating times people tend to be more error prone but in this case, since the combination of GUI elements, Target OS and Arch are essential to what i am trying to do, i have been checking and double checking before i post my results.

Anyway, i have compiled the LCL (not the whole IDE) with FPC 2.1.4 as i mention above.

Your post touched upon something i asked initially about the fpc.cfg.

Afterall, which fpc.cfg file does lazarus use?
Does it pick it up from the directory of the compiler?
Is there a setting for it?
Or could it be that it does not use the compiler's fpc.cfg but relies on the internal settings accessible through compiler options?

HasTheBlues

  • New Member
  • *
  • Posts: 11
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #11 on: September 03, 2007, 12:20:00 pm »
Hello Everyone

I am trying to compile the LCL using the FPC 2.1.4 but when i type

Code: [Select]

make all


i noticed that only the i386-win32 target is built.

I also noticed that the default compiler used was ppc386.exe

How can i change these settings to compile the LCL for the arm-wince target?
(Trying
Code: [Select]

make arm-wince

did not work :-( )

Looking forward to hearing from you.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2648
Cross Compilation For ARM:Success! Now Win32 Broken :-/
« Reply #12 on: September 03, 2007, 02:35:36 pm »
Lazarus is "using" the same fpc.cfg as the fpc compiler is using. Lazarus doesn't read the cfg itself, but it uses the compiler to get the configuration.

I use this line to compile a lcl for arm (I assume you dont want to compile an ide for arm :)
Code: [Select]
make lcl CPU_TARGET=arm OS_TARGET=wince PP=c:\fpc\fpc.2.1.5\compiler\ppcrossarm.exe LCL_PLATFORM=wince OPT=-g
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

HasTheBlues

  • New Member
  • *
  • Posts: 11
At last
« Reply #13 on: September 03, 2007, 04:51:38 pm »
Many thanks Marc this finally worked! My application executed succesfuly, at least on the emulator. I will try it on the device as well, when i get home but i do not see no reason why it should not operate as expected.

I opened the makefile and noticed the target_os and the other parameters but just trying with these i was getting that "Unit System not found" error.

I think that the parameter that made the difference was PP pointing to my FPC directory.

By the way, i am always using fpc.exe, i believe it handles different architectures and bindings on its own.

I keep the extraordinary feelings of hapiness for after i have tested the executable on the device ;-) (However, so far, Lazarus has been the most efficient solution for programming my PDA).

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2648
RE: At last
« Reply #14 on: September 04, 2007, 12:16:56 pm »
in the early days fpc.exe wasn't that flexible, with calling ppc directly I can exactly control which version of the compiler should be used.
Atm, I've a win32 2.0.4/2.1.5/2.2.0 crossarm 2.1.5 and a x64 2.1.5/2.2.0 compiler
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018