View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0037324||Lazarus||IDE||public||2020-07-10 08:57||2020-08-03 02:57|
|Reporter||Trevor Roydhouse||Assigned To||Martin Friebe|
|Platform||2018 Apple mac mini||OS||macOS|
|Summary||0037324: Cannot run application without debugging / FileExistsUtf8|
|Description||Running without debugging also fails with the dialog attached.|
Note that the application (just the default Form1 with not additions) has been compiled and the executable does exist and can be run from the command line without debugging "open ./project1.app" or with debugging as "lldb ./project1.app".
|Steps To Reproduce||Install FPC 3.2.0 source; edit the FPC source in packages/cocoaint/src/CocoaAll.pas and comment out or remove the CoreImage linking line which does not exist pre-macOS 10.11. Recompile with FPC 3.0.4.|
Install Lazarus 2.0.10 source from svn tag. Compile.
Launch Lazarus, compile the default project form "as is". Try ro run with/without debug.
|Additional Information||See also related bug (unable to run without debugging) reported for Lazarus trunk https://bugs.freepascal.org/view.php?id=36780|
|Tags||cocoa, IDE, MacOS|
|Fixed in Revision|
Debug info when running without debugging:
trev@dynamic12 [/Users/trev/lazarus_2_0_10] $ lazarus.app/Contents/MacOS/lazarus --args "--pcp=~/.laz_210"
SetPrimaryConfigPath NewValue="~/.laz_210" -> "/Users/trev/.laz_210"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/Users/trev/.laz_210"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus"
Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=x86_64-darwin-cocoa New=x86_64-darwin-cocoa Changed: OS/CPU=True LCL=False
TCocoaWidgetSet.GetSystemMetrics TODO 32
TCocoaWidgetSet.GetSystemMetrics TODO 33
TCocoaWidgetSet.GetSystemMetrics TODO 4
Hint: (lazarus) [TMainIDE.DoRunProjectWithoutDebug] START
Hint: (lazarus) Project needs building: SrcFile outdated Project
[TCompiler.Compile] CmdLine="/usr/local/bin/fpc -B -MObjFPC -Scghi -O1 -gw -gl -k-framework -kCocoa -l -vewnhibq -Fi/Users/trev/tmp/lib/x86_64-darwin -Fu/Users/trev/lazarus_2_0_10/lcl/units/x86_64-darwin/cocoa -Fu/Users/trev/lazarus_2_0_10/lcl/units/x86_64-darwin -Fu/Users/trev/lazarus_2_0_10/components/lazutils/lib/x86_64-darwin -Fu/Users/trev/lazarus_2_0_10/packager/units/x86_64-darwin -FU/Users/trev/tmp/lib/x86_64-darwin/ -FE/Users/trev/tmp/ -o/Users/trev/tmp/project1 -dLCL -dLCLcocoa /Users/trev/tmp/project1.lpr"
Info: (lazarus) Execute Title="Compile Project, Target: /Users/trev/tmp/project1"
Info: (lazarus) Working Directory="/Users/trev/tmp/"
Info: (lazarus) Executable="/usr/local/bin/fpc"
Info: (lazarus) Param="-B"
Info: (lazarus) Param="-MObjFPC"
Info: (lazarus) Param="-Scghi"
Info: (lazarus) Param="-O1"
Info: (lazarus) Param="-gw"
Info: (lazarus) Param="-gl"
Info: (lazarus) Param="-k-framework"
Info: (lazarus) Param="-kCocoa"
Info: (lazarus) Param="-l"
Info: (lazarus) Param="-vewnhibq"
Info: (lazarus) Param="-Fi/Users/trev/tmp/lib/x86_64-darwin"
Info: (lazarus) Param="-Fu/Users/trev/lazarus_2_0_10/lcl/units/x86_64-darwin/cocoa"
Info: (lazarus) Param="-Fu/Users/trev/lazarus_2_0_10/lcl/units/x86_64-darwin"
Info: (lazarus) Param="-Fu/Users/trev/lazarus_2_0_10/components/lazutils/lib/x86_64-darwin"
Info: (lazarus) Param="-Fu/Users/trev/lazarus_2_0_10/packager/units/x86_64-darwin"
Info: (lazarus) Param="-FU/Users/trev/tmp/lib/x86_64-darwin/"
Info: (lazarus) Param="-FE/Users/trev/tmp/"
Info: (lazarus) Param="-o/Users/trev/tmp/project1"
Info: (lazarus) Param="-dLCL"
Info: (lazarus) Param="-dLCLcocoa"
Info: (lazarus) Param="/Users/trev/tmp/project1.lpr"
Hint: (lazarus) [TMainIDE.DoBuildProject] compiler time in s: 1.14300011191517
Info: (lazarus) [TMainIDE.DoBuildProject] Success
Hint: (lazarus) [TMainIDE.DoRunProjectWithoutDebug] ExeCmdLine=""/Users/trev/tmp/project1.app""
I can now confirm that in Lazarus IDE v2.0.10 (64 bit Cocoa) using FPC 3.2.0, the option "Run without debugging" fails on these macOS versions:
* macOS 10.9.5
* macOS 10.10.5
* macOS 10.11.6 -- Note 1: Lazarus 2.0.8 (32 bit Carbon, compiled with FPC 3.0.4) but using FPC 3.2.0 to compile applications WORKS.
-- Note 2: Lazarus 2.0.10 (32 bit Carbon compiled with FPC 3.2.0) using FPC 3.2.0 to compile applications FAILS.
-- Note 3: Lazarus 2.0.10 (64 bit Cocoa compiled with FPC 3.0.4) using FPC 3.0.4 to compile applications WORKS.
-- Note 4: Lazarus 2.0.10 (64 bit Cocoa compiled with FPC 3.0.4) using FPC 3.2.0 to compile applications WORKS.
* macOS 10.12.6
* macOS 10.13.6
* macOS 10.14.6 -- Note 1: Lazarus 2.0.6 (64 bit Cocoa compiled with FPC 3.0.4) using FPC 3.2.0 to compile applications WORKS.
-- Note 2: Lazarus 2.0.10 (64 bit Cocoa compiled with FPC 3.2.0) using FPC 3.2.0 to compile applications FAILS.
* macOS 10.15.5
* macOS 11.0 Beta
Conclusion: Not being able to "run without debugging" was caused by the change of compiler for Lazarus from FPC 3.0.4 to FPC 3.2.0.
I'm happy to do more tests if needed. I have VMs of all macOS versions from 10.8 through 11.0 now.
* macOS 11.0 Beta -- Note 1: Lazarus 2.0.8 (64 bit Cocoa compiled with FPC 3.0.4) using FPC 3.2.0 to compile applications WORKS.
-- Note 2: Lazarus 2.0.8 (64 bit Cocoa compiled with FPC 3.2.0) using FPC 3.2.0 to compile applications FAILS.
For the run "without debugging": Are you sure an app bundle was created?
there should be an app bundle, and either (I cant remember which way round)
- the app inside the bundle is a sym link to /Users/trev/tmp/project1.lpr
- the /Users/trev/tmp/project1.lpr is a sym link into the bundle
For debugging: Is lldb running ? (ps ax)
IIRC it might ask for the root password (pop up dialog)
.Your log does not show any data being sent to the debugger. Though that might need some enable-debug....
Start with https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session
/path/to/lazarus/lazarus.app/Contents/MacOS/lazarus --debug-log=/path/to/yourfiles/laz.log --debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,FPDBG_DWARF_ERRORS,FPDBG_DWARF_WARNINGS,FPDBG_DWARF_VERBOSE_LOAD,FPDBG_DWARF_DATA_WARNINGS,DBG_VERBOSE,DBG_WARNINGS,DBG_STATE,DBG_EVENTS,DBG_THREAD_AND_FRAME,DBG_ERRORS
||If it is only 3.2.0 then maybe TProcess has changed. (At least afaik the debugger code uses TProcess to launch lldb). Not suer what the IDE uses to start the project without debugger.|
Q: For the run "without debugging": Are you sure an app bundle was created?
Yes, the app bundle was created. On the command line "open project1.app" works as expected.
Q: For debugging: Is lldb running ? (ps ax)
Yes. But it does not show any command line arguments (which the process table does show if I start it on the command line with "lldb project1.app").
Note: This only happens with Mountain Lion - I've tested Mavericks, Yosemite, El Capitan, Sierra, High Sierra, Mojave, Catalina and Big Sur Beta and they work (with "run", not with "run without debugging").
Q: Your log does not show any data being sent to the debugger ...
I'll make time to do this later today for you.
Q: If it is only 3.2.0 then maybe TProcess has changed.
It would appear to be confined to FPC 3.2.0. Lazarus compiled with FPC 3.0.4 does not have the issue.
I should qualify this statement: "It would appear to be confined to FPC 3.2.0. Lazarus compiled with FPC 3.0.4 does not have the issue."
I have only tested this result on El Capitan and it is probably more related to the "run without debugging" issue than the run issue on Mountain Lion. I'll also compile an FPC 3.0.4 Lazarus version on Mountain Lion later today and let you know the results.
||Forgot to add: Lazarus 2.0.8 Carbon; compiled with FPC 3.04.|
Ok, it gets complicated to sort what relates to with/without debug.
I don't have much of an idea for the "without" issue. Maybe https://wiki.lazarus.freepascal.org/User_Changes_3.2.0#Process_Unit
Q: Is that also only 3.2.0? Or do I understand correct the log is with 3.0.4
The debug log I provided was with Lazarus compiled with FPC 3.0.4 and using the FPC 3.0.4 for compiling applications.
To try and clear up any confusion:
* Mountain Lion (10.8) is the only version which cannot run "with debug" and "without debug" using Lazarus compiled by FPC 3.0.4.
* All versions of macOS (10.8-11.0 Beta) cannot run "without debug" using Lazarus compiled with FPC 3.2.0 (whether using FPC 3.0.4 or 3.2.0 to compile applications). I have a workaround for that - the cause appears to be FileExistsUTF8() in Lazarus main.pp - by commenting out those two lines as below, it works again:
< if RunAppBundle
< and FileExistsUTF8(Process.Executable)
< and FileExistsUTF8('/usr/bin/open') then
> if RunAppBundle then
> // and FileExistsUTF8(Process.Executable)
> //and FileExistsUTF8('/usr/bin/open') then
I believe I tried commenting out just one or the other, but both needed to be commented out.
Getting back to run "with debug". Today I spent a whole heap of time trying to run with debug on Mountain Lion, and lo and behold, it popped up the "authorization required" dialog for the first time ever. Now, I can intermittently "run with debug". After it works once, and the default trivial form application exits, I need to reset the debugger, and then it won't "run with debug" on the next or subsequent attempts. It is more likely to run the first time if starting Lazarus afresh, but not always.
If you can suggest any debugging I can do, I will happily. It may also be worth considering whether it is sensible spending much time on an OS version for which support ended in December 2015. I'm sure you have more useful things on which to spend your time.
NOTE: This issue originally comprised problems WITH and WITHOUT debugging.
The issue was split (at the point of this note): I made a copy of this report for the "with debug" issue.
Edited each issue accordingly (I.e. removed some notes, that are needed only on either this or the other copy of the issue)
New issue 0037344
With the workaround in Lazarus main.pp (this has been solved in trunk):
> if RunAppBundle then
> // and FileExistsUTF8(Process.Executable)
> //and FileExistsUTF8('/usr/bin/open') then
trying to "run without debugging" silently failed on a DEFAULT project (contained in ~/tmp) which contains no additions to what Lazarus normally provides when starting without a project. However, if I open an existing project which contains just the form and one button, it works and the application runs. Deleting the contents of ~/tmp and now the default project also works.
Before doing this, I used "Clean up and build" (both the project and Lazarus) and it did not help. (The ~/tmp directory had been only ever previously been used by Lazarus 2.0.8 and FPC 3.0.4 for a default project test.)
Anyway, I think the result is that this bug should now be closed. (I cannot close it.)
[Note this only applied to Mountain Lion macOS 10.8.5 - seems to have been lost in the split of the original bug report.]
|2020-07-10 08:57||Trevor Roydhouse||New Issue|
|2020-07-10 08:57||Trevor Roydhouse||File Added: Screen Shot 2020-07-10 at 4.47.54 pm.png|
|2020-07-10 08:59||Trevor Roydhouse||Tag Attached: MacOS|
|2020-07-10 08:59||Trevor Roydhouse||Tag Attached: cocoa|
|2020-07-10 08:59||Trevor Roydhouse||Tag Attached: IDE|
|2020-07-10 09:21||Trevor Roydhouse||Note Added: 0123864|
|2020-07-10 20:41||Dmitry Boyarintsev||Relationship added||related to 0036780|
|2020-07-11 09:33||Trevor Roydhouse||Note Added: 0123875|
|2020-07-11 09:44||Trevor Roydhouse||Note Added: 0123876|
|2020-07-12 03:06||Martin Friebe||Note Added: 0123899|
|2020-07-12 03:12||Martin Friebe||Note Added: 0123900|
|2020-07-12 03:53||Trevor Roydhouse||Note Added: 0123901|
|2020-07-12 03:59||Trevor Roydhouse||Note Added: 0123902|
|2020-07-12 07:38||Trevor Roydhouse||Note Added: 0123906|
|2020-07-12 14:04||Martin Friebe||Note Added: 0123924|
|2020-07-13 10:00||Trevor Roydhouse||Note Added: 0123956|
|2020-07-13 13:50||Martin Friebe||Issue cloned: 0037344|
|2020-07-13 13:53||Martin Friebe||Summary||Cannot run application with/without debugging => Cannot run application without debugging / FileExistsUtf8|
|2020-07-13 13:53||Martin Friebe||Description Updated||View Revisions|
|2020-07-13 13:53||Martin Friebe||LazTarget||=> -|
|2020-07-13 13:53||Martin Friebe||Widgetset||Cocoa => Cocoa|
|2020-07-13 13:53||Martin Friebe||Note Added: 0123978|
|2020-07-13 13:55||Martin Friebe||Note Edited: 0123924||View Revisions|
|2020-07-13 14:03||Martin Friebe||Note Edited: 0123978||View Revisions|
|2020-07-27 04:23||Trevor Roydhouse||Note Added: 0124354|
|2020-07-27 11:32||Martin Friebe||Assigned To||=> Martin Friebe|
|2020-07-27 11:32||Martin Friebe||Status||new => resolved|
|2020-07-27 11:32||Martin Friebe||Resolution||open => fixed|
|2020-07-27 11:32||Martin Friebe||Widgetset||Cocoa => Cocoa|
|2020-08-03 02:57||Trevor Roydhouse||Status||resolved => closed|
|2020-08-03 02:57||Trevor Roydhouse||Note Added: 0124522|