Recent

Author Topic: Lazarus & Debugger oops etc  (Read 75054 times)

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #15 on: October 08, 2009, 05:27:04 pm »
In Run - Run parameters, uncheck: Use launching application
It was already that way.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: Lazarus & Debugger oops etc
« Reply #16 on: October 09, 2009, 11:01:16 am »
aahh... osx
there is an error in TPRocess, where it wants a xterm exe. IIRC it isn't used, but it must exist.

Maybe you can try to create a symlink to the terminal (inside Terminal.app)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 670
Re: Lazarus & Debugger oops etc
« Reply #17 on: October 09, 2009, 03:20:13 pm »
aahh... osx
there is an error in TPRocess, where it wants a xterm exe. IIRC it isn't used, but it must exist.
xterm appears to be only used if poNewConsole is used. In other cases it is not checked nor used. There don't appear to be any checks as to its existence.

Quote
Maybe you can try to create a symlink to the terminal (inside Terminal.app)

That definitely won't work, since Terminal doesn't accept any form of command line options. You can use osascript to tell Terminal to execute a particular command and this will create a new window, but this does not create a new instance of Terminal.

It will just create a new window in the context of the Terminal application if it was already running, and if not it will start Terminal and create the new window. Next, the command will be executed in this new window, but Terminal will not quit once that's finished nor will the window close (so waiting for the "end of the executed process" will fail -- in fact, this will wait for the end of the osascript program, which will be almost instantaneous since it just fires off an apple event to Terminal and then quits).

The logic of TProcess with poNewConsole is hardwired to the Unix/Windows notion that every time you create a new window this automatically creates a new process, which is incorrect in case of Mac OS X (unless you use a traditional Unix utility such as xterm).

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: Lazarus & Debugger oops etc
« Reply #18 on: October 09, 2009, 04:56:23 pm »
hmm... the debugger doesn't use a console, so I winder where this xterm is coming from
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Lazarus & Debugger oops etc
« Reply #19 on: October 09, 2009, 05:06:11 pm »
TProcess.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2283
    • havefunsoft.com
Re: Lazarus & Debugger oops etc
« Reply #20 on: October 10, 2009, 08:20:19 pm »
xterm is installed with X11.
X11 is available (in Optional Installations) with each Mac OS X version starting from 10.4

After x11 installed, symbolic link can be created at /usr/local/bin.
open Terminal
Code: [Select]
sudo ln -s /usr/X11/bin/xterm /usr/local/bin/xterm

P.S: xterm is also installed with Fink.

The logic of TProcess with poNewConsole is hardwired to the Unix/Windows notion that every time you create a new window this automatically creates a new process, which is incorrect in case of Mac OS X (unless you use a traditional Unix utility such as xterm).

can TProcess be patched in the following way? (patch file is also attached to this message :) )
Yes, it's less control over size of the window, but still should work fine, on any darwin, since 'open' is darwin/nextstep tool.

Code: [Select]
Index: src/unix/process.inc
===================================================================
--- src/unix/process.inc (revision 13818)
+++ src/unix/process.inc (working copy)
@@ -160,6 +160,9 @@
     CommandToList(Cmd,S);
     if poNewConsole in P.Options then
       begin
+      {$ifdef darwin}
+      S.Insert(0,'open');
+      {$else}
       S.Insert(0,'-e');
       If (P.ApplicationName<>'') then
         begin
@@ -172,6 +175,7 @@
         S.Insert(0,'-geometry');
         end;
       S.Insert(0,'xterm');
+      {$endif}
       end;
     if (P.ApplicationName<>'') then
       begin

hmm, may be additional command-line should be: 'open -n -a Terminal', instead of a just 'open'?
« Last Edit: October 10, 2009, 08:25:13 pm by skalogryyz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #21 on: October 10, 2009, 10:31:38 pm »
...
Code: [Select]
sudo ln -s /usr/X11/bin/xterm /usr/local/bin/xterm
..
with that Lazarus still reports that xterm is missing

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2283
    • havefunsoft.com
Re: Lazarus & Debugger oops etc
« Reply #22 on: October 10, 2009, 10:58:25 pm »
launching osx apps in Lazarus, is quite messy :(

ok. Here's a workaround (you should use it for console applications only).

open "Run"->"Run parameters...", set your run parameters as shown on the screen shot.
check "Use launching application:" type "/usr/bin/open $(TargetCmdLine)"
You're free to modify "Host application" or "Command line parameters" as you need.

Then (it's a trick) open "Project"->"Compiler options". Open "Linking".
check "Win32 gui application (-WG)".
This would prevent Lazarus from using "xterm" then launching compiled project.

Let me know about your results.

Thanks.
« Last Edit: October 10, 2009, 11:00:30 pm by skalogryyz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #23 on: October 10, 2009, 11:07:03 pm »
Thanks, but my app is not a console app.

Unless you want me to test this for you?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2283
    • havefunsoft.com
Re: Lazarus & Debugger oops etc
« Reply #24 on: October 10, 2009, 11:10:25 pm »
Unless you want me to test this for you?
then you don't need to modify Run Parameters.

Just check "Win32 GUI application" in Compiler Options.
This should be enough.

does it work for you?
« Last Edit: October 10, 2009, 11:23:21 pm by skalogryyz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #25 on: October 11, 2009, 01:14:47 am »
Yes, thanks much.

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #26 on: November 10, 2009, 03:34:30 pm »
I've got the same problem after installing OSX 10.6.1.  Everytime I run the debugger fails.

0.9.27
I was hoping OSX 10.6.2 would fix this but it doesn't.  :(

zeebee

  • Newbie
  • Posts: 1
Re: Lazarus & Debugger oops etc
« Reply #27 on: November 18, 2009, 09:03:44 am »
Same problem here exactly.

Programs compile fine if debugger turned off but error message oops comes up if turned on.

OS X 10.6.2

Running Ver 0.9.28.2 beta
2009-10-26
FPC 2.2.4
SVN 22296
I386-darwin-carbon (beta)

mbohn

  • Full Member
  • ***
  • Posts: 120
Re: Lazarus & Debugger oops etc
« Reply #28 on: November 18, 2009, 02:27:38 pm »
Same problem here exactly.

Programs compile fine if debugger turned off but error message oops comes up if turned on.

OS X 10.6.2

Running Ver 0.9.28.2 beta
2009-10-26
FPC 2.2.4
SVN 22296
I386-darwin-carbon (beta)
I think we're not the only ones who were hoping that Lazarus would be the path forward for Delphi development on the Mac, but alas, it is not.  I'm sure the debugger will get fixed but I don't have a clue even if someone capable (not me!) is working on it, so I have less of an idea of when the fix may happen.

Meanwhile, I've moved my work back to Delphi on my XP box.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: Lazarus & Debugger oops etc
« Reply #29 on: November 18, 2009, 03:10:00 pm »
There is noone working on it, but it's assigned to me. Unfortunately I've only a ppc based 10.4 ini
Anyway, the bugreport has a usefull patch so i'll have a look at it.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker