Page 1 of 1
[SOLVED] How to set terminal to Konsole?
Posted: Mon Apr 03, 2017 7:02 pm
by mnemonic
This is driving me crazy. I'm trying to set the terminal to konsole, but can't.
In
Settings > Preferences > Terminal, I have:
Code: Select all
/usr/bin/codelite_xterm '$(TITLE)' '$(CMD)'
I have run:
Code: Select all
sudo update-alternatives --config x-terminal-emulator
and selected
konsole as the default. But when I try to build and run a project (in this case called "First"), konsole opens and displays:
Code: Select all
/usr/bin/codelite_exec: 22: /usr/bin/codelite_exec: ./First: not found
Press ENTER to continue...
If I set the default terminal to xterm, everything works fine, but I'd rather use konsole.
Any help would be really appreciated.
Re: How to set terminal to Konsole?
Posted: Mon Apr 03, 2017 11:01 pm
by DavidGH
Hi,
In Settings > Preferences > Terminal, I have:
/usr/bin/codelite_xterm '$(TITLE)' '$(CMD)'
That should have been codelite_exec; codelite_xterm is for running in the debugger.
It's probably not the canonical answer, but fwiw if I put:
/usr/bin/konsole --noclose -e /full/path/to/binary
in the terminal settings, konsole opens, runs the program, and stays open on exit (which is the idea).
However I normally don't bother to set it to anything; I almost always run programs in the debugger. As I said, that uses codelite_xterm instead of codelite_exec, and you should find that konsole 'just works'.
Regards,
David
Re: How to set terminal to Konsole?
Posted: Mon Apr 03, 2017 11:16 pm
by mnemonic
I have changed my terminal config to:
Code: Select all
/usr/bin/codelite_exec '$(TITLE)' '$(CMD)'
It's still not working for me. Now, when I hit the build and run button, I get:
Code: Select all
Current working directory: /home/mnemonic/Documents/Test/First/Release
Running program: /usr/bin/codelite_exec './First ' '/bin/sh -f /usr/bin/codelite_exec ./First'
and nothing happens (i.e. no terminal is opened).
If I run:
Code: Select all
/usr/bin/codelite_exec './First ' '/bin/sh -f /usr/bin/codelite_exec ./First'
in the terminal (Konsole) from the Debug or Release directory in the project, then it runs.
Re: How to set terminal to Konsole?
Posted: Tue Apr 04, 2017 1:13 am
by DavidGH
I have changed my terminal config to:
/usr/bin/codelite_exec '$(TITLE)' '$(CMD)'
I don't think you're supposed to call codelite_exec yourself, it happens automatically.
Try:
Code: Select all
konsole --noclose --title '$(TITLE)' -e '$(CMD)'
which works correctly for me if I set the full path to the binary in the Project Settings 'Intermediate Folder' field. There's probably a better way to get the working dir...
x-terminal-emulator --noclose --title '$(TITLE)' -e '$(CMD)'
also works.
Re: How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 12:35 am
by mnemonic
Hi David,
I have tried all those settings, I get the same result: "... ./FirstTest not found...". I have a feeling this is something to do with the current working directory not being set correctly (somewhere).
I have made a small YouTube video of the problem I'm experiencing:
https://youtu.be/ZJ5xHbHYBLE
In the video, I copy the command Codelite it attempting to run, and paste it in a terminal, and it works just fine (because I'm in the project's ./Debug directory).
Any other ideas?
Many thanks.
Re: How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 1:31 am
by DavidGH
No other ideas, just the previous one which (unless I missed it on the video) you've not tried:
which works correctly for me if I set the full path to the binary in the Project Settings 'Intermediate Folder' field.
Also:
I have changed my terminal config to:
/usr/bin/codelite_exec '$(TITLE)' '$(CMD)'
I agree the relative path doesn't seem to work, which is a bug; but if you set the full path in the Project Settings 'Intermediate Folder' field, and
don't put codelite_exec in the terminal config, I think you'll find it works.
To be even more specific, your 'Intermediate Folder' field should hold something like:
/home/mnemonic/Documents/Test/FirstTest/Debug/
or whatever the correct full path is.
Your terminal config field should say:
konsole --noclose --title '$(TITLE)' -e '$(CMD)'
without mentioning codelite_exec.
I might be wrong, but it was that combination that worked for me.
Re: How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 1:48 am
by mnemonic
David - thanks so much for all your help on this.
I have identified the conditions under which this issue occurs: when another instance of Konsole exists (and that instance wasn't opened by Codelite):
https://youtu.be/cG5Hjjl3DnQ
At this stage, I have the following options:
1. Make sure no other instances on Konsole are open when running Codelite (not practical).
2. Use Codelite's built-in terminal emulator (a good solution, but configuration options are limited).
3. Install and use another terminal (such as gnome-terminal).
I have decided to go with option 3. Steps are:
Then set the x-terminal-emulator to "gnome-terminal.wrapper":
Code: Select all
mnemonic@d2:~$ sudo update-alternatives --config x-terminal-emulator
[sudo] password for mnemonic:
There are 6 choices for the alternative x-terminal-emulator (providing /usr/bin/x-terminal-emulator).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gnome-terminal.wrapper 40 auto mode
* 1 /usr/bin/gnome-terminal.wrapper 40 manual mode
2 /usr/bin/koi8rxterm 20 manual mode
3 /usr/bin/konsole 40 manual mode
4 /usr/bin/lxterm 30 manual mode
5 /usr/bin/uxterm 20 manual mode
6 /usr/bin/xterm 20 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
I would be curious to know if you are able to "build & run" a project from Codelite if you have another instance of Konsole open (or if this is just something funky that occurs on my machine).
Thanks again for all your help.
Re: How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 1:58 am
by mnemonic
By the way, I have left my terminal preferences as the default:
Code: Select all
/usr/bin/codelite_xterm '$(TITLE)' '$(CMD)'
By doing so, it's then quite simple to change terminals using:
Code: Select all
sudo update-alternatives --config x-terminal-emulator
This has two advantages:
1. It also changes the debugger terminal.
2. You don't have to "man" what the options are to set the title for different terminals.
Re: [SOLVED] How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 2:31 pm
by DavidGH
By the way, I have left my terminal preferences as the default:
/usr/bin/codelite_xterm '$(TITLE)' '$(CMD)'
Hmm; on checking, you're right and I was wrong above. codelite_xterm
is the default setting. Maybe I was remembering an old default that used _exec. My apologies.
I have identified the conditions under which this issue occurs: when another instance of Konsole exists (and that instance wasn't opened by Codelite):
I see. It actually makes sense, as there's really only a single konsole running; when you seem to start another instance it just opens a new window. The reason for your failure is that it inherits the original's working dir, so relative paths fail. Setting a full path as above still succeeds.
I could reproduce it in a kubuntu 16.10 virtualbox guest, so it's not just your machine.
Re: [SOLVED] How to set terminal to Konsole?
Posted: Wed Apr 05, 2017 4:09 pm
by mnemonic
Thanks for the explanation - always good to know "why" something is happening.
...which works correctly for me if I set the full path to the binary in the Project Settings 'Intermediate Folder' field.
Sorry, I should have mentioned earlier that I did try changing
Project > Settings > General > Intermediate Folder (under the "Build" heading) to the full path of the executable (in my case: /home/mnemonic/Documents/Test/FirstTest/Debug). This did not work.
However, there is an option under the "Execution" section called
Executable to Run / Debug. As well as the change you mentioned, changing
Executable to Run / Debug to:
Code: Select all
$(IntermediateDirectory)/$(ProjectName)
works!
Once again, thanks so much for all your help on this.