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 ...
Related
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.
Hi I have QtInstalled with the official qt installer (I haven't used the package with the name "qtcreator").
I need to run QtCreator from terminal but I can't locate the executable.
I'm using Ubuntu 16.04.
Probably you can find the executable in opt directory the location will be as this /opt/Qt/Tools/QtCreator/bin and you can run it through terminal as ./qtcreator
Latest QtCreator should by default be installed in
${HOME}/Qt/Tools/QtCreator/bin/
And you have two start-up options, the executable qtcreator or the shell script qtcreator.sh
To run the executable, type
~/Qt/Tools/QtCreator/bin/qtcreator
To run the shell script, type
~/Qt/Tools/QtCreator/bin/qtcreator.sh
Whic one to use: From the top portion of qtcreator.sh, it states that if you have library name conflicts (such as having same library names used by qtcreator with your own LD_LIBRARY_PATH), you may want to start with the shell script, rather than the bare executable.
Windows linux subsystem users
In case you have ubuntu as a subsystem for win10, it's located in your AppData folder (installing with sudo apt install command):
Also, you cannot run qtcreator from terminal as graphical interface is not supported by defeault. You need to instal X-server app first (https://sourceforge.net/projects/xming/) and then you can run QT from terminal.
C:\Users\[YOUR_USERNAME]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\qtcreator
Or, it's in usr/lintian/overrides
But you should not modify anything inside this linux root, as it may lead to data loss.
For me it wasn't in the /opt directory, but rather the location I've chosen in the /home/user/ directory.
More specifically: /home/user/Qt5.12.1/Tools/QtCreator/bin/qtcreator
I use swig from my within Android.mk. I reference it directly relying on the $PATH variable to contain the path to it's executable.
The issue is that the $PATH variable is different depending on where the android-ndk tool is run from.
Background
In my Android.mk file:
# some stuff ...
#echo "$(PATH)"
swig # swig parameters here...
# more stuff ...
From the terminal, we see the system path includes the path to swig:
which swig
/usr/local/bin/swig
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
Issue
When the android-ndk is run from within Android Studio I get the following for PATH (note: it's missing the swig path):
/usr/bin:/bin:/usr/sbin:/sbin
This causes my build to fail because "swig" isn't recognised:
make: swig: Command not found
However, if I run the android-ndk directly from the terminal, then the PATH used is the same as my system path and the build works fine:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
Bad solution
Yes, I could add the path manually to my Android.mk file:
export PATH:=/usr/local/bin/:$(PATH)
However, I'd prefer not to define specific paths for my machine knowing that the whole team uses this file.
Question
I'd prefer the Android.mk file to use my systems PATH instead.
Any ideas how to do this?
Thanks!
The thing in my opinion is that environment variables may be different whether the process is launched from terminal or from the GUI (launchpad, spotlight, ...).
The former would use PATH as set in bashrc (or other shell related startup files) while the other will not.
I think you might find interesting information on how to change the environment variables for the launch deamon in the following question:
Setting environment variables in OS X?
I installed libffi-3.0.11, because another program needs that. But after the installation the other program (by calling the comand ./configure)don't recognize that libffi is installed. Do I have to set a environment variable? Or are all variables set automatically?
usually there is a LIBPATH, you should try to include the directory where your lib resided into this path. In addition, if you have a default bash
export LIBPATH=/your/libffi/path:$LIBPATH
I highly recommend to put this into a script and load it whenever you login automatically so that you don't need to repeat this step
/home/yourhome/.profile <- make sure you insert it into this file and its loaded automatically
Here is a guide how to do the task:
http://archive.linuxfromscratch.org/lfs-museum/5.1-pre1/LFS-BOOK-5.1-PRE1-HTML/chapter06/glibc.html
The parameter you probably need is the following:
./configure --libexecdir=/usr/lib:
If you have installed the libffi library properly this should completely solve your problem.
It depends, if you install libffi on /usr/local you should probably set the includes dir of the app you want to configure to /usr/local.
For the new app, try ./configure --prefix=/usr/local. To see the options of configure, use ./configure --help. Can you show the example of what is not running ?
I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux
Then I configured C::B with
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
and ran
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
When trying to run C::B, I get the following error:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.
The output of wx-config --prefix is /opt/wx/2.8,
The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,
and that of which wx-config is /opt/wx/2.8/bin/wx-config.
I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.
What might be wrong here?
The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:
LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks
The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.
Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.
If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.
You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps
If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.
Approach 1: Putting the path in .bashrc
gedit /home/{your-username}/.bashrc
Then after the line # User specific aliases and functions paste the following
export $LD_LIBRARY_PATH=/usr/local/lib.
This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.
Approach 2: Creating your own conf files
cd /etc/ld.so.conf.d
gedit wxformbuilder.conf
Give the path /usr/local/lib and save the file.
ldconfig (To update the library path).