compiler hangs lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- RxRick · 2010-07-01 04:57 Lazarus 0.9.29 FPC 2.40 SVN: 25928M Mac OS X 10.6.3 i'm new to mac os, likely doing something fundamentally wrong. i click build or run, and lazarus hangs up with the spinning wheel cursor. i have to force quit (nonresponding). i may have installed it incorrectly? lazarus installed here: Macintosh HD->Developer->lazarus fpc installed here: Macintosh HD->Developer->freepascal or options are incorrect? lazarus directory: /Developer/lazarus/ Compiler path: /Developer/freepascal/fpc/compiler/ppc386 FPC source directory: /Developer/freepascal/fpc/ Make path (blank) Directory for building test projects: /tmp/ Compiler messages language file: (blank) please help, i'm at my wit's end. thank you ---------------------------------------------------------------------- skalogryz · 2010-07-01 21:10 try to disable the debugger. It might be possible that Lazarus hangs on the debugger start. Environment->Debugger-> select "(none)" Also, try to build the project and run the application from the Finder. ---------------------------------------------------------------------- RxRick · 2010-07-02 13:34 thanks for the reply. it hangs on build or run. i originally had debugger off. thinking that was the problem, i turned it on. no difference, it hangs regardless. no error messages, just sits there with the busy cursor spinning until i force quit. thinking i was impatient, i've let it set for hours. it doesn't matter what project, a simple 'hello word', or one of the examples, or a working project i've brought over from windows. lazarus does create a file, but when i click mac says "you can't open the application because it may be damaged or incomplete" ---------------------------------------------------------------------- skalogryz · 2010-07-02 13:48 can you compile: Code: [Select]begin   writeln('hello world'); end. from command line: Code: [Select]  fpc test.pas ---------------------------------------------------------------------- RxRick · 2010-07-02 14:32 thanks again. wow, it's been years since i used vi. can't say i've missed it. anyway, created the file 'test.pas' in the /Developer/freepascal/fpc/compiler folder. and yes, it compiled, and yes it runs correctly. ---------------------------------------------------------------------- RxRick · 2010-07-02 14:36 in terminal it says compiled with fpc version 2.5.1, which is different than what lazarus thinks it has (it says fpc 2.4.0 in the lazarus about box). could that be the problem? i'm so confused at this point. ---------------------------------------------------------------------- skalogryz · 2010-07-02 15:41 Quote from: RxRick on July 02, 2010, 04:36:48 pmin terminal it says compiled with fpc version 2.5.1, which is different than what lazarus thinks it has (it says fpc 2.4.0 in the lazarus about box). could that be the problem? i'm so confused at this point. About box contains the version of the compiler Lazarus has been built with. It's still hard to say what's wrong with you installation. Could you run the Lazarus from the command line and paste the output here. To run lazarus, execute following lines in Terminal: Code: [Select]cd /Developer/lazarus/lazarus.app/Contents/MacOS ./lazarus The lazarus should start. Create a new Application project, Save it somewhere on the disk and run. ---------------------------------------------------------------------- RxRick · 2010-07-02 19:16 thanks for the reply. below is everything in Terminal from when i started lazarus, until it hangs up. ------------- ./lazarus TMainIDE.ParseCmdLineOptions:   PrimaryConfigPath="/Users/rxrick/.lazarus"   SecondaryConfigPath="/etc/lazarus" TMainIDE.DoNewProject A TCarbonTabsControl.SetFocus Error: SetKeyboardFocus  failed with result -30585 TCarbonTabsControl.SetFocus Error: SetKeyboardFocus  failed with result -30585 TMainIDE.DoNewProject A TCarbonTabsControl.SetFocus Error: SetKeyboardFocus  failed with result -30585 TCarbonTabsControl.SetFocus Error: SetKeyboardFocus  failed with result -30585 TCarbonTabsControl.SetFocus Error: SetKeyboardFocus  failed with result -30585 AddComponent TButton Parent=Form1:TForm1 81,78,0,0 Parent is 'Form1:TForm1' TMainIDE.OnPropHookPersistentAdded A Button1:TButton TPkgManager.AddUnitDependenciesForComponentClasses Extending Uses unit1.pas StdCtrls [TEventsCodeTool.CompleteComponent]  CurComponent=Button1:TButton TCarbonWidgetSet.GetFocus Error: GetKeyboardFocus  failed with result -30586 TCarbonBitBtn.SetFocus Error: SetKeyboardFocus  failed with result -30585 TCarbonBitBtn.SetFocus Error: SetKeyboardFocus  failed with result -30585 TCarbonBitBtn.SetFocus Error: SetKeyboardFocus  failed with result -30585 TMainIDE.DoRenameUnit unit1.pas NewUnitName=unit1 OldUnitName=Unit1 ResourceCode=False NewFilename="/Users/rxrick/Documents/unit1.pas" TProject.DoLoadStateFile Statefile not found: /Users/rxrick/Documents/project1.compiled TMainIDE.CheckIfPackageNeedsCompilation  No state file for Project TCompiler.Compile WorkingDir="/Users/rxrick/Documents/" CompilerFilename="/Developer/freepascal/fpc/compiler/ppc386" CompilerParams=" -MObjFPC -Scgi -O1 -Xs  -k-framework -kCarbon -k-framework -kOpenGL -k'-dylib_file' -k'/System/Library/Frameworks/Op enGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Framew orks/OpenGL.framework/Versions/A/Libraries/libGL.dylib' -vewnhi -l -Fi/Users/rxrick/Documents/ -Fu/Developer/lazarus/lcl/units/i386-darwin/ -Fu/Developer/lazarus/lcl/units/i386-darwin/carbon/ -Fu/Developer/lazarus/packager/units/i386-darwin/ -Fu/Users/rxrick/Documents/ -Fu. -FE/Users/rxrick/Documents/ -oproject1 -dLCL -dLCLcarbon project1.lpr" ---------------------------------------------------------------------- skalogryz · 2010-07-02 20:15 hmm... everything seems to be in order. I'm afraid I've nothing else to suggest but to try the latest Snapshot, your's is a bit out of date. ---------------------------------------------------------------------- RxRick · 2010-07-02 21:00 thanks, i appreciate your efforts to help. ---------------------------------------------------------------------- RxRick · 2010-07-02 21:22 okay, so I: svn up make clean all it doesn't hang! but I get fatal error: Can't find unit Interface ---------------------------------------------------------------------- RxRick · 2010-07-02 22:01 okay, if i start lazarus from a terminal, it works. ---------------------------------------------------------------------- skalogryz · 2010-07-03 06:32 Quote from: RxRick on July 02, 2010, 11:22:05 pmit doesn't hang! but I get fatal error: Can't find unit Interface where is svn lazarus directory? Is it /Developer/lazarus? It seems that you have 2 different Lazarus installations. One if from .dmg file and another is from SVN repo. ---------------------------------------------------------------------- RxRick · 2010-07-03 13:16 yes, i believe that is likely what happened. as i said in my first post, i am new to mac os, so i must be doing something fundamentally wrong. i originally downloaded the dmg files, couldn't get anything to work, couldn't even figure out where lazarus/fpc were installed. so i used the manual method described in the faq's. there are probably two versions of fpc on here somewhere also. to remove them i'm guessing i need to open a terminal window and navigate to some folders that are hidden from the finder gui? ---------------------------------------------------------------------- skalogryz · 2010-07-03 13:30 You don't need to uninstall anything yet. Where's your SVN lazarus located? what dir? ---------------------------------------------------------------------- RxRick · 2010-07-03 14:07 yes, the svn lazarus is in \Developer\lazarus ---------------------------------------------------------------------- skalogryz · 2010-07-03 16:06 ok. your options seems to be fine. is your bug fixed now? does Lazarus launch a project fine? ---------------------------------------------------------------------- RxRick · 2010-07-03 19:49 thanks so much for all your help, i've been struggling with this, on and off, for weeks. yes, i can compile a project if i start lazarus from a terminal window, as you explained in a earlier reply. (hurray, my first working mac program!) however, if i start lazarus from the icon on the dock, it throws this fatal error when I try to build: Error: resource compiler "fpcres" not found, switching to external mode. Fatal: There were 1 errors compiling module, stopping ---------------------------------------------------------------------- skalogryz · 2010-07-03 20:17 Quote from: RxRick on July 03, 2010, 09:49:19 pmError: resource compiler "fpcres" not found, switching to external mode. Fatal: There were 1 errors compiling module, stopping that's fine and the problem is known. As far as i can see, you're using fpc svn version as well. Or you've used some quite old .dmg that didn't competely installed FPC. The compiler cannot find fpcres tool. A symbol link to the tool must be created at /usr/local/bin directory. First of all you need to find "fpcres". Run Terminal and type Code: [Select]find / -iname fpcres This will take some time. I suspect the fpcres binary would be located at /Developer/freepascal/fpc/ directory. once you've the fpcres found you need to create the symbolic link. in the Terminal execute the following commands Code: [Select]cd /usr/local/bin sudo ln -s full_path_to_fpcres_here (i.e: "sudo ln -s /Developer/freepascal/fpc/bin/fpcres"). The operation will query you for the admin password. After that you can check if the symbolic link is working properly by executing "fpcres" command at the Terminal. --------------- If there's no fpcres tool found, please re-install FPC from the official download page http://freepascal.org/down/i386/macosx.var. After reinstallatoni fpc you might need to rebuild Lazarus and LCL as well, using Clean All) ---------------------------------------------------------------------- RxRick · 2010-07-04 16:27 thank you. it finds two instances of fpcres: /usr/local/bin /Developer/freepascal/fpc/utils/fpcres running fpcres -V in both directories yields the same version: 2.5.1 ---------------------------------------------------------------------- skalogryz · 2010-07-04 18:26 so there's fpcres tool installed. if it still cannot be found by the compiler (when compiling lazarus project), try to make the symbolic link at /usr/bin Code: [Select]cd /usr/bin sudo ln -s /Developer/freepascal/fpc/utils/fpcres ---------------------------------------------------------------------- RxRick · 2010-07-05 02:14 okay, thanks again. sudo ln -s /Developer/freepascal/fpc/utils/fpcres didn't alter the issue. it compiles when i start lazarus in terminal from the /Developer/lazarus/lazarus.app/Contents/MacOS: ./lazarus but not when i run from the icon in the dock: Error: Can't call the resource compiler "/usr/bin/fpcres" believe me, i'm happy with starting it from terminal. ---------------------------------------------------------------------- skalogryz · 2010-07-05 04:55 Quote from: RxRick on July 05, 2010, 04:14:07 ambut not when i run from the icon in the dock: Error: Can't call the resource compiler "/usr/bin/fpcres" believe me, i'm happy with starting it from terminal. just remove /usr/bin/fpcres symbol link, to avoid any problems in future. /usr/local/bin is enough. Maybe you can try to re-create Lazarus dock icon? first by removing it, and dragging it again from /Developer/lazarus/ directory. ---------------------------------------------------------------------- RxRick · 2010-07-05 06:44 well, i take my last comment back, because now it won't compile even if i start lazarus from terminal. Can't call the resource compiler "/usr/bin/fpcres", switching to external mode so, the last thing i did killed it, which was this: sudo ln -s /Developer/freepascal/fpc/utils/fpcres so, i tried this: cd usr/bin/fpcres rm fpcres that didn't do anything, it's broken, now it won't compile at all. ---------------------------------------------------------------------- RxRick · 2010-07-05 06:55 find / -iname fpcres results: /Developer/freepascal/fpc/utils/fpcres /Users/rxrick/.Trash/fpc/utils/fpcres /Users/rxrick/.Trash/fpc/utils/fpcres/fpcres /usr/bin/fpcres /usr/local/bin/fpcres ---------------------------------------------------------------------- skalogryz · 2010-07-05 06:59 cd - is "change directory" command. "cd /usr/bin/fpcres" - won't do anything because /usr/bin/fpcres is a file. You can't change a directory to a file, you should use "cd /usr/bin" instead "rm fpcres" from /usr/bin might not work, because you don't have access rights to delete (unlink) the file. you should use "sudo rm fpcres". ---------------------------------------------------------------------- RxRick · 2010-07-05 22:23 thanks again, yes I do understand what cd means (i know you can't assume). i mistyped, my bad. regardless, it's now broken, it won't compile even if i call lazarus from terminal. it was working from terminal, before i did this, per your suggestion.  cd /usr/bin  sudo ln -s /Developer/freepascal/fpc/utils/fpcres to which i received this: ln: ./fpcres: File exists i then restarted lazarus from terminal: ./lazarus (from /Developer/lazarus/lazarus.app/Contents/MacOS) and it does not compile, throwing this error: Can't call the resource compiler "/usr/bin/fpcres", switching to external mode so, i tried to "undo" this last step by removing the fpcres: cd /usr/bin rm fpcres of course, that did not do anything. i understand basic unix commands, what i don't understand is how to configure lazarus so it will compile. i thank you for all your help. i wish i would have left well enough alone, as once again, i am stuck with a broken installation. ---------------------------------------------------------------------- skalogryz · 2010-07-06 06:09 Quote from: RxRick on July 06, 2010, 12:23:58 ami understand basic unix commands, what i don't understand is how to configure lazarus so it will compile. fpcres is compiler's tool, it's called by the compiler, not Lazarus. Your Lazarus installation seems to be configured fine. you can try the following: * Create new program (not Application) project. * go to project options menu, remove "use manifest file..." and clean the icon. * press ok. This should remove {$ *.res} line from the code. (if it doesn't delete it manually). * add writeln('hello world'); line * try to compile the project. It should compile fine, because fpcres tool won't be used. you might also try to change Compiler path: /Developer/freepascal/fpc/compiler/ppc386 to /Developer/freepascal/fpc/compiler/fpc (there should be fpc binary somethere) btw, you've said that fpcres tool is 2.5.1 version. What's the compiler's version? fpc -iV ---------------------------------------------------------------------- RxRick · 2010-07-06 22:22 i guess we should call it fp/lazarus (like gnu/linux)? i may understand simple, basic unix commands, but i do not grok the file structure of unix. nor the purpose of all the various directories, e.g. /usr/local/... etc. nor how to tell if something listed with ls is a binary or a directory, since there are no file extensions for binary files. i feel blind as a bat, stumbling around in terminal. unfortunately I've used DOS for 25 years, ls -F helps somewhat. as you mentioned earlier in this thread, i likely have multiple versions of fp/lazarus "installed", because I originally downloaded the dmg's, but could never get anything to work, and had no idea where the fp/lazarus files were installed, in order to remove the failed install. fpc version is 2.4.0. if i change compiler path to /Developer/freepascal/fpc/compiler/fpc i get error dialog: Invalid compiler filename The compiler file "/Developer/freepascal/fpc/compiler/fpc" is not an executable. created a new project, here is the code program Project1; {$mode objfpc}{$H+} uses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes   { you can add units after this }; begin    writeln('hello word'); end. would not compile, here are the errors: ld: can't open out file for writing: /Users/rxrick/Documents/lithium, errno=21 An error occurred while linking project1.lpr(13,4) Error: Error while linking project1.lpr(13,4) Fatal: There were 1 errors compiling module, stopping if i change compiler path to /usr/local/bin/ppc386 then attempt build: Error: Error while linking ---------------------------------------------------------------------- skalogryz · 2010-07-07 07:29 1. please download the compiler from here: http://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/2.4.0/fp c-2.4.0.intel-macosx.dmg/download 2. Download and install the .dmg file. This will install the new compiler, and would probably override all current fpc settings. 3. The next thing is you need fpc sources. cd to /Developer/freepascal directory. Run the command there: Code: [Select]svn co http://svn.freepascal.org/svn/fpc/tags/release_2_4_0/ fpc240src this is lengthy process, so please, be patient. 4. When the installation complete. Open Lazarus. Go to environment settings and change, * compiler path to: /usr/local/bin/fpc * complier sources path to: /Developer/freepascal/fpc240src/ 5. Select. Tools->Configure "Build Lazarus"... ->Quick Build options. select Clean Up + Build All. and press build. This should rebuild the Lazarus with all components, using your newly configure compiler. After this you should be able to compile projects without any errors. ---------------------------------------------------------------------- skalogryz · 2010-07-07 07:42 Quote from: RxRick on July 07, 2010, 12:22:44 amwould not compile, here are the errors: ld: can't open out file for writing: /Users/rxrick/Documents/lithium, errno=21 An error occurred while linking project1.lpr(13,4) Error: Error while linking project1.lpr(13,4) Fatal: There were 1 errors compiling module, stopping errno=21 means, that you probably have a directory named "lithium" or "Lithium" at /Users/rxrick/Documents/ directory. ---------------------------------------------------------------------- RxRick · 2010-07-10 00:44 thanks again for all your help. i had to step away for a couple of days, to let the frustration level settle. yes, it worked, thanks so much. i did have a problem with a component that i had downloaded, thtmlport, said it couldn't find the source, i put it here: /Developer/lazarus/components/thtmlport where is the correct place to put code for a new lcl component so lazarus can find it? ---------------------------------------------------------------------- skalogryz · 2010-07-13 07:02 Do you have thtmlport package installed in Lazarus? If yes, you need to add the dependency on the package. Project -> Project Inspector -> "Required Packages" ---------------------------------------------------------------------- RxRick · 2010-07-13 16:22 it's working now, thanks again for all your help. ---------------------------------------------------------------------- laguna · 2017-08-06 11:17 Mac OSX Vers. 10.12.4 Lazarus 1.9.0 FPC 3.0.2 Path Lazarus /Developer/Lazarus  etc /Developer/fpc       etc Solved with: cd /usr/bin sudo ln -s /Developer/fpc/utils/fpcres/bin/i386-darwin/fpcres