linux eclipse: run a shell command as the pre-build command - linux

How can I have the pre-build step in eclipse/CDT (Linux) run a simple shell command, echo specifically. I think eclipse has a screwed up value for PKG_CONFIG_PATH and want to see what Linux thinks the value is.

Under the covers, Eclipse uses "make". You can simly edit the project's makefile:
help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/concepts/cdt_c_makefile.htm
You can also create an:
"External Tool", which is up there beside the Debug and Run buttons in
the toolbar. Then I tell the external tool to run the shell with the
configure script and any of it's arguments as arguments to the tool.
http://www.eclipse.org/forums/index.php/t/61866/

Related

How do I create a shortcut for a command line command in Raspbian Stretch?

I am attempting to install RetroPie as an app on Raspbian Stretch and I am done except for creating a desktop shortcut for it. The problem is that the only way to open RetroPie seems to be running a command in the command line. I can’t do it in terminal because it gives me an error saying that it can’t initialize the window. Is there a way to run a command line command as a shortcut or am I going to have to find another way of doing this?
P.S. Here is the tutorial that I followed to install RetroPie:
https://www.makeuseof.com/tag/install-retropie-app-raspberry-pi/
Probably your shell (on the raspberry) is GNU bash. So read the manual of GNU bash.
You probably want (once) to edit some Bash startup file (such as ~/.bashrc) to define functions and aliases there, and you could add executable shell scripts somewhere in your $PATH. I recommend having a $HOME/bin/ directory containing your scripts and executables, and have $HOME/bin/ early in your $PATH.
I can’t do it in terminal because it gives me an error saying that it can’t initialize the window.
Perhaps you need some display server (such as Xorg or Wayland) running (with a desktop environment or a window manager). You could run Xorg on your PC (on which you could install Linux) and connect to the raspberry using ssh -X then remote applications running on your Raspberry are displayed on your PC. IF your Raspberry is directly connected to a screen (via HDMI) you might run some Xorg server on it.
Is there a way to run a command line command as a shortcut
Yes, by making a shell alias or shell function or shell script. You need to understand how they work and change or create some appropriate file using some source code editor (I recommend GNU emacs, but the choice is yours and you might use any other editor such as vim, gedit, etc...): functions and aliases could be defined in your ~/.bashrc; shell scripts would usually have their own file with a shebang under your $HOME/bin/...

Run script using Qt Creator like environment

I try to run a deployment script using KDE Neon. I have started the script manually from bash and I got an error qmake would be not found.
When trying to run qmake directly from the bash I get the following error:
$ qmake -v
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
That bin folder is almost empty and contains no qmake. In the path /usr/lib/x86_64-linux-gnu/qt5/bin/ a full Qt installation can be found but no qmake as well. /usr/bin/qmake obviously is a link that is pointing to the missing /usr/lib/x86_64-linux-gnu/qt4/bin/qmake.
qmake works fine when using Qt Creator. The binary used by Qt Creator is /home/<user>/Qt/5.10.0/gcc_64/bin/qmake.
Obviously the /usr/... Qt installations aren't complete. First I thought about how to complete the installations and how to switch from Qt4 to Qt5. However Qt Creator obviously is able to use its own /home/... located Qt environment anyway and I would like to use it too when running a script outside Qt Creator.
Is there a way I can start scripts from bash using the same Qt environment as Qt Creator (without modifying the OS configuration)?
QtCreator itself only modifies the environemt, i.e. it sets
export PATH="/home/<user>/Qt/5.10.0/gcc_64/bin:$PATH"
export QTDIR="/home/<user>/Qt/5.10.0/gcc_64"
This can be verified by checking the "Build Environment" section in the "Projects" tab. When checking the environment for the run configuration there is one more that is needed for the compiled applications to find the correct .so files (The build env. is used to run build tools. The run env. is used to run the compiled application).
export LD_LIBRARY_PATH="/home/<user>/Qt/5.10.0/gcc_64/lib:$LD_LIBRARY_PATH"
So in order to easily use qmake/... from the command line, just create a script that sets these (and possibly others you defined for your build in QtCreator) and source it before compiling and it should work.
source ~/qt-home-init.sh
qmake ...

environment variable in desktop is different from terminal?

I use qtcreator to build my project. When I use Terminal to open qtcreator and build the project, it works. However, when I use Desktop to Open qtcreator, it shows that can't not found the library.
Accurately, I add the libs to environment variable so that I can use it Makefile to build the project in Terminal.
So I am confused if the environment variable is different between Terminal and Desktop.
The qt project file is process.pro.
Oh, we found that when we run .desktop file, it does not contain bash environment. So adding bash -i -c in [Exec] can solve it.

How do you run non-GUI version of Inno Script Studio from bash?

I have a .iss file created in Inno Script Studio. It has a pre-compilation step which is a feature specific to Inno Script Studio. I can run my .iss file from a Command Prompt window (which is running cmd.exe, right?). The command looks like,
"\Program Files (x86)\Inno Script Studio\isstudio.exe" -compile myscript.iss
If instead, I run /c/system/windows32/cmd from a Git bash window and then try the same command I get an error popup with 'I/O Error 6'. Why? Through experimentation the problem seems to be with the myscript.iss argument: if I leave off that argument the isstudio simply complains that the argument is missing.
I have tried various escaping and quoting changes to the command but nothing fixes it. I tried running cmd in a fresh environment with env -i. I have tried providing the full path to the file using a DOS style path with C: and backslashes.
And I tried creating a .bat file with the above command in it: same error.

How to add a custom tool/command to tortoisehg in linux?

I am trying to trying to execute a shell command from tortiseHg. My end goal is to run a large shell command with {REV} being a parameter. Does anyone know of a way to do this?
I tried using the custom tools option in tortiseHg and it is not working for me.
No matter what I add as the command, It always returns:
The command "my command and args" could not be executed.
"No such file or directory"
Please check that the command path is valid and that it is a valid application
How to reproduce:
In tortoiseHg (linux), go to Settings> Tools > New Tool, add a new command.
Eg. touch /path/success.txt
Add tool to list
Restart thg
Click on the tool.
As lgriZdes mentioned in his answer, custom tool seems to accept only hg commands. Got around this issue by creating an alias in hg which executes a shell command, and calling this alias from custom tools. Let me know if you guys want more detailed info.
In old prehistoric versions of tortoisehg only hg commands were working. It is said here that now shell commands should work without problem How to add a custom tool/command to tortoisehg in linux?

Resources