Best Practice for Cross Platform Compiling? lazarus / 34-Windows ---------------------------------------------------------------------- VTwin · 2011-11-18 02:33 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. ---------------------------------------------------------------------- Leledumbo · 2011-11-18 06:26 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 · 2011-11-18 06:50 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 · 2011-11-18 13:04 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 ---------------------------------------------------------------------- felipemdc · 2011-11-18 13:16 Quote from: Frederick on November 18, 2011, 02:04:59 pmDo 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. ---------------------------------------------------------------------- JuhaManninen · 2011-11-18 16:02 Quote from: Frederick on November 18, 2011, 02:04:59 pmThanks 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 ---------------------------------------------------------------------- VTwin · 2011-11-22 02:00 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 ---------------------------------------------------------------------- VTwin · 2011-11-22 02:13 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. :/ ---------------------------------------------------------------------- JuhaManninen · 2011-11-22 07:29 Quote from: Frederick on November 22, 2011, 03:13:46 amI 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 ---------------------------------------------------------------------- jwdietrich · 2011-12-03 12:01 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. ---------------------------------------------------------------------- Avishai · 2011-12-03 12:31 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. ---------------------------------------------------------------------- VTwin · 2011-12-04 15:25 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 ---------------------------------------------------------------------- VTwin · 2011-12-04 16:00 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.