Project written in Windows will not compile in LInux lazarus / 32-Linux ---------------------------------------------------------------------- HappyLarry · 2012-02-03 00:35 I have written a project that successfully compiles and runs in  Windows. When I try to compile the code in Ubuntu Linux I get the error Error: Can't open resource file "/home/xxx/Unit1.lfm" What can I do to correct this? ---------------------------------------------------------------------- IPguy · 2012-02-03 03:22 Is that a hard coded path in your program? Have you reviewed this link: http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide ---------------------------------------------------------------------- ludob · 2012-02-03 08:20 Check also the access rights to the files. Windows doesn't have access rights, and depending on how you copied the files, the access rights could be wrong for the user trying to open the sources. ---------------------------------------------------------------------- HappyLarry · 2012-02-03 17:32 Thanks to IPguy and ludob for their suggestions but they have not solved the problem. I ran a simple Test to check: I created a project in Windows 7 which opens a blank form. I have added no code at all. It compiles and runs in Windows 7. I created it on a USB Stick. I copied and pasted the project folder from the USB stick into my home folder in Ubuntu (10.04). When I compiled I got the error Unit1.pas(27) Error: Can't open resource file "/home/xxx/Hello World 2/Unit1.lfm" Lazarus can't open the Lazarus .lfm file. This error is  identical to the previous error in the other project. I conclude that the problem is not in any code I wrote, since I haven't written any and 2. The file is not corrupt since the it can be opened by the gedit text editor 3. It is openable since Its permissions are read and write for me. 4. The problem applies to all Lazarus applications written in Windows and transferred to Linux. I wonder if anyone else has tried this and solved the problem? ---------------------------------------------------------------------- HappyLarry · 2012-02-03 17:58 Test 2 I created a 'blank form'  application in Ubuntu : it ran. I transfered it to Windows  and compiled : it ran. I tranferred it back to Ubuntu : it ran, I replaced the 'faulty' unit1.lfm file that previously wouldn't open with the 'good' unit1.lfm of this project - the 'faulty' project compiled and ran. The two project1.lfm files look identical to me. My advice is: always create a project in Ubuntu Linux first. My problem is: I didn't. Any ideas? ---------------------------------------------------------------------- IPguy · 2012-02-03 18:10 (Un)HappyLarry, What version of Laz and fpc are you using?  Are they the same (or similar) on both platforms?  (probably not the issue, though) Have you grep'd for "Hello" in your project files on the unix system or reviewed the .lpi & .lpr files for odd file inclusions? Have you looked at the project files listing on the Windows platform to see if any unexpected files are being included in your project? (I'm not near my Laz installation, so I cannot give you the proper menu steps to check this.) ---------------------------------------------------------------------- ludob · 2012-02-03 18:13 QuoteThe two project1.lfm files look identical to me.There is a line that says something Code: [Select]LCLVersion = '0.9.31'Are they both the same? ---------------------------------------------------------------------- IPguy · 2012-02-03 18:15 From your unix box, you could do a diff on the various files of the windows blank project vs the unix blank project to see if anything interesting shows up. ---------------------------------------------------------------------- HappyLarry · 2012-02-03 18:52 @ludob The 'bad file called unit1old.lfm - object Form1: TForm1   Left = 240   Height = 240   Top = 226   Width = 320   Caption = 'Form1'   LCLVersion = '0.9.30' end The good file called unit1.lfm - object Form1: TForm1   Left = 275   Height = 240   Top = 250   Width = 320   Caption = 'Form1'   LCLVersion = '0.9.30' end The only difference is the position on the screen of the form. I checked the file sizes Bad = 131 bytes Good =123 bytes but I suppose this is accounted for by the different names. Is this a bug? ---------------------------------------------------------------------- ludob · 2012-02-03 18:58 8 bytes? That is the number of lines. So the problem is the windows CR LF line termination while linux is using LF only. ---------------------------------------------------------------------- HappyLarry · 2012-02-03 19:08 @IPguy diff $ diff --normal unit1.lfm unit1old.lfm 1,8c1,8 < object Form1: TForm1 <   Left = 275 <   Height = 240 <   Top = 250 <   Width = 320 <   Caption = 'Form1' <   LCLVersion = '0.9.30' < end --- > object Form1: TForm1 >   Left = 240 >   Height = 240 >   Top = 226 >   Width = 320 >   Caption = 'Form1' >   LCLVersion = '0.9.30' > end I  also tried 'cmp' which suggests something in line 1 cmp $ cmp -c unit1.lfm unit1old.lfm unit1.lfm unit1old.lfm differ: byte 21, line 1 is  12 ^J  15 ^M Is there a hidden character at the end of line 1? ---------------------------------------------------------------------- IPguy · 2012-02-04 03:46 What is the version of Laz and fpc you are using? as an example, I'm using: Lazarus version 0.9.31, SVN revision: 34510, with fpc 2.5.1, on a win32 -vista system. As to the differences you found using cmp, I refer you to ludob's comment. Might you have hand edited your windows unit1.lfm file, by any chance? ---------------------------------------------------------------------- TurboRascal · 2012-02-09 23:06 In the non-working example, you wrote "Unit1.lfm" filename. In the latter, working one, you quoted "unit1.lfm" - the difference in starting capital letter. Could this be the problem? Linux is case sensitive, maybe the unit name is written differently in the project and in the filesystem?