Sign in Join

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

Mailing lists / lazarus / 2016-02

How to set defines for a project? Lazarus crashes...

14 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

Bo Berglund

I tried setting the conditional "UseCThreads" for my test project but even though I can reach the place where this apparently is set: Menu: Project/Project_Options/Custom_Options/Defines it seems not to work!

When I use this dialog to enter the symbol UseCThreads the effect is invisible when I hit OK, nothing gets added to the list of defines/options and when I OK on the main options window anyway Lazarus locks up completely!!!
Only way out seems to be to reboot the machine!!!!! I have not fond any way to open a menu or interact with the Lazarus IDE any other way after this happened so now my option is to restart the operating system.
It IS still possible to move the Lazarus windows around on the desktop but not to close Lazarus or interact in any other way. :(

Is it not supposed to be possible to use this dialog that clearly offers to add a define to actually do this?

In Delphi this is available in a dialog along with the path settings, which is very convenient to use...

I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie.

Bo Berglund Developer in Sweden

Reply by email

Unknown author
to Bo Berglund
Bo Berglund wrote 23 lines
I tried setting the conditional "UseCThreads" for my test project but even though I can reach the place where this apparently is set: Menu: Project/Project_Options/Custom_Options/Defines it seems not to work! When I use this dialog to enter the symbol UseCThreads the effect is invisible when I hit OK, nothing gets added to the list of defines/options and when I OK on the main options window anyway Lazarus locks up completely!!! Only way out seems to be to reboot the machine!!!!! I have not fond any way to open a menu or interact with the Lazarus IDE any other way after this happened so now my option is to restart the operating system. It IS still possible to move the Lazarus windows around on the desktop but not to close Lazarus or interact in any other way. :( Is it not supposed to be possible to use this dialog that clearly offers to add a define to actually do this? In Delphi this is available in a dialog along with the path settings, which is very convenient to use... I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie.

reboot ist not needed on linux
use a console and kill command
Ctrl-Alt-F1 for console
and
Ctrl-Alt-F7 to go back to X

UseCThreads is normaly added in the *.lpr file
Project->Project Inspektor
doubleclick lpr file

Reply by email

Mattias Gaertner
to Bo Berglund: I tried setting the conditional "UseCThreads" for my test project but even though I can…
Show quoted text 7 lines
Bo Berglund hat am 8. Februar 2016 um 20:24 geschrieben: I tried setting the conditional "UseCThreads" for my test project but even though I can reach the place where this apparently is set: Menu: Project/Project_Options/Custom_Options/Defines it seems not to work!

Do you mean you added -dUseCThreads in Project/Project_Options/Custom_Options, but it is not appended to options passed to FPC?

When I use this dialog to enter the symbol UseCThreads the effect is invisible when I hit OK

Did you enable the checkbox of the define?

, nothing gets added to the list of defines/options and when I OK on the main options window anyway Lazarus locks up completely!!!

It works here on OS X/carbon. Maybe the bug only appears on your platform.

Show quoted text 6 lines
[...] Only way out seems to be to reboot the machine!!!!! I have not fond any way to open a menu or interact with the Lazarus IDE any other way after this happened so now my option is to restart the operating system. It IS still possible to move the Lazarus windows around on the desktop but not to close Lazarus or interact in any other way. :(

Maybe the focus is captured.

Show quoted text 7 lines
Is it not supposed to be possible to use this dialog that clearly offers to add a define to actually do this? In Delphi this is available in a dialog along with the path settings, which is very convenient to use... I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie.

Mattias

Reply by email

Bo Berglund
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
> I tried setting the conditional "UseCThreads" for my test project but > even though I can reach the place where this apparently is set: > Menu: Project/Project_Options/Custom_Options/Defines > it seems not to work! Do you mean you added -dUseCThreads in Project/Project_Options/Custom_Options, but it is not appended to options passed to FPC?

No I did not add the -d in front of the UseCThreads symbol, just the symbol itself.

I used Menu: Project/Project_Options/Compiler_Options/Custom_Options This was the only place I found the word Defines, which appears on a button to the right. It is in subnode Compiler_Options, which did not sound right to me anyway since I wanted the symbol to be global including the Lazarus IDE code parser, but I did not find defines anywhere else...

Then I clicked the button and an input dialog named Defines popped up. It has a text input box named Define into which I typed UseCThreads Then I clicked the Add button and this name appeared in the list below, so I clicked OK and the input dialog disappeared and I was back in the Custom_Options dialog with nothing showing in the list there. If I cancel at this point everything works out except for the define but on the second try I clicked OK and then Lazarus locked up.

Show quoted text 5 lines
> When I use this dialog to enter the symbol UseCThreads the effect is > invisible when I hit OK Did you enable the checkbox of the define?

I see a checkbox "Build modes" on top of the Custom_Options dialog, is this the box you mean? I have not checked it.

Show quoted text 5 lines
>, nothing gets added to the list of > defines/options and when I OK on the main options window anyway > Lazarus locks up completely!!! It works here on OS X/carbon. Maybe the bug only appears on your platform.

It should not be any different, Lazarus itself uses the same sources on all pl?atforms as far as I understand. I retrieved 1.6RC2 from svn when I built Lazarus.

Different workaround solution:

If I open the project file and add this directly on the next line following the top line "program MyTCPTest":
{$DEFINE UseCThreads}

then it actually does work.
But the Delphi way seems easier with a separate project option for the defines...

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Unknown author: reboot ist not needed on linux use a console and kill command Ctrl-Alt-F1 for console and…
> I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie. reboot ist not needed on linux use a console and kill command Ctrl-Alt-F1 for console

Or use the terminal icon on the taskbar, right?
But then what? How do I use kill to shut down Lazarus? I am used to Windows Task Manager where the running programs are listed and one can stop it, but how do I get a corresponding list in which to select Lazarus in Linux?
'man kill' indicates that I need a <pid> value but 'man pid' returns nothing.

Show quoted text 5 lines
Ctrl-Alt-F7 to go back to X UseCThreads is normaly added in the *.lpr file Project->Project Inspektor doubleclick lpr file

When I added
{$DEFINE UseCThreads}
as the first line following the program line it works. :)

Bo Berglund Developer in Sweden

Reply by email

JuuS
to Bo Berglund
Bo Berglund wrote 5 lines
On Mon, 8 Feb 2016 23:24:35 +0100, wrote: I am used to Windows Task Manager where the running programs are listed and one can stop it, but how do I get a corresponding list in which to select Lazarus in Linux?

All linux flavors have this as well. In kUbuntu it is called system monitor (underlying name is ksysguard).

'man kill' indicates that I need a <pid> value but 'man pid' returns nothing.

use ps command (ps --help all) to get PID's. ps aux is a good start, but use grep to winnow it down.

Julius

Reply by email

Bo Berglund
to JuuS
JuuS wrote 5 lines
> 'man kill' indicates that I need a <pid> value but 'man pid' returns > nothing. use ps command (ps --help all) to get PID's. ps aux is a good start, but use grep to winnow it down.

Tried this:
pi at rpi2-jessie2:~ $ ps -u pi |grep lazarus
5091 ? 00:00:00 startlazarus
5094 ? 00:00:10 lazarus

Seems to be two processes with lazarus in the name. Which one (or both) do I kill?

Bo Berglund Developer in Sweden

Reply by email

patspiper
to Bo Berglund: On Tue, 9 Feb 2016 00:22:21 +0100 (CET), Mattias Gaertner No I did not add the -d in…
Bo Berglund wrote 9 lines
No I did not add the -d in front of the UseCThreads symbol, just the symbol itself. I used Menu: Project/Project_Options/Compiler_Options/Custom_Options This was the only place I found the word Defines, which appears on a button to the right. It is in subnode Compiler_Options, which did not sound right to me anyway since I wanted the symbol to be global including the Lazarus IDE code parser, but I did not find defines anywhere else...

Manual way: Add -dUseCThreads in
Project/Project_Options/Compiler_Options/Custom_Options

Show quoted text 8 lines
Then I clicked the button and an input dialog named Defines popped up. It has a text input box named Define into which I typed UseCThreads Then I clicked the Add button and this name appeared in the list below, so I clicked OK and the input dialog disappeared and I was back in the Custom_Options dialog with nothing showing in the list there. If I cancel at this point everything works out except for the define but on the second try I clicked OK and then Lazarus locked up.

If you use the defines button, make sure the checkbox next to UseCThreads is ticked. -dUseCThreads will show up automatically in Project/Project_Options/Compiler_Options/Custom_Options

Stephano

Reply by email

JuuS
to Bo Berglund: Tried this: pi at rpi2-jessie2:~ $ ps -u pi |grep lazarus 5091 ? 00:00:00…
Bo Berglund wrote 15 lines
On Tue, 9 Feb 2016 11:32:10 +0100, JuuS wrote: >> 'man kill' indicates that I need a <pid> value but 'man pid' returns >> nothing. > > use ps command (ps --help all) to get PID's. ps aux is a good start, > but use grep to winnow it down. Tried this: pi at rpi2-jessie2:~ $ ps -u pi |grep lazarus 5091 ? 00:00:00 startlazarus 5094 ? 00:00:10 lazarus Seems to be two processes with lazarus in the name. Which one (or both) do I kill?

I would assume the higher PID is the child of the lower. You can also specify --forest with the ps command and it gives ascii art tree showing parent child relationships.

I'm no linux expert but I would kill child first then parent. But it may be killing parent automatically kills child.?.

Then again you can use (at least in kUbuntu) the system monitor to kill processes, right click on the entry on the processes tab.

Reply by email

Unknown author
to Bo Berglund: Or use the terminal icon on the taskbar, right? But then what? How do I use kill to shut…
Bo Berglund wrote 26 lines
On Mon, 8 Feb 2016 23:24:35 +0100, wrote: >> I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie. > >reboot ist not needed on linux >use a console and kill command >Ctrl-Alt-F1 for console Or use the terminal icon on the taskbar, right? But then what? How do I use kill to shut down Lazarus? I am used to Windows Task Manager where the running programs are listed and one can stop it, but how do I get a corresponding list in which to select Lazarus in Linux? 'man kill' indicates that I need a <pid> value but 'man pid' returns nothing. >Ctrl-Alt-F7 to go back to X > >UseCThreads is normaly added in the *.lpr file >Project->Project Inspektor > doubleclick lpr file When I added {$DEFINE UseCThreads} as the first line following the program line it works. :)

man top ;)

'top' command is your friend
then

k for kill
then the signal to kill
9 for termination ;)
15 for asking polite to close ;)

Reply by email

Unknown author
to Bo Berglund: Or use the terminal icon on the taskbar, right? But then what? How do I use kill to shut…
Bo Berglund wrote 12 lines
On Mon, 8 Feb 2016 23:24:35 +0100, wrote: >> I am using Lazarus 1.6RC2 and FPC 3.0.0 on Raspbian Jessie. > reboot ist not needed on linux > use a console and kill command > Ctrl-Alt-F1 for console Or use the terminal icon on the taskbar, right? But then what? How do I use kill to shut down Lazarus? I am used to Windows Task Manager where the running programs are listed and one can stop it, but how do I get a corresponding list in which to select Lazarus in Linux?

i generally use something like this

ps aux | grep -Ei -e "[l]azarus"

the square braces around the first letter in the grep cause grep to find the real occurrence and not a second one which would be itself...

one can also use the system monitor or top or numerous other tools that show what programs and services are running... most all of those will show the pid...

i was also thinking that there might be a pid file for lazarus... they're generally found in /var/run but i don't see one in there... IF there were one, one could use a command similar to this...

kill -TERM `cat /var/run/Lazarus.pid`

OR

kill -TERM `pgrep Lazarus`

note that there is case sensitivity at play with the file name of the PID... and once again, lazarus apparently does not have a pid file...

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted.

Reply by email

Dmitry Boyarintsev
to Mattias Gaertner: Do you mean you added -dUseCThreads in Project/Project_Options/Custom_Options, but it is…
Mattias Gaertner wrote
Do you mean you added -dUseCThreads in Project/Project_Options/Custom_Options, but it is not appended to options passed to FPC?

Is it true to say that there are only 2 ways in IDE to set defines.
1) Project Options/Custom Options
2) Project Options/Additions and Overrides (+ Custom Option)

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

Reply by email

Mattias Gaertner
to Dmitry Boyarintsev
Show quoted text 6 lines
On Mon, Feb 8, 2016 at 6:22 PM, Mattias Gaertner wrote: [...] Is it true to say that there are only 2 ways in IDE to set defines. 1) Project Options/Custom Options 2) Project Options/Additions and Overrides (+ Custom Option)

3) Packages have their own custom options and can add custom options to the project.

Mattias

Reply by email