Recent

Author Topic: Best Practice for Cross Platform Compiling?  (Read 9389 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Best Practice for Cross Platform Compiling?
« on: November 18, 2011, 03:33:52 am »
I am in the process of converting several very substantial programs to Free Pascal/Lazarus. They need to run on Windows as well as Mac. My main development platform is Mac OS X. I have been using the latest stable FPC version, presently 2.4.4. On the Mac I am keeping Lazarus up to date using svn.

Tonight I was trying to compile a simple program for a colleague in Windows XP, and spent 2 hours on it. A form with a TStringGrid component would not compile with the standard installation. Eventually I got it to compile using the latest daily snapshot, but in running it all the windows in Lazarus had black backgrounds. It finally compiled but I could not see what was going on.

I'm feeling pretty discouraged now about my commitment to cross-platform development in Lazarus. I easily have a few hundred hours spent in translating code. Any suggestions from people in similar situations would be appreciated.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8785
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Best Practice for Cross Platform Compiling?
« Reply #1 on: November 18, 2011, 07:26:05 am »
The risk of using snapshot/svn version is of course the instability of bugs and (new) features. You can try using stable version, or try fixes snapshot version (that only corporate bugfixes and no new features).

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Best Practice for Cross Platform Compiling?
« Reply #2 on: November 18, 2011, 07:50:17 am »
I write software daily in Lazarus svn in Mac OS X, Linux and Windows XP and problems like you say are rare.

If the IDE is missbehaving you can just kill it and restart it, it solves almost anything.

> A form with a TStringGrid component would not compile with the standard installation.

0.9.31 is very different from 0.9.30, many basic parts changed. If you write a software in 0.9.31 you will likely face issues trying to run it with 0.9.30.

I think this kind of problem will be less common in the future, because we already did most large structural changes that we needed.

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Re: Best Practice for Cross Platform Compiling?
« Reply #3 on: November 18, 2011, 02:04:59 pm »
Thanks guys, I was feeling depressed. I probably need to spend more time making sure the Windows IDE is up to date. The daily snapshot on Windows seemed to be really badly behaving, I restarted multiple times, including rebooting.

I was surprised that 0.9.31 would not compile, or even load, under 0.9.30, so appreciate the explanation.

felipemedc - Glad to know you are doing this successfully. I will move to Linux as well after I get the procedure running smoothly. Do you also use svn on the Windows IDE? If so, do you have any suggestions?

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Best Practice for Cross Platform Compiling?
« Reply #4 on: November 18, 2011, 02:16:54 pm »
Do you also use svn on the Windows IDE? If so, do you have any suggestions?

Yes, I also use Lazarus Svn on Windows. For me the latest revision works fine.

Usually freezing problems are related to debugging, and some of them related to GDB itself. You might need to kill GDB sometimes, only killing Lazarus might not be enough if GDB is stuck in an unstable state.

I can imagine that you might either:

1> Have hit a particular bug, in which case you should try to find reliable steps to reproduce it and report in the bug tracker.
or
2> You have hit an unstable revision, in this case just upgrading to the snapshot from tomorrow or something like that should fix it.
« Last Edit: November 18, 2011, 02:22:56 pm by felipemdc »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4552
  • I like bugs.
Re: Best Practice for Cross Platform Compiling?
« Reply #5 on: November 18, 2011, 05:02:27 pm »
Thanks guys, I was feeling depressed. I probably need to spend more time making sure the Windows IDE is up to date. The daily snapshot on Windows seemed to be really badly behaving, I restarted multiple times, including rebooting.

I was surprised that 0.9.31 would not compile, or even load, under 0.9.30, so appreciate the explanation.

It sounds like your installation mixes parts of the old version. It is very common for people updating the version.
0.9.31 is not supposed to compile under 0.9.30. You should get rid of the old version and do "make clean all" for the trunk version.
Then use the Configure Build Lazarus dialog after that.
Trunk has hickups sometimes but I dare to say it is very good now. Better than 0.9.30 for sure.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Re: Best Practice for Cross Platform Compiling?
« Reply #6 on: November 22, 2011, 03:00:16 am »
I still have had no luck getting Lazarus to run on Windows (XP Professional Version 2002 Service Pack 2). I have tried 3 of the daily snapshots, each time deleting the Lazarus directory. Most recently:

Lazarus-0.9.31-33660-fpc-2.4.4-20111121-win32.exe

Lazarus starts up, and I can load a project, but the windows have black backgrounds. Yesterday I was able to compile a program which worked fine. However, today I am getting an error message that I can not see, so can't fix.

I really would rather cross-compile from OS X to Windows. I got FPC to compile a simple Windows program, but can't manage to get Lazarus to compile one.

I'm kind of stuck here and would appreciate any help.

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Re: Best Practice for Cross Platform Compiling?
« Reply #7 on: November 22, 2011, 03:13:46 am »
I did get it to compile, and the program works fine. I just had a directory in the wrong relative location. Lazarus still has black windows though. :/
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4552
  • I like bugs.
Re: Best Practice for Cross Platform Compiling?
« Reply #8 on: November 22, 2011, 08:29:54 am »
I did get it to compile, and the program works fine. I just had a directory in the wrong relative location. Lazarus still has black windows though. :/

I haven't seen the black windows problem, but anyway you should also delete the local Lazarus config directory. Path is something like :
  Primary config directory=C:\Users\Juha\AppData\Local\lazarus

Also search for .ppu files and delete them all.
Then you will have a clean compile for sure.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1242
    • formatio reticularis
Re: Best Practice for Cross Platform Compiling?
« Reply #9 on: December 03, 2011, 01:01:58 pm »
For cross-platform compiling I strongly recommend to use the same Lazarus version on all platforms.

Additionally it may be (and in my experience it is) useful to rebuild the whole code of your project occasionally and each time after you changed the platform. Select the menu point "Run: Build all" for this task.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 3.7.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Best Practice for Cross Platform Compiling?
« Reply #10 on: December 03, 2011, 01:31:37 pm »
I do not know if this is related to your "black screen" or not, but I know that under Windows7, if you set a TForm.Position to poDefault or poDefaultSizeOnly, at run-time the Form is much larger width and height and the "Added Area" is black but the "Original Area" is normal.
Lazarus Trunk / fpc 2.6.2 / Win32

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Re: Best Practice for Cross Platform Compiling?
« Reply #11 on: December 04, 2011, 04:25:46 pm »
Thanks for your input all. I am still having no luck getting Lazarus 0.9.31 to display correctly under FPC 2.4.4 on Windows XP. I deleted all references I could find to FPC and Lazarus following Juha's recommendation. Deleted the configuration directory, and .ppu files too. Tried another Lazarus snapshot, rebuilt it clean, etc. I even uninstalled TortoiseSVN just in case.

Lazarus still does not display window content correctly. The background is mostly black. If I maximize a window I can see the content, but the window does not appear to be drawing correctly into it's display context.

I am able to compile my programs from the files I wrote on Mac OS X. They run fine, but if the compiler reports an error I can't see it, so need to do any debugging on the Mac. I'd go back to an earlier version, but the svn version has fixed some bugs I had run into on the Mac.

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1224
  • Former Turbo Pascal 3 user
Re: Best Practice for Cross Platform Compiling?
« Reply #12 on: December 04, 2011, 05:00:01 pm »
I just tried installing:

lazarus-0.9.30-fpc-2.4.2-win32.exe

and then:

lazarus-0.9.30.2-fpc-2.4.4-win32.exe

No luck with either. Very strange, I have had it running before.

Deleted all components and config directory. Installed:

Lazarus-0.9.31-33932-fpc-2.4.4-20111204-win32.exe

Ran Lazarus again, no luck.

ran:

make clean all

No luck.
« Last Edit: December 04, 2011, 05:42:53 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 14.5: Lazarus 3.4 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.4 (64 bit on VBox)

 

TinyPortal © 2005-2018