Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-10

Help: OS X Problems

32 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anthony Walter

Could someone look at screenshots of two problems I'm having on a new OS X system? I'm trying to configure it for trunk fpc and near trunk lazarus development.

What's going on
----------------------

I installed Xcode with command line tools and used macports to install gdb.

I installed fpc 2.6.2 for OS X from source forge and used it to build fpc trunk without any problems.

I compiled lazarus trunk with fpc 2.7.1 trunk without any problems

I had some issues with lazarus trunk when running it where it would freeze when the editor window comes up due to some TCarbonTab SetFocus exception. Apparently others have had this problem as well.

I then checked out an earlier lazarus revision of 42619 which was from September 5. I was able to compile and run it without much fuss.

Now I have the following problems ...

Problem 1
--------------

http://cache.codebot.org/development/lazarus-event-error.png

When I try to add an event to a component using the designer I receive the above error. It looks like a problem with code tools and the fpc sources on generic specialization of enumerable. The program does compile though. I just can't add events in the designer windows.

Problem 2
--------------

http://cache.codebot.org/development/lazarus-run-error.png

When I try to run a program (either in debug mode or release mode which has no debugging on) I get that message from OS X. It seems to build fine. I mentioned above the debugger was gotten from macports and is named ggdb on disk rather than gdb and is at version 7.6, if that's important.

It is located on my system at

/opt/local/bin/ggdb

I'd very much appreciate it if anyone could help me setup correctly working near trunk versions of fpc and lazarus on OS X.

Thank you in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131029/63c1efb1/attachment-0001.html>

Reply by email

Anthony Walter
to Anthony Walter

I'd also like to add another note.

When I attempt to run the example program which I've named 'hello' from finder (or from a terminal), a console window is displayed along with my simple form. The console has the text...

macuser at macpc~/Development/projects/test/hello$ ./hello TCarbonButton.SetFocus Error: SetKeyboardFocus failed with result -30585

...in it and the main window for 'hello' displays but is completely disabled.

Anthony Walter wrote 55 lines
Could someone look at screenshots of two problems I'm having on a new OS X system? I'm trying to configure it for trunk fpc and near trunk lazarus development. What's going on ---------------------- I installed Xcode with command line tools and used macports to install gdb. I installed fpc 2.6.2 for OS X from source forge and used it to build fpc trunk without any problems. I compiled lazarus trunk with fpc 2.7.1 trunk without any problems I had some issues with lazarus trunk when running it where it would freeze when the editor window comes up due to some TCarbonTab SetFocus exception. Apparently others have had this problem as well. I then checked out an earlier lazarus revision of 42619 which was from September 5. I was able to compile and run it without much fuss. Now I have the following problems ... Problem 1 -------------- http://cache.codebot.org/development/lazarus-event-error.png When I try to add an event to a component using the designer I receive the above error. It looks like a problem with code tools and the fpc sources on generic specialization of enumerable. The program does compile though. I just can't add events in the designer windows. Problem 2 -------------- http://cache.codebot.org/development/lazarus-run-error.png When I try to run a program (either in debug mode or release mode which has no debugging on) I get that message from OS X. It seems to build fine. I mentioned above the debugger was gotten from macports and is named ggdb on disk rather than gdb and is at version 7.6, if that's important. It is located on my system at /opt/local/bin/ggdb I'd very much appreciate it if anyone could help me setup correctly working near trunk versions of fpc and lazarus on OS X. Thank you in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131029/c298984d/attachment.html>

Reply by email

Anthony Walter
to Anthony Walter

Okay I figured out a few things. Maybe this will be helpful for other people.

1) The only controls which can receive keyboard focus on OS X carbon are text entry controls. If a form is designed with a button or other non text entry control with a tab order of 0, of if active control is set to a non text entry control, the application will throw an exception possibly causing the application to stop or hang.

The current trunk of lazarus sets the focus to a tab control when the IDE is opened causing it to halt at some point while opening. This needs fixing in lazarus trunk.

2) Recent lazarus revisions code tools fail when reading a line in classes dealing with generics specialization. Changing the declaration by removing the keyword specialize seems to have fixed the problem. My solution needs more testing. When fixed, event handlers can be added at design time.

3) It seems (at least on Mavericks) that the gdb from macports foes not work with lazarus. It might need to be configured some place in lazarus in more depth, but at this point I have no clue where to start. Setting the debugger to 'none' allows programs to be run from the IDE, although it won't debug without the debugger (obviously). I would still appreciate help with this issue.

Also of note, when running programs from the IDE, your program will appear behind your design time form making it look like nothing is running. Setting the option to hide the IDE while running doesn't help because it only hides the IDE and not the form designer.

4) Launching a lazarus created program from the command line will cause it to hang. Instead you need to type 'open -a your program'.

Anthony Walter wrote 72 lines
I'd also like to add another note. When I attempt to run the example program which I've named 'hello' from finder (or from a terminal), a console window is displayed along with my simple form. The console has the text... macuser at macpc~/Development/projects/test/hello$ ./hello TCarbonButton.SetFocus Error: SetKeyboardFocus failed with result -30585 ...in it and the main window for 'hello' displays but is completely disabled. On Tue, Oct 29, 2013 at 9:56 PM, Anthony Walter wrote: > Could someone look at screenshots of two problems I'm having on a new OS > X system? I'm trying to configure it for trunk fpc and near trunk lazarus > development. > > What's going on > ---------------------- > > I installed Xcode with command line tools and used macports to install > gdb. > > I installed fpc 2.6.2 for OS X from source forge and used it to build fpc > trunk without any problems. > > I compiled lazarus trunk with fpc 2.7.1 trunk without any problems > > I had some issues with lazarus trunk when running it where it would > freeze when the editor window comes up due to some TCarbonTab SetFocus > exception. Apparently others have had this problem as well. > > I then checked out an earlier lazarus revision of 42619 which was from > September 5. I was able to compile and run it without much fuss. > > Now I have the following problems ... > > Problem 1 > -------------- > > http://cache.codebot.org/development/lazarus-event-error.png > > When I try to add an event to a component using the designer I receive > the above error. It looks like a problem with code tools and the fpc > sources on generic specialization of enumerable. The program does compile > though. I just can't add events in the designer windows. > > Problem 2 > -------------- > > http://cache.codebot.org/development/lazarus-run-error.png > > When I try to run a program (either in debug mode or release mode which > has no debugging on) I get that message from OS X. It seems to build fine. > I mentioned above the debugger was gotten from macports and is named ggdb > on disk rather than gdb and is at version 7.6, if that's important. > > It is located on my system at > > /opt/local/bin/ggdb > > > I'd very much appreciate it if anyone could help me setup correctly > working near trunk versions of fpc and lazarus on OS X. > > > Thank you in advance. > >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131029/a7c4485c/attachment.html>

Reply by email

Martin
to Anthony Walter: Could someone look at screenshots of two problems I'm having on a new OS X system? I'm…
Anthony Walter wrote 21 lines
Problem 2 -------------- http://cache.codebot.org/development/lazarus-run-error.png When I try to run a program (either in debug mode or release mode which has no debugging on) I get that message from OS X. It seems to build fine. I mentioned above the debugger was gotten from macports and is named ggdb on disk rather than gdb and is at version 7.6, if that's important. It is located on my system at /opt/local/bin/ggdb I'd very much appreciate it if anyone could help me setup correctly working near trunk versions of fpc and lazarus on OS X.

http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Xcode_5

read the link to the forum

You need:

Show quoted text 8 lines
the IDE passes the app bundle. But gdb expects the actual exe inside the app bundle. /Users/admin/Documents/project1.app 1) If you can do without, uncheck "generate app bundle" in the project settings. 2) Menu > Run > Run Param > Edit: "Host Application" /Users/admin/Documents/project1.app/Content/MacOS/project1

and

But also, try this: In the Menu > Tools > Options > Debugger There is a grid with options. It has: | EncodeCurrentDirPath = gdfeDefault|

|and same for setting ExeEncoding

All those are automated in |revision 43255 and later

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/ca45584f/attachment.html>

Reply by email

Martin
to Martin
Martin wrote 23 lines
On 30/10/2013 01:56, Anthony Walter wrote: > Problem 2 > -------------- > > http://cache.codebot.org/development/lazarus-run-error.png > > When I try to run a program (either in debug mode or release mode > which has no debugging on) I get that message from OS X. It seems to > build fine. I mentioned above the debugger was gotten from macports > and is named ggdb on disk rather than gdb and is at version 7.6, if > that's important. > > It is located on my system at > > /opt/local/bin/ggdb > > > I'd very much appreciate it if anyone could help me setup correctly > working near trunk versions of fpc and lazarus on OS X. > > >

And probably need to set debug type info to dwarf (but you have to try what works for you (project options > debugger)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/8f75ad5c/attachment.html>

Reply by email

Anthony Walter
to Martin

Earlier (after my initial post) I had found and read the same links you posted. It feels god knowing I am on the right track, so thanks, thigh I am still having problems.

Where I'm At
-----------------

The lazarus revision 43255 you posted locks up at start due to the focus I mentioned previously.

I deleted my lazarus folder, checked out revision 42619 again, built and run and the IDE opens correctly again. I am using ggdb from macports as mentioned earlier.

In a new project called 'hello' I set the run host application to /Users/MyUser/Development/Projects/hello.app/Contents/MacOS/hello

When I run I get a window titled 'Debugger Error' with the text 'Debugger error. Ooops, the debuggers entered the error state. Save your work now!'

I tried setting project option | debugging | type of debugging to 'automatic', 'dwarf with sets', and 'dwarf2'. I get the same debugger message with each.

I tried turning 'use app bundle for running and debugging' in the project options on and off. I get the same debugger message.

In IDE debugger options I tried changing EncodeCurrentDirPath from gdfeDefault to gdfeNone.I get the same debugger message.

When I go to project options and create build modes linking takes 2 minutes to complete. In the end I still get the same debugger message.

Switching back to my default build mode, when I turn on the project debugging option 'use external debug symbols file (-Xg)' linking takes 2 minutes to complete each time I hit run. I still get the same debugger message.

Martin wrote 35 lines
On 30/10/2013 09:28, Martin wrote: On 30/10/2013 01:56, Anthony Walter wrote: Problem 2 -------------- http://cache.codebot.org/development/lazarus-run-error.png When I try to run a program (either in debug mode or release mode which has no debugging on) I get that message from OS X. It seems to build fine. I mentioned above the debugger was gotten from macports and is named ggdb on disk rather than gdb and is at version 7.6, if that's important. It is located on my system at /opt/local/bin/ggdb I'd very much appreciate it if anyone could help me setup correctly working near trunk versions of fpc and lazarus on OS X. And probably need to set debug type info to dwarf (but you have to try what works for you (project options > debugger) -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/72ce7790/attachment-0001.html>

Reply by email

Martin
to Anthony Walter
Anthony Walter wrote 40 lines
Earlier (after my initial post) I had found and read the same links you posted. It feels god knowing I am on the right track, so thanks, thigh I am still having problems. Where I'm At ----------------- The lazarus revision 43255 you posted locks up at start due to the focus I mentioned previously. I deleted my lazarus folder, checked out revision 42619 again, built and run and the IDE opens correctly again. I am using ggdb from macports as mentioned earlier. In a new project called 'hello' I set the run host application to /Users/MyUser/Development/Projects/hello.app/Contents/MacOS/hello When I run I get a window titled 'Debugger Error' with the text 'Debugger error. Ooops, the debuggers entered the error state. Save your work now!' I tried setting project option | debugging | type of debugging to 'automatic', 'dwarf with sets', and 'dwarf2'. I get the same debugger message with each. I tried turning 'use app bundle for running and debugging' in the project options on and off. I get the same debugger message. In IDE debugger options I tried changing EncodeCurrentDirPath from gdfeDefault to gdfeNone.I get the same debugger message. When I go to project options and create build modes linking takes 2 minutes to complete. In the end I still get the same debugger message. Switching back to my default build mode, when I turn on the project debugging option 'use external debug symbols file (-Xg)' linking takes 2 minutes to complete each time I hit run. I still get the same debugger message.

Did you try the path in "run param" (to the exe inside the app bundle)?

Unless you upgrade (wich I understand you currently can not) you need AT LEAST all of the following 3
1) path in "run param" to the exe inside the app bundle
2) ExeEncoding
3) |EncodeCurrentDirPath |

***** CORRECTION ***

In my previous post:

| EncodeCurrentDirPath = gdfeDefault|

Which is the setting it already has.
It must be changed to |gdfeNone for BOTH

|
-----------------------
If nothing helps, please provide a log:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

That will allow me to see where exactly the debugger fails.

If the log is bigger, you may send it directly to my mail, bypassing the list.

---
About the none debugger issues (focus...), I have no idea. Someone else will need to comment on them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/00ec7504/attachment.html>

Reply by email

Anthony Walter
to Anthony Walter: Earlier (after my initial post) I had found and read the same links you posted. It feels…

When I click the more button in the debugger error message box I see this:

The GDB command:

"-environment-cd
"\"/Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/\"""

returned the error:

",msg="\"/Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/\": No such file or directory.""

My host application is set to:

/Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/hello

In a terminal I can change to the folder and list files:

macuser at macpc~/Development/Projects/hello/hello.app/Contents/MacOS$ ls

hello
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/786cbc4d/attachment.html>

Reply by email

Anthony Walter
to Martin: Did you try the path in "run param" (to the exe inside the app bundle)? Unless you…

Okay, I set both path and exe encoding to none and am now getting a different informational message when I click the more button:

The GDB command:

"-exec-run"

returned the error:

",msg="Unable to find Mach task port for process-id 6363: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))"" -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/817849f5/attachment.html>

Reply by email

Martin
to Anthony Walter: When I click the more button in the debugger error message box I see this: The GDB…
Anthony Walter wrote 21 lines
When I click the more button in the debugger error message box I see this: The GDB command: "-environment-cd "\"/Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/\""" returned the error: ",msg="\"/Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/\": No such file or directory."" My host application is set to: /Users/macuser/Development/Projects/hello/hello.app/Contents/MacOS/hello

See the correction I mailed. (seems it is hanging at the server, send 10 min ago)

In my previous post:

| EncodeCurrentDirPath = gdfeDefault|

Which is the setting it already has.
It must be changed to |gdfeNone for BOTH|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/d4fdb995/attachment.html>

Reply by email

Martin
to Anthony Walter: Okay, I set both path and exe encoding to none and am now getting a different…
Anthony Walter wrote 13 lines
Okay, I set both path and exe encoding to none and am now getting a different informational message when I click the more button: The GDB command: "-exec-run" returned the error: ",msg="Unable to find Mach task port for process-id 6363: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))""

There where some posts here. Yes it needs to be signed. But I do not know how to do this.

From other peoples post, I conclude:
It seems that some of the port collection will sign it automatically. There must be some webpages describing how to codesign any exe (you need to create a self signed certificate for that)

Reply by email

Anthony Walter
to Martin: See the correction I mailed. (seems it is hanging at the server, send 10 min ago) In my…

There seems to be some lag between our messages.

Anyhow, I create a cert, reboot, and code signed ggdb using the steps provided here and here:

http://stackoverflow.com/questions/11504377/gdb-fails-with-unable-to-find-mach-task-port-for-process-id-error

sudo codesign -s ggdb_sodesign /opt/local/bin/ggdb

Then when I executed the lazarus Run command the first time I was prompted that a program was taking control and I clicked allow then typed in my account password.

The program I am building is then displayed but is completely frozen. I cannot click on it or interact with it.

Subsequent Run commands do not prompt me for control, but the program is always frozen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/75e16268/attachment-0001.html>

Reply by email

Anthony Walter
to Anthony Walter

To add to my last message, although the programs are frozen, I am able to set breakpoints in my code. For example:

procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  I := Random(100);
  Caption := IntToStr(I); // breakpoint here
end;

And the debugger stops on the breakpoint line. I am able to inspect the variable 'I' by hovering the mouse over it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/7e8a0bd8/attachment.html>

Reply by email

Martin
to Anthony Walter: There seems to be some lag between our messages. Anyhow, I create a cert, reboot, and…
Anthony Walter wrote 18 lines
There seems to be some lag between our messages. Anyhow, I create a cert, reboot, and code signed ggdb using the steps provided here and here: http://stackoverflow.com/questions/11504377/gdb-fails-with-unable-to-find-mach-task-port-for-process-id-error sudo codesign -s ggdb_sodesign /opt/local/bin/ggdb Then when I executed the lazarus Run command the first time I was prompted that a program was taking control and I clicked allow then typed in my account password. The program I am building is then displayed but is completely frozen. I cannot click on it or interact with it. Subsequent Run commands do not prompt me for control, but the program is always frozen.

Problem is I dont have Max OSX to test.

And all of this is very new apparently. (it was only reported in the last couple of weeks, however quite a couple of times).

I will still see if I can help you, from my overall experience.

---
1)
Since you do now put the path in "Run params", did you switch "App Bundle" back on? If not, try that.

2)
I assume you have tested with dwarf and stabs? (project options > debugging)

3)
Tools > options > debugger
In the grid is a value for "timeout..." It should be a positive number, greater than zero

You can set it to 50

4)
Send a log:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

Reply by email

Anthony Walter
to Martin

I have yet more details regarding frozen applications...

When the IDE options | debugging is set to none the program can be run from the IDE without locking up.

When the IDE options | debugging is set to gdb the program fails t run (even if project debugging options are turned off) unless the host application is set to app bundle contents and IDE debugging encoding options are set to clear.

When the above conditions are correctly met, the program will freeze at run, but breakpoints are correctly triggered and the debugger can inspect runtime variable as per my previous post.

Outside of the IDE all programs created with lazarus will freeze when executed either from the terminal or finder. As far as I can tell, the ONLY way to execute a lazarus created program outside of the IDE without the freezing is to open a terminal and execute the following command:

open -a appname
e.g. open -a hello

The above command can be issued in terminal from any folder. The above cannot use a qualified path for app name.

Any other attempts to run the program result in the application freezing. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131030/5677331a/attachment.html>

Reply by email

Dmitry Boyarintsev
to Anthony Walter

Anthony, have you had these kind of issues before with LCL applications? So far, I'm still sure that the problem is with launching the app from the bundle or not.

did you try to open the bundle of the application, rather than the application itself?

cd "/Users/macuser/Development/Projects/hello"
open hello.app

thanks,
Dmitry

Anthony Walter wrote 34 lines
I have yet more details regarding frozen applications... When the IDE options | debugging is set to none the program can be run from the IDE without locking up. When the IDE options | debugging is set to gdb the program fails t run (even if project debugging options are turned off) unless the host application is set to app bundle contents and IDE debugging encoding options are set to clear. When the above conditions are correctly met, the program will freeze at run, but breakpoints are correctly triggered and the debugger can inspect runtime variable as per my previous post. Outside of the IDE all programs created with lazarus will freeze when executed either from the terminal or finder. As far as I can tell, the ONLY way to execute a lazarus created program outside of the IDE without the freezing is to open a terminal and execute the following command: open -a appname e.g. open -a hello The above command can be issued in terminal from any folder. The above cannot use a qualified path for app name. Any other attempts to run the program result in the application freezing. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131031/15b28a03/attachment.html>

Reply by email

Anthony Walter
to Dmitry Boyarintsev

Dmitry,

I am not too familiar with Mac development. yes I can use the open command to run my apps just fine.

The problem is when I've created an app using fpc/lcl/lazarus and I try to run it by typing "./myprogram" in a terminal my application form appears, but controls and entire window is disabled. i cannot even resize the window. The same thing occurs if I double click the app in finder.

In fact, the only way to get a non disabled program (again builf from fpc/lcl/azarus) window on my Mac running it to type "open -a myprogram" in a terminal. That or run the program from the IDE with the IDE debugger options set to "none".

As soon as I add the "gdb" debugger and set the host application to "/path/to/my/myprogram.app/Contents/MacOS/myprogram", running the app behaves exactly like I described when run from a terminal like "./myprgram". That is, the entire window is disabled. Curiously I can still debug, for example if I put a timer on my form and set a breakpoint in the timer event, lazarus will trigger the breakpoint each time the timer expires, but the window is still disabled.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131101/bfc7915b/attachment.html>

Reply by email

Dmitry Boyarintsev
to Anthony Walter
Anthony Walter wrote 8 lines
As soon as I add the "gdb" debugger and set the host application to "/path/to/my/myprogram.app/Contents/MacOS/myprogram", running the app behaves exactly like I described when run from a terminal like "./myprgram". That is, the entire window is disabled. Curiously I can still debug, for example if I put a timer on my form and set a breakpoint in the timer event, lazarus will trigger the breakpoint each time the timer expires, but the window is still disabled.

Anthony, you might need to run the debugger from
"/path/to/my/myprogram.app/Contents/MacOS/" directory. It might solve your problem.
Or you can to try to run the program from the
"/path/to/my/myprogram.app/Contents/MacOS/".

cd "/path/to/my/myprogram.app/Contents/MacOS"
./myprogram

If you do that, your application should behave normally (be responsive to mouse and keyboard).
Please note, that this is different that running the program from the project's directory, since OSX is picky about carbon applications and bundles.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131101/beeaeeed/attachment.html>

Reply by email

Mattias Gaertner
to Anthony Walter: I am not too familiar with Mac development. yes I can use the open command to run my apps…

?

Show quoted text 7 lines
Anthony Walter hat am 1. November 2013 um 18:48 geschrieben: [...] ? The problem is when I've created an app using fpc/lcl/lazarus and I try to run it by typing "./myprogram" in a terminal my application form appears, but controls and entire window is disabled. i cannot even resize the window. The same thing occurs if I double click the app in finder.

Yes, that's normal for a GUI application under Mac. You must start the bundle, not the binary.

?

? In fact, the only way to get a non disabled program (again builf from fpc/lcl/azarus) window on my Mac running it to type "open -a myprogram" in a terminal. That or run the program from the IDE with the IDE debugger options set to "none".

Or
./myprogra.app/Contents/MacOS/myprogram

Mattias

Reply by email

Anthony Walter
to Mattias Gaertner

Interesting. Indeed running a program when in the path 'myprogram.app/Contents/MacOS' the windows is enabled and can be interacted with. However, when I set the Working Directory
'myprogram.app/Contents/MacOS' in Lazarus | Run Parameters, the myprogram window is still disabled.

See the screenshot below where I created an example program called 'worker':

http://cache.codebot.org/development/lazarus-run-parameters.png

When run with the debugger on, the breakpoints are triggered, but the window is still disabled.

A side note (please don't let this detract from the disabled window problem which is preventing proper debugging):

I found OS X has an option to allow controls other than text entry to receive focus. It's under System Preferences | Keyboard | Full Keyboard Access | Allow focus between all controls. This might effect the issue I raised in my original message regarding errors running some Lazarus revisions where focus errors were stopping the IDE from starting properly. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131101/77bafad1/attachment.html>

Reply by email

Martin
to Anthony Walter
Anthony Walter wrote 6 lines
Interesting. Indeed running a program when in the path 'myprogram.app/Contents/MacOS' the windows is enabled and can be interacted with. However, when I set the Working Directory 'myprogram.app/Contents/MacOS' in Lazarus | Run Parameters, the myprogram window is still disabled.

Instead of working dir, you should enter the full path+app into "host application"

The latest trunk of Lazarus, does not need that anymore, it corrects the app name internally

Reply by email

Anthony Walter
to Martin

Martin,

Okay. When I do that, just like when I set the working directory, the window in the program I am debugging is disabled. I cannot raise the window to the foreground by clicking on it. I cannot resize the window. I cannot click the controls. It does not show in the dock.

This was something I had tried after Dmitry Boyarintsev suggested it a few responses ago.

I'm left with a disabled user interface in my programs any time I want to run with debugging on Lazarus for Mac. If anyone with knowledge of what is going wrong could help me resolve this issue, I'd be appreciative of your efforts in solving why tmy debugging programs are completely disabled. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131102/41c6d578/attachment.html>

Reply by email

Anthony Walter
to Anthony Walter

If it helps, I made a short 2 minute video recording of the problem. The microphone wasn't connected properly, so there is no audio, but I think you'll get the idea.

Basically what the video shows is me going through the options screens showing the settings. I am using ggdb, which is the macports version of gdb (Xcode no longer comes with gdb). When I run my program ity doesn't come to the front. I cannot change the order of my program. I am clicking on my program in the video when you see the black circles. I cannot interact with it at all (including resizing the window). When I set IDE options debugger to none (instead of gdb) and run the program again, it works normally.

http://youtu.be/BNir5why_4A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131102/f06bc5b1/attachment.html>

Reply by email

Martin
to Anthony Walter
Anthony Walter wrote 14 lines
If it helps, I made a short 2 minute video recording of the problem. The microphone wasn't connected properly, so there is no audio, but I think you'll get the idea. Basically what the video shows is me going through the options screens showing the settings. I am using ggdb, which is the macports version of gdb (Xcode no longer comes with gdb). When I run my program ity doesn't come to the front. I cannot change the order of my program. I am clicking on my program in the video when you see the black circles. I cannot interact with it at all (including resizing the window). When I set IDE options debugger to none (instead of gdb) and run the program again, it works normally. http://youtu.be/BNir5why_4A

looks as I would expect.

The problem is, I cant test it myself.
I only base this, on the feedback others gave. And IIRC someone got it running like that. (IIRC used fink or something instead of Macports. No idea if that makes a difference)

To be sure, if you copy the long app-in-bundle name, and call this from a terminal, then it works?

what if you call gdb from a terminal?
ggdb -i mi

and then in gdb
-file-exec-and-symbols longname
-exec-run
and hit return after each line?

------
Create a log.
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

you can send it, but you can also check yourself.

it should say
-file-exec-and-symbols longname

Reply by email

Dmitry Boyarintsev
to Anthony Walter: If it helps, I made a short 2 minute video recording of the problem. The microphone…
Anthony Walter wrote
Basically what the video shows is me going through the options screens showing the settings. I am using ggdb, which is the macports version of gdb (Xcode no longer comes with gdb).

Was there another thread on this mail list showing how to install gdb with the latest Xcode version?

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131102/e24694a9/attachment.html>

Reply by email

Martin
to Dmitry Boyarintsev
Dmitry Boyarintsev wrote 13 lines
On Sat, Nov 2, 2013 at 9:12 PM, Anthony Walter < <mailto:>> wrote: Basically what the video shows is me going through the options screens showing the settings. I am using ggdb, which is the macports version of gdb (Xcode no longer comes with gdb). Was there another thread on this mail list showing how to install gdb with the latest Xcode version?

There was previous discussion, not sure, if on the mail list.

http://forum.lazarus.freepascal.org/index.php/topic,22452.0.html http://forum.lazarus.freepascal.org/index.php/topic,22230.0.html -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131103/1b92fd62/attachment.html>

Reply by email

Dmitry Boyarintsev
to Martin

My other recommendation would be:
* create a bug report to adapt the new debugger
* don't rely or a debugger being available at all - use logs for debugging.

thanks,
Dmitry

Martin wrote 27 lines
On 03/11/2013 01:45, Dmitry Boyarintsev wrote: On Sat, Nov 2, 2013 at 9:12 PM, Anthony Walter wrote: > Basically what the video shows is me going through the options screens > showing the settings. I am using ggdb, which is the macports version of gdb > (Xcode no longer comes with gdb). > Was there another thread on this mail list showing how to install gdb with the latest Xcode version? There was previous discussion, not sure, if on the mail list. http://forum.lazarus.freepascal.org/index.php/topic,22452.0.html http://forum.lazarus.freepascal.org/index.php/topic,22230.0.html -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131102/3f0c37c5/attachment-0001.html>

Reply by email

Anthony Walter
to Dmitry Boyarintsev: Was there another thread on this mail list showing how to install gdb with the latest…

Dmitry,

Thanks. I've read those threads before. I actually have gdb installed through macports and I signed it.

Martin,

Good information. I ran lazarus with the command line options to log gdb and this is the result:

http://cache.codebot.org/stackoverflow/lazarus-worker-debug.txt

Taking you suggestion to run ggdb from the command line, I followed your instructions and notice something that might perhaps be the problem:

http://cache.codebot.org/stackoverflow/ggdb-worker-debug.txt

The effect is still the same, my window is disabled, but I noticed these warnings:

&"warning: stabs debugging not supported for controls.pp\n" &"warning: stabs debugging not supported for
./carbon/pascocoa/appkit/appkit.pas\n"
&"warning: stabs debugging not supported for comctrls.pp\n"

Could this be causing the problems? If stabs debugging is in my compiled LCL units and exe, or perhaps in the FPC units, what would be the way to remove them? I normally run "make all" in my lazarus directory. What would be the way to "make all" for lazarus with the proper dwarf debugging information for lazarus and the LCL units? Would I also need to rebuild my FPC units as well?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131102/35a5e53f/attachment.html>

Reply by email

Martin
to Anthony Walter
Anthony Walter wrote 11 lines
Dmitry, Thanks. I've read those threads before. I actually have gdb installed through macports and I signed it. Martin, Good information. I ran lazarus with the command line options to log gdb and this is the result: http://cache.codebot.org/stackoverflow/lazarus-worker-debug.txt

This is ok

> TCmdLineDebugger.SendCmdLn "-file-exec-and-symbols

"/Users/macuser/Development/Projects/worker/worker.app/Contents/MacOS/worker""

but a bit later
<< TCmdLineDebugger.ReadLn "~"Symbols from
\"/Users/macuser/Development/Projects/worker/worker\".\n"" << TCmdLineDebugger.ReadLn "~"Local exec file:\n"" << TCmdLineDebugger.ReadLn
"~"\t`/Users/macuser/Development/Projects/worker/worker', file type mach-o-i386.\n""

this is not ok.

IIRC, does the IDE create a sym link in the bundle? Maybe your gdb follows this.

-------------
try:

- remove the symlink
- configure your project options, there is a field to specify where the final exe goes. Make sure it will be in the bundle

btw google:
https://sourceware.org/bugzilla/show_bug.cgi?id=15415

Show quoted text 13 lines
Taking you suggestion to run ggdb from the command line, I followed your instructions and notice something that might perhaps be the problem: http://cache.codebot.org/stackoverflow/ggdb-worker-debug.txt The effect is still the same, my window is disabled, but I noticed these warnings: &"warning: stabs debugging not supported for controls.pp\n" &"warning: stabs debugging not supported for ./carbon/pascocoa/appkit/appkit.pas\n" &"warning: stabs debugging not supported for comctrls.pp\n"

no, that just means the debugger cant set breakpoints or read variable in those files.
recompile all packages with dwarf -gw

Reply by email

Anthony Walter
to Anthony Walter: Thanks. I've read those threads before. I actually have gdb installed through macports…

My gosh, that's it! The symlink in the MacOS folder was messing up ggdb. Also, I rebuilt everything with -gw. I changed the Project Options | Paths | Target Filename to:

$NameOnly($(ProjFile)).app/Contents/MacOS/$NameOnly($(ProjFile))

Which evaluates to:

worker.app/Contents/MacOS/worker

I can now debug properly. I ran a few tests and for the most part everything was clean, but a few times I got an 'oops' debugger dialog when closing my program:

The GDB command:
"-file-exec-and-symbols "
did not return any result.

The GDB process is no longer running.

Is there a better option to get rid of the symlink other than setting the target file name like I did? Could someone default the IDE to place the actual exe in app bundles on the mac rather than placing a symlink there instead?

I'm writing an exhaustive fpc+lazarus Mac setup guide and I'll be sure to credit you guys. Thanks for the help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131103/738f9f58/attachment.html>

Reply by email

Martin
to Anthony Walter
Anthony Walter wrote 11 lines
My gosh, that's it! The symlink in the MacOS folder was messing up ggdb. Also, I rebuilt everything with -gw. I changed the Project Options | Paths | Target Filename to: $NameOnly($(ProjFile)).app/Contents/MacOS/$NameOnly($(ProjFile)) Which evaluates to: worker.app/Contents/MacOS/worker I can now debug properly.

WE should start a wiki with all the experiences....

Show quoted text 8 lines
I ran a few tests and for the most part everything was clean, but a few times I got an 'oops' debugger dialog when closing my program: The GDB command: "-file-exec-and-symbols " did not return any result. The GDB process is no longer running.

Every version of GDB that I have seen crashes at some point . For example expecting resource string is a common one...

So if gdb crashes, when your app closes...

Look at the page I linked, search "solib" there is n option for that, try it.

Show quoted text 10 lines
Is there a better option to get rid of the symlink other than setting the target file name like I did? Could someone default the IDE to place the actual exe in app bundles on the mac rather than placing a symlink there instead? I'm writing an exhaustive fpc+lazarus Mac setup guide and I'll be sure to credit you guys. Thanks for the help!

Ah good

Reply by email

Thomas Moritz
to Martin

Hello,

I have made my system ready today.
OS X 10.9, fpc 2.6.2, lazarus 1.1.

Show quoted text 20 lines
WE should start a wiki with all the experiences.... > I ran a few tests and for the most part everything was clean, but a few times I got an 'oops' debugger dialog when closing my program: > > The GDB command: > "-file-exec-and-symbols " > did not return any result. > > The GDB process is no longer running. Every version of GDB that I have seen crashes at some point . For example expecting resource string is a common one... So if gdb crashes, when your app closes... Look at the page I linked, search "solib" there is n option for that, try it. > > Is there a better option to get rid of the symlink other than setting the target file name like I did? Could someone default the IDE to place the actual exe in app bundles on the mac rather than placing a symlink there instead? > > I'm writing an exhaustive fpc+lazarus Mac setup guide and I'll be sure to credit you guys. Thanks for the help!

I looked for all the details together on the web!
Sorry, my notes I have here only in German:
---------------------------------------------------- gdb f?r Lazarus installieren
(ab Mavericks wird nur noch lldb unterst?tzt !!!)

1) homebrew installieren:
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)

2) gdb installieren
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb

In Lazarus: kompilieren geht mit gdb,
aber Run (Start) h?ngt bei:

The GDB command:
?-exec-run?
returned the error:
?,msg=?Unable to find Mach task port for process-id 62593: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))??

also muss der gdb signiert werden:

Schl?sselbund-App: ?ffnen
Auswahl: neues Zertifikat erstellen
Name (z.B): gdb-cert
Identity Type: root, self-signed
Certificate Type: Code Signing
Standardwerte ?berschreiben -> JA
?weiter, weiter? bis:
Speichern in: System
Eigenschaften vom Zertifikate ?ffnen: Vertrauen: Immer vertrauen! Schl?sselbund-App schliessen

gdb im Terminal signieren:

cd /usr/local/bin
codesign -s gdb-cert gdb

Nun war ein Neustart notwendig -> dann war alles gut. Beim ersten Debuggen wird nach dem root-Password gefragt. ????????????????????????

I hope it's still a little help.

Best regards Thm

Reply by email