Lazarus gives a linking error in a directory and not into another one (Mac) lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- ddev · 2020-05-03 11:30 I have a curious problem. I am just starting to use LCL with Lazarus. Just created a very simple program with a Form in which I have 3 buttons, 2 labels and the Open and Save dialogs as well as the select directory one. I can compile and link and run the app outside Lazarus with no problem, but if I copy the project and associated files to another directory, I get the following error message: Fatal: Cannot find Components used by IconsCore. Make sure all ppu files of a package are in its output directory. ppu in wrong directory =/usr/local/lib/fpc/3.0.4/units/x86_64-darwin/univint/Components.ppu.. I uninstalled Lazarus and FPC and installed them again fresh with no avail. Mac OS X 10.14.6 Mojave Lazarus 2.08 64 bits FPC 3.04 ---------------------------------------------------------------------- ddev · 2020-05-03 11:37 I have a curious problem. I am just starting to use LCL with Lazarus. Just created a very simple program with a Form in which I have 3 buttons, 2 labels and the Open and Save dialogs as well as the select directory one. I can compile and link and run the app outside Lazarus with no problem, but if I copy the project and associated files to another directory, I get the following error message: Fatal: Cannot find Components used by IconsCore. Make sure all ppu files of a package are in its output directory. ppu in wrong directory =/usr/local/lib/fpc/3.0.4/units/x86_64-darwin/univint/Components.ppu.. I uninstalled Lazarus and FPC and installed them again fresh with no avail. Mac OS X 10.14.6 Mojave Lazarus 2.08 64 bits FPC 3.04 ---------------------------------------------------------------------- jamie · 2020-05-03 11:52 I don't know a lot about mac but I believe you need an app bundle folder for your ap.. but in your case this isn't so, you are copying project files that has little to do with running the final program.  Lazarus builds the program for you but those project files are just what they are, project files not the resulting program files.  Its like a new house, you can live in the new house after it's built or you can attempt to live in the blue prints, which isn't going to work out so well. I would prefer to live in the new house.  The project files are the blue prints, leave those there.  You should have a finalized binary file in there but as I said I believe with MAC there is a appbuldle path for your final files ---------------------------------------------------------------------- howardpc · 2020-05-03 12:17 Quote from: ddev on May 03, 2020, 01:37:29 pmif I copy the project and associated files to another directory, I get the following error message: You don't say which files you copy. The Lazarus IDE is an integrated development environment (IDE), which means it has all kinds of internal mechanisms for tracking paths, settings and other metadata specific to each individual project. You can't just blithely copy "projects" (whatever you mean by that in terms of files) to fresh locations on your hard disk using OS copy commands which bypass Lazarus' integration, and expect that the unchanged, but largely unseen, metadata will be valid for the new location. To successfully copy a project elsewhere, do so from within the IDE using the Project | Save Project As... menu. ---------------------------------------------------------------------- Martin_fr · 2020-05-03 13:02 @ddev: Please do not post the same message to several boards. I merged your topic from the other board into this thread. ---------------------------------------------------------------------- ddev · 2020-05-03 13:27 Many thanks for the answers, but curiously the problem persists: 1. If I create a very simple program with a TForm using Open and Save dialogs in a clean directory, and if I copy all the relevant files (*.lpi, *lpr, *.lps, *.ico, *.res, *.pas, *.lfm) into another clean (empty) directory, I can compile, build and run with NO problem The same if I use Project / Save Project As. No problem 2. But if I do the same (either copying or saving the project) with a specific directory already full of files, then I get always the same error message: Fatal: Cannot find Components used by IconsCore. Make sure all ppu files of a package are in its output directory. ppu in wrong directory =/usr/local/lib/fpc/3.0.4/units/x86_64-darwin/univint/Components.ppu.. 3. If I build a project anew in that last directory, doing only Project / new and then Save Project, I get the same error message. So it does not depend on copying or moving files instead of doing a project save, but of something specific to that directory that I have used extensively in the past with both XCode and Lazarus for building a console application. There are no hidden files in that directory. I attach a capture of the Finder window with the content of that directory. Mac OS X 10.14.6 Lazarus 2.08 64 bits FPC 3.04 Everything freshly installed with no other versions on disk ---------------------------------------------------------------------- ddev · 2020-05-03 15:00 ... FWIW I get a warning when I compile and build ANY new project in that specific directory: Warning: Recompiling Components, checksum changed for Resources And then the fatal error message: Fatal: Cannot find Components used by IconsCore. Make sure all ppu files of a package are in its output directory. ppu in wrong directory =/usr/local/lib/fpc/3.0.4/units/x86_64-darwin/univint/Components.ppu.. Nothing more than those two messages ---------------------------------------------------------------------- jwdietrich · 2020-05-03 19:17 Perhaps you should check the permissions of this directory. ---------------------------------------------------------------------- ddev · 2020-05-04 12:21 Quote from: jwdietrich on May 03, 2020, 09:17:21 pmPerhaps you should check the permissions of this directory. Already done. FWIW  I can compile in the exact same directory using Lazarus 2.06 with Parallels and Windows 7. Reinstalling everything again I noted the followed warning in FPC installer: Note that currently it cannot yet be used to compile 64 bit GUI programs for Mac OS X So I will keep using Lazarus 2.06 for Windows in Parallels and wait for future versions of both FPC and Lazarus that will allow me creating 64 bits GUI programs with LCL, cocoa for Mac OS X ---------------------------------------------------------------------- trev · 2020-05-05 07:43 Which files are you installing? Are you installing a 32 bit version? There is a 64 bit version of Lazarus/FPC for macOS - see https://sourc eforge.net/projects/lazarus/files/Lazarus%20macOS%20x86- 64/Lazarus%202.0.8/ I've been compiling 64 bit macOS applications with Lazarus since v2.06. Refer: Installing Lazarus on macOS. ---------------------------------------------------------------------- ddev · 2020-05-06 11:06 At last I have found the problem! If I have a file named "Resources.pas" in the current directory, EVEN IF I DON'T INCLUDE THAT FILE IN THE CURRENT PROJECT, then Lazarus will give a fatal error message. Steps to reproduce the problem: 1. If I have a file named "Resources.pas" in the same directory that my current project, even if I do not include it, with an empty unit declaration: unit Resources; interface implementation end. then I get the following error message: Fatal: Cannot find Components used by IconsCore. Make sure all ppu files of a package are in its output directory. ppu in wrong directory =/usr/local/lib/fpc/3.0.4/units/x86_64-darwin/univint/Components.ppu.. 2. Same error message with that empty unit declaration if I put a reference to it, like having a "uses resources" clause in the code of the project. 3. If I put something silly in that file instead of a Unit declaration, then I get an error message from the pascal compiler. So it seems that Lazarus compiles any file named "Resources.pas" in the current directory and chokes on it. Anybody can reproduce that? Mac OS X 10.14.6 Lazarus 2.08 64 bits FPC 3.04 ---------------------------------------------------------------------- tetrastes · 2020-05-06 12:02 You can easily see that your error comes from the package univint, which is specific to MACOS: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lazarus\fpc\3.0.4\source\packages\univint\src where you can find Resources.pas, which is used by Components.pas, which is used by IconsCore.pas. But Resources.pas in project directory has the presedence, so Components.pas uses wrong file. So don't give your files the names of compiler library files. ---------------------------------------------------------------------- ddev · 2020-05-06 12:30 Yes this is the problem. The same occurs if I put a file named "MacTypes.pas" in the current project directory. This is something that should be commented on in "Mac Installation FAQ" or a similar documentation page, as there are probably hundreds filenames already taken in that way. Thanks! ---------------------------------------------------------------------- PascalDragon · 2020-05-06 13:00 Quote from: ddev on May 06, 2020, 02:30:17 pmYes this is the problem. The same occurs if I put a file named "MacTypes.pas" in the current project directory. This is something that should be commented on in "Mac Installation FAQ" or a similar documentation page, as there are probably hundreds filenames already taken in that way. This is not specific to macOS, this is true on any other target as well. ---------------------------------------------------------------------- tetrastes · 2020-05-06 13:31 Yes, in my previous post phrase "which is specific to MACOS" is about package univint, not the error itself.