View Issue Details

IDProjectCategoryView StatusLast Update
0019708LazarusIDEpublic2019-01-07 22:13
ReporterDavid NoriegaAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionsuspended 
PlatformOSLinuxOS VersionArch
Product Version0.9.30Product Build29738 
Target VersionFixed in Version 
Summary0019708: Lazarus under linux requires xterm
DescriptionSometimes xterm is not installed in a linux box, and it is required by Lazarus IDE when running a program (probably gdb). Lazarus does not recover gracefully, it needs to be killed.
Steps To Reproduceremove xterm or create a new archlinux installation without xterm and then run an application created in Lazarus
Additional InformationLazarus should probably try to find the default terminal program, or ask the user for one in case it doesn't find xterm during install. At the very least it should recover gracefully.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0027003 resolvedMartin Friebe False debug running condition prevents shutdown 

Activities

Bernd Kreuss

2011-07-11 17:08

reporter   ~0049884

since recently i have noticed that latest Lazarus suddenly opened an ominous program that called itself "Terminal" (of which I didn't even know it existed on my system, it looks somehow gnome-ish) to run the applications when debugger is off and I was not yet able to find out what program this is (there is no "terminal" and no "Terminal" anywhere in my path).

I personally liked the small and fast loading xterm and i always thought xterm belongs to the things that are *always* guaranteed to be present whenever X is installed (like all the other little X gadgets like xclock, xeyes etc.).

I could not find a configuration option for this. And I don't like what it is currently doing without asking me. I think it should be freely configurable (and default to the contents of the $TERM variable which would happen to be xterm on my Kubuntu system)

Zeljan Rikalo

2011-07-11 17:53

developer   ~0049888

What about Run->Run parameters->Launching application COMBOBOX where you can choose terminal ?

Zeljan Rikalo

2011-07-11 17:54

developer   ~0049889

@David are you talking about Run -> Run parameters -> Launching application ?

Bernd Kreuss

2011-07-11 18:04

reporter   ~0049890

Last edited: 2011-07-11 19:24

if this is not checked then it will use a terminal itself.

I did some research and it seems instead of simply xterm or $TERM since a few weeks Lazarus suddenly started using

/etc/alternatives/x-terminal-emulator

which on my system was for some reason set to xfce-terminal. I have set this symlink on my system to /usr/bin/xterm again, hoping to get my good old white xterm with black text back but now something strange happens and I am at the end of my wisdom:

/usr/bin/xterm would start my xterm as I am used to it (black on white)

/etc/alternatives/x-terminal-emulator is an ordinary symlink to /usr/bin/xterm but if i start it with /etc/alternatives/x-terminal-emulator then I get an xterm with inverted colors :-( and I have not the slightest idea why the *same* application started from a differently named symlink should suddenly change its default settings.

I want my white xterm back :-(

__________
Edit (and slightly off-topic, regarding my white xterm):
this ~/.Xresources file
x-terminal-emulator*background: #ffffff
x-terminal-emulator*foreground: #000000
x-terminal-emulator.SimpleMenu*background: #eeeff2
x-terminal-emulator.SimpleMenu*foreground: #000000
has brought back my black on white terminal.

I still believe the terminal should be configurable.

And it is not the same as the "run with" setting, this can be used for slightly different things and also if this box is checked then debugging won't work anymore since it would then debug the terminal or the "run with" application instead of the own application.

If the box is unchecked and also GUI application is unchecked then it must open a terminal on its own (on windows it would open a dos box to run the non-gui app)

Mattias Gaertner

2011-07-11 19:28

manager   ~0049891

The $TERM is not enough. There are different command line options for each terminal.
If you want to use xterm, then read the manual page of xterm and set the right params in Lazarus' run parameters.
If you think this is a common issue, add some comments to the wiki.

Back to this bug report:
David, what do you mean with not gracefully? Do you mean the IDE hangs when you set a non existing launching application?

David Noriega

2011-07-12 01:46

reporter   ~0049894

In a freshly installed lazarus 0.9.30 (maybe already fixed in a later revision), when you try to compile and launch an application (F9) it complains it cannot find xterm. I imagine its the debugger that needs it somehow. I couldn't either stop the application from continuing running, or close the Lazarus IDE itself. I had to kill the lazarus process.

Maybe Lazarus can come with its own terminal so it doesn't depend on any external terminal program?

Bernd Kreuss

2011-07-12 05:55

reporter   ~0049895

Last edited: 2011-07-12 06:54

@mattias it cannot be set in the run parameters, there is no option to set the terminal, also there is nothing in tools/options. It is using something hardwired (that seems to end up at /etc/alternatives/x-terminal-emulator in recent trunk or xterm in older versions).[edit] I'm wrong, its *not* lazarus, its FPC, see below.[/edit]

I am now searching through the code to find the relevant place where this happens.

Bernd Kreuss

2011-07-12 06:52

reporter   ~0049896

Last edited: 2011-07-12 07:28

found it.

Its in TProcess, its calling it with poNewConsole, so its an FPC/FCL thing.

There was a bug report here:
http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=12034

See the last comment. Thats also the reason why I suddenly noticed the change in behavior after I updated my FPC to the latest trunk.

@David: The next FPC will probably fix your problem, FPC trunk already seems to implement this. In the meantime try to set a symlink somewhere in your path if you don't want to manually install xterm.

Please also file a bug at your linux distributor and ask them what on earth they were thinking when they decided not to ship xorg along with xterm (or at least set a proper symlink to the replacement). xterm belongs to x11 and xorg, it was always guaranteed to be there for the last few decades whenever and wherever X11 was installed.

David Noriega

2011-07-12 08:03

reporter   ~0049897

I use ArchLinux which usually only installs the minimal dependencies whenever you install anything. In this case when I installed xorg it didn't bother installing xterm obviously. I was able to fix it quickly like you say, installing xterm separately. But still I found it odd that lazaurs would get stuck like that and that is why I reported it.

I read the discussion on the FP bug report and I don't agree with how it was resolved. I think a built in terminal can easily be launched for TProcess if the terminal executable is not specified.

Anyway, why does Lazarus need to create a TProcess with a terminal, anywhere?

Bernd Kreuss

2011-07-12 10:33

reporter   ~0049899

It depends on the type of application. If you have a non-gui app that interacts with the user on the console then you usually want to start it in an envionment where there actually exists an interactive console with stdin and stdout. On windows these programs would open a cmd window too when started.

If you check "win32 GUI App" on the "linking" page in project options then it would not open a console window in windows (and in Linux the IDE would not start it in a terminal).

Maybe this option should be renamed to a more platform neutral

[_] "GUI application (no console window)"

because it does not only affect how the windows binary is built, this option will also affect how the IDE behaves when launching it from within the IDE on non-windows platforms.

David Noriega

2011-07-14 08:23

reporter   ~0049970

I agree that a console application would naturally require a terminal to interact with. But the error that happened to me did not involve a console application. I was trying to launch a new LCL Form based application. Why would Lazarus need to start a TProcess that requires a console, anywhere?

Well anyway this is for 0.9.30 which is supposed to be ¨stable¨ and the way I had to kill the Lazarus process was anything but. That is why I am reporting it. Maybe its fixed already in the next revision and no use bothering patching 0.9.30 now.

David Noriega

2011-11-14 22:20

reporter   ~0054082

For some strange reason this issue stopped but has now reappeared after rebuilding Lazarus with the latest SVN. "Debugger cannot find xterm"

I gave up figuring out what was wrong, and installed xterm on my linux.

r33513

tiger

2014-11-09 12:44

reporter   ~0079040

Bernd Kruess: "Please also file a bug at your linux distributor and ask them what on earth they were thinking when they decided not to ship xorg along with xterm (or at least set a proper symlink to the replacement). xterm belongs to x11 and xorg, it was always guaranteed to be there for the last few decades whenever and wherever X11 was installed."

Was this a "guarantee" or even policy or just an assumption on someone's part?

There are several low footprint installations and things like Fedora "spins" based on LXDE that aim to be lightweight. This will also be very much the case for ARM platforms, where having tons of cruft is not the norm.


There will usually be some *term alternative and apparently this is not being detected and called in the correct way.

Martin Friebe

2015-01-14 02:25

manager   ~0080369

Please test with lazarus 1.5 (or monitor the merges for 1.4 in case commit 47377 is merged)


Quote: "Lazarus does not recover gracefully, it needs to be killed."

This should no longer be the case.

Lazarus should now display an error "Failed to create process for GDB".
There is a more button, which should have a message about xterminal.

Please confirm if you get this new behaviour.
Please indicate, if you consider this a fix. Since the actual installation of xterm can not be enforced by us.

Alexey Tor.

2019-01-07 20:53

reporter   ~0113239

I see that Lazarus 2.0 RC don't show errors about xterm anymore. so it is fixed.

(But I don't see any terminal window when I debug console app on Linux, no terminals at all, with/without xterm)

Martin Friebe

2019-01-07 22:13

manager   ~0113242

Closing because no feedback received (from original reporter).

The issue is quite old, and has several false(?) leads.


If the issue still exists, please open a new report (you may refer to this report). Depending on what the issue is, this may be a report to fpc.

1)
Which terminal is (attempted to be) used: That is an fpc issue.


2)
The question as to what flags Lazarus should send to TProcess, this can be reported here.

If you report a request which flags to send, please specify your exact OS.
And test which settings actually work on your system.

To test different settings, open and edit the file components\lazdebuggergdbmi\cmdlinedebugger.pp
Line 330
function TCmdLineDebugger.CreateDebugProcess(const AOptions: String): Boolean;

    FDbgProcess := TProcessUTF8.Create(nil);
    try
      FDbgProcess.ParseCmdLine(ExternalDebugger + ' ' + AOptions);
      FDbgProcess.Options:= [poUsePipes, poNoConsole, poStdErrToOutPut, poNewProcessGroup];

It already says poNoConsole.
But if you find better settings....

Issue History

Date Modified Username Field Change
2011-07-10 14:49 David Noriega New Issue
2011-07-10 14:49 David Noriega Widgetset => GTK 2
2011-07-11 17:08 Bernd Kreuss Note Added: 0049884
2011-07-11 17:53 Zeljan Rikalo Note Added: 0049888
2011-07-11 17:54 Zeljan Rikalo LazTarget => -
2011-07-11 17:54 Zeljan Rikalo Note Added: 0049889
2011-07-11 17:54 Zeljan Rikalo Status new => feedback
2011-07-11 18:04 Bernd Kreuss Note Added: 0049890
2011-07-11 18:07 Bernd Kreuss Note Edited: 0049890
2011-07-11 18:08 Bernd Kreuss Note Edited: 0049890
2011-07-11 19:24 Bernd Kreuss Note Edited: 0049890
2011-07-11 19:28 Mattias Gaertner Note Added: 0049891
2011-07-12 01:46 David Noriega Note Added: 0049894
2011-07-12 05:55 Bernd Kreuss Note Added: 0049895
2011-07-12 05:56 Bernd Kreuss Note Edited: 0049895
2011-07-12 05:59 Bernd Kreuss Note Edited: 0049895
2011-07-12 06:52 Bernd Kreuss Note Added: 0049896
2011-07-12 06:54 Bernd Kreuss Note Edited: 0049895
2011-07-12 07:28 Bernd Kreuss Note Edited: 0049896
2011-07-12 08:03 David Noriega Note Added: 0049897
2011-07-12 10:33 Bernd Kreuss Note Added: 0049899
2011-07-14 08:23 David Noriega Note Added: 0049970
2011-09-19 11:47 Vincent Snijders Status feedback => acknowledged
2011-11-14 22:20 David Noriega Note Added: 0054082
2014-11-09 09:39 Juha Manninen Relationship added related to 0027003
2014-11-09 12:44 tiger Note Added: 0079040
2015-01-14 02:25 Martin Friebe Note Added: 0080369
2015-01-14 02:25 Martin Friebe Assigned To => Martin Friebe
2015-01-14 02:25 Martin Friebe Status acknowledged => feedback
2019-01-07 20:53 Alexey Tor. Note Added: 0113239
2019-01-07 22:13 Martin Friebe Note Added: 0113242
2019-01-07 22:13 Martin Friebe Status feedback => resolved
2019-01-07 22:13 Martin Friebe Resolution open => suspended