Recent

Author Topic: Help!I dont get it!Cross compile linux to win32.......  (Read 15425 times)

belajardelphi

  • Guest
Help!I dont get it!Cross compile linux to win32.......
« on: February 14, 2006, 06:48:38 am »
I download fpc crosswin and i don't know what I have to do with that...
I try read about cross compile on lazarus wiki and I'm still don't understand.
Please tell me how to compile my program from linux to win32 so i can run in my Windows XP
i'm using fpc 2.0.2 and lazarus 0.9.12, and fpccrosswin on Suse 93

Thanks!

mikiwoz

  • Full Member
  • ***
  • Posts: 130
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #1 on: February 14, 2006, 11:01:00 am »
install lazarus, install fpccrosswin, and when you have them installed, open Lazarus and:
go to the Project -> Compiler Options menu and
  in Paths -> Target Widgetset choose Win32
  in Code -> Target Os chose Win32
  in Linking select Win32 GUI application

after that, go to Tools -> Configure Build Lazarus menu and
  set LCL Interface to Win32
  mark only Build LCL as Build + Clean, mark everything else as None

after that go to Tools -> Rebuild Lazarus and rebuild it (actually you will only rebuild the LCL - the only thing you need for cross-compiling)

When the cross-compiling of LCL is done, you can now cross-compile your project. Remember to *always* set the following before cross-compilation:
in the Project -> Compiler Options menu:
  in Paths -> Target Widgetset set to Win32
  in Code -> Target Os set to Win32
  in Linking select Win32 GUI application

and compile your project. you should get a perfectly working Windows exe.

Cheers
Mike

pinguin

  • Newbie
  • Posts: 3
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #2 on: February 16, 2006, 04:14:37 pm »
I think  I do exactly like you explain..but i guess i mess up somewhere(maybe i forget something)...so i get this message:
if run Lazarus from menu and build lazarus with  win32 LCL i have message ( i'm not sure iwill check again..):

make[2]: *** [../../units/i386-linux/win32] Error 1

then i go to virtual console try to run lazarus as root
su
password:*****
#lazarus
build lazarus  with win32 lcl (like u r instruction)
Then i got message
"Clean Lazarus Source" completed
/usr/lib/lazarus/lcl/interfaces/win32/win32int.pp(1,1) Fatal: Can't find unit Windows

pinguin

  • Newbie
  • Posts: 3
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #3 on: February 18, 2006, 03:58:10 am »
I have build LCL and  I have message

/usr/lib/lazarus/lcl/interfaces/win32/win32proc.pp(865,2) Note: User defined: Should be moved to WSWin32Forms, if the windowproc is splitted
/usr/lib/lazarus/lcl/interfaces/win32/win32proc.pp(949,2) Note: User defined: Belongs in Win32WSForms, but is needed in windowproc
/usr/lib/lazarus/lcl/interfaces/win32/win32winapi.inc(1359,4) Warning: User defined: TWin32WidgetSet.FrameRect TODO: optimize ARect copying
"Build LCL" completed

I can crosscompile to win32 ( it  work find when i try iy on winxp) but the lazarus crash after succesfulcros compile

mikiwoz

  • Full Member
  • ***
  • Posts: 130
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #4 on: February 18, 2006, 09:12:57 pm »
strange, I have no problems on Lazarus 0.9.10... have to try the 0.9.12. maybe you could run Lazarus from the console window and paste the output here?

Cheers
Mike

pinguin

  • Newbie
  • Posts: 3
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #5 on: February 24, 2006, 02:23:46 pm »
This is message if i cross compile an aplication to win32 ( I make a blank form and cross compile it)
Compiling ../myproject/PEazySqlpass.lpr
Linking /home/user/myproject/peazysqlpass.exe
15 Lines compiled, 6.4 sec
[TCompiler.Compile] end
TBaseCompilerOptions.CreateTargetFilename MainSourceFileName=/home/user/myproject/PEazySqlpass.lpr OutFilename=peazysqlpass TargetFilename=
[TDebugManager.DoInitDebugger] A
TBaseCompilerOptions.CreateTargetFilename MainSourceFileName=/home/user/myproject/PEazySqlpass.lpr OutFilename=peazysqlpass TargetFilename=
[TDebugManager.OnDebuggerChangeState] state: dsIdle
TBaseCompilerOptions.CreateTargetFilename MainSourceFileName=/home/user/myproject/PEazySqlpass.lpr OutFilename=peazysqlpass TargetFilename=
[TDebugger.SetFileName] "/home/user/myproject/peazysqlpass.exe"
[TDebugManager.OnDebuggerChangeState] state: dsStop
[TDebugManager.DoInitDebugger] END
[TMainIDE.DoRunProject] B
TDebugManager.RunDebugger B TProcessDebugger
PR: /home/user/myprojectpeazysqlpass.exe
[TDebugManager.OnDebuggerChangeState] state: dsRun
[TMainIDE.DoRunProject] END

Gdk-WARNING **: GdkWindow 0x2c0020f unexpectedly destroyed

Gdk-WARNING **: GdkWindow 0x2c0020e unexpectedly destroyed
Xlib: unexpected async reply (sequence 0x2a0b0)!
Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
  serial 172210 error_code 9 request_code 70 minor_code 0
Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
  serial 172218 error_code 9 request_code 66 minor_code 0

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #6 on: February 24, 2006, 04:19:53 pm »
Compilation succeeded. But you cannot run cross compiled win32 applications on linux.

lepidosteus

  • New Member
  • *
  • Posts: 38
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #7 on: February 28, 2006, 02:37:47 pm »
Excuse my ignorance, but are you speaking of a way to compile under an os an executable wich will runs under another os ?

let's say I'm working under win32, could i compile my project to run under linux using that ?

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #8 on: February 28, 2006, 04:32:00 pm »
Yes. It is possible to compile a Windows-executable on a Linux box. (Or vice versa)
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

lepidosteus

  • New Member
  • *
  • Posts: 38
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #9 on: February 28, 2006, 05:14:06 pm »
Does the directive works correctly ? (ie, {$ifdef win32} won't be true if 'im compiling for, let's say linux)

If yes, you just made my day and I must give it a try !

mikiwoz

  • Full Member
  • ***
  • Posts: 130
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #10 on: February 28, 2006, 11:14:58 pm »
yep, the directives work correctly, i.e. if you have and {$IFDEF win32} and compile FOR win32 but UNDER linux - the code in IFDEF WILL be executed, just as it would be being compiled under win32. That's the whole point.

Cheers
Mike

lepidosteus

  • New Member
  • *
  • Posts: 38
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #11 on: February 28, 2006, 11:54:13 pm »
Trying to compile under linux for win32 i have an error when rebulding the LCL, it says 'can't find unit Windows'

What path should i add and where ?

Anonymous

  • Guest
RE: Help!I dont get it!Cross compile linux to win32.......
« Reply #12 on: March 10, 2006, 11:25:42 pm »
no you can't do this in the other way, I mean, you can't compile for linux from windows

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: RE: Help!I dont get it!Cross compile linux to win32.....
« Reply #13 on: March 13, 2006, 08:26:00 am »
Quote from: "Anonymous"
no you can't do this in the other way, I mean, you can't compile for linux from windows


Why not?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: RE: Help!I dont get it!Cross compile linux to win32.....
« Reply #14 on: March 13, 2006, 08:27:51 am »
Quote from: "lepidosteus"
Trying to compile under linux for win32 i have an error when rebulding the LCL, it says 'can't find unit Windows'

What path should i add and where ?


You need the fpc units (RTL, FCL and packages) for windows.

Install them in PREFIX/lib/fpc/$FPCVERSION/units/i386-win32