How do I run my Qt application on another linux machine? - qt

I compiled a Qt application on a linux machine using Qt 5.6.2. It runs perfectly on that machine.
I copied the binaries on another 64bit machine. I used aptitude search libqt5 to find what Qt libraries should I install. I installed libqt5core5a and libqt5network5 packages. But when I run my program, I get this error:
darker2:~/workspace (master) $ ./server
./server: /usr/lib/x86_64-linux-gnu/libQt5Network.so.5: no version information available (required by ./server)
./server: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./server)
./server: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./server)
./server: relocation error: ./server: symbol qt_version_tag, version Qt_5.6 not defined in file libQt5Core.so.5 with link time reference
I suppose the problem here really is that the version does not match exactly. So, how do I install the very exact version that I used to compile my program? Note that I am very limited with disk space on the target virtual machine. I need to only install whatever is necessary.
The more universal solution, the better, for the sake of future readers.

You need to deploy the application, for this purpose I use the utility
cqtdeployer
You can install from github releases
or
from snapstore
sudo snap install cqtdeployer
You can use as follows:
cqtdeployer -bin myApp -qmake path/to/my/qmake -qmlDir path/to/my/qml/files/dir
And Run application with sh script
If you'll use the version from snap then make sure that you have all the permissions.

Related

How to Install qt4 on macOS with homebrew?

I need to install the qt4 C++ framework for one of my classes. I tried using the regular installer from the download archives page for both qt4.7 and qt4.8, however I get the warning:
"Installing this package may damage your system, and the installation may fail."
So I looked into installing it via homebrew and initially tried:
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt#4
However, that gives me this error:
Error: Calling brew tap-pin user/tap is disabled! Use fully-scoped user/tap/formula naming instead.
I looked online for a solution and was able to install it by omitting the brew tap-pin cartr/qt4 command:
brew tap cartr/qt4
brew install qt#4
I then tried to create a sample qt program in the CLion IDE and checked the version I was using, and it said I was using qt5 (from the python anaconda distribution). So my question is, can I install both qt4 and qt5 on my system simultaneously? How do I select which version to use?
You can install both simultaneously. You can select which to use.
When you install qt (meaning qt5) using homebrew, it produces a "Caveats" message that answers your question.
It says will need to set certain environment variables yourself.
It says that, in only those shell sessions where you set those environment variables, qt (meaning qt5) will be available.
It says, if you want qt always available, then you can simply put those settings in your dot files.
If you install qt#4 and set those same variables to point to qt#4, then qt#4 will be available instead.
You can view the same "Caveats" message again using brew info qt. Here is the whole message:
qt is keg-only, which means it was not symlinked into /usr/local,
because Qt 5 has CMake issues when linked.
If you need to have qt first in your PATH run:
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc
For compilers to find qt you may need to set:
export LDFLAGS="-L/usr/local/opt/qt/lib"
export CPPFLAGS="-I/usr/local/opt/qt/include"
For pkg-config to find qt you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"
The same commands with qt#4 made qt#4 available for me:
export PATH="/usr/local/opt/qt#4/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/qt#4/lib"
export CPPFLAGS="-I/usr/local/opt/qt#4/include"
export PKG_CONFIG_PATH="/usr/local/opt/qt#4/lib/pkgconfig"
By the way, I installed qt#4 using the user/tap/formula syntax: brew install cartr/qt4/qt#4

How can I compile RpostgreSQL with libssl and libpg and SSL activation

I am using R on Windows to connect to a PostgreSQL database hosted on AWS. The database is set up using forcessl = 1 - this means that any connection needs to be set up with sslmode=require.
The base RPostgreSQL package does not provide any exposure to ssl options. This has been raised as an issue many times (see here, here, here and here)
I know there is a workaround using the RPostgres package, but for other functionality reasons I would much prefer to use the RPostgreSQL package.
A few answers (e.g. here) have proposed using a modified dbname to connect with ssl like so:
dbConnect(dbDriver('PostgreSQL'),
dbname = 'dbname=foobar sslmode=require', # modified dbname
host = 'foobar.rds.amazonaws.com',
port = 5439,
user = 'foobar',
password = 'foobar')
But this did not work for me using the CRAN version of the package. This led me to a recent issue raised on the RPostgreSQL github: https://github.com/tomoakin/RPostgreSQL/issues/88
The initial user was able to use the modified dbname method when he compiled the package from source. On Windows, using the latest source package (0.6.2) compiled with RTools, I get the following error when I run the modified dbname code:
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect xxxxx.rds.amazonawss.com:5432 on dbname "xxxxxxx": sslmode value "require" invalid when SSL support is not compiled in
)
From this and the rest of the thread, it looks like SSL is not possible from current source in both Windows and Mac. However, the developer suggests:
If you compile in a environment where libssl and libpq was made SSL activated form, then the driver can use SSL.
I think this means I could manually download the libs and compile myself, but I am not sure if it is a quick fix or if it would require significant rewriting of the package. Any help or pointing in the right direction would be much appreciated. How can I do this in a safe, repeatable way?
I was able to solve this for the El Capitan macOS R users in my office, by doing the following:
Remove RPostgreSQL R package if you already have installed. Methods vary on how to do this, but from either R.app console or R in Terminal, type remove.packages('RPostgreSQL')
Make sure you have Homebrew installed, and from Terminal run: brew install libpq openssl
Open R.app, and from the Packages & Data menu, select Package Installer.
From the first drop-down menu, choose CRAN (sources) (choose mirror closest to you if you haven't used this before).
Using package search, find RPostgreSQL and for the options below, keep At System Level checked, and check Install Dependencies, then click Install Selected.
Quit out of all R and RStudio programs, and try using the new from source installed RPostgreSQL package.
DISCLAIMER: If you have heavy compile dependencies on OpenSSL or libpq for other programs, I have no idea how doing the above may break other programs.
Building on Windows is a can of worms. See R-Admin Windows Toolset. The only openSSL binaries for windows are from unknown developers. Building and installing openSSL on windows is another can of worms that you will need to research. It might be easier to install openSSL inside the R Windows build environment, but I have no experience with that.
EDIT: It turns out that when installing postgres on Windows, postgres installs openSSL. That means that the central problem on Windows is installing the Windows Toolset for R, installing postgres, then pointing the R build system to libpq.
Another solution would be to run linux in a virtual machine under windows. Here is one way to Install linux on Windows. With linux, depending on the distribution, you would only need to do something like the following from the linux command line (for a RedHat variant of linux):
sudo yum install openSSL
sudo yum install postgresql96
sudo yum install R
Line 2 installs libpq which is required for RPostgreSQL. It is libpq which must be compiled with openSSL. You will only be installing and using the PostgreSQL client, not the server and will also get psql. There might be other packages required, see R linux toolset. Normally, these will get pulled in with the above and should not be a problem.
RPostgreSQL contains a version of libpq, but the compile script does not look like it checks for openSSL, at least not on macOS. So it is important to get a system provided libpq installed.
It is also important for the RPostgreSQL configure script to find pg_config, which is installed when postgres client is installed. Not sure about windows through. So make sure pg_config is in your path. Type pg_config to find out.
Now you need to download and compile RPostgreSQL. To start R, type the following at the linux terminal.
R
Then from within R, get, compile and install RPostgreSQL:
install.packages("https://cran.r-project.org/src/contrib/RPostgreSQL_0.6-2.tar.gz", repo=NULL, type="source")
This should compile and install this version of RPostgreSQL. This last line should also work in windows if you have the windows tools installed correctly.
Hopefully, this gives you some ideas.

Compiling third party libraries with Qt

I've been using OpenCV and Marble libraries compiled and linked with Qt. Every time I do it I have problems running cmake to make these libraries. it seems paths in the qt cmake files to other qt cmake files are incorrect. I get errors like:
CMake Error at CMakeLists.txt:67 (find_package):
By not providing "FindQt5DBus.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5DBus", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5DBus" with any
of the following names:
Qt5DBusConfig.cmake
qt5dbus-config.cmake
Add the installation prefix of "Qt5DBus" to CMAKE_PREFIX_PATH or set
"Qt5DBus_DIR" to a directory containing one of the above files. If
"Qt5DBus" provides a separate development package or SDK, be sure it has
been installed.
I can fix this in Ubuntu by running
sudo apt-get install qt5-default
This is fine in Ubuntu, but now I am trying to compile these libraries on mac and windows now. Anyone know a way to get a Qt with all of these paths already correct? tried the installer on windows and mac, and brew on mac. I don't really have time to play with fixing each one of these errors one by one
At least Qt 5.5 on Windows (using the Qt installer) should work out of the box. It has DBus included. Which Qt version are you using currently?

QtWebKit gstreamer1.0 not found

I want to compile PhantomJS with gstreamer. I downloaded the source code and started the build process with
./build.sh --qmake-args WEBKIT_CONFIG+='use_gstreamer'
I get the following Error
Project ERROR: gstreamer-1.0 development package not found
I have an debian 8.0 system with installed libgstreamer1.0 and glib2.0 (installed with apt-get).
Can someone help me?
If you haven't installed them, you'll need the development packages as well which should be something like libgstreamer(X.X.X)-dev, where X.X.X is whichever version of gstreamer you have installed. The development package has the necessary header files required for compilation.
you may need to modify the build script to add "{GStreamerInstallDir}/1.0/{architecture}/lib/pkgconfig" to the CMAKE_MODULE_PATH configuration so cmake can find the package.
Not sure how to do this in your environment as I build on a windows OS where I just specify this using an environment variable from a wrapping batch script.

installation HDBC-SQlite3 Haskell

Im facing the problem during installation :
>>setup configure
Configuring HDBC-sqlite3-2.3.0.0...
setup: Missing dependency on a foreign library:
* Missing C library: sqlite3
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
what should I do ?
thanks for any help
OK,
I downloaded sqlite3.dll and sqlite3.h from source zip.
then I inserted sqlite3.dll in system32 dir and in setup configure i used
--extra-lib-dirs=... --extra-include-dirs=... parameters with correct paths to header and dll.
You need to install the C library implementation and headers of SQLite.
On Ubuntu and other Debian-based Linux distros, it's simply
sudo apt-get install sqlite3 libsqlite3-dev
Other Linux distros will have similarly named packages.
On Windows, you'll have to do some more work.
On OS X, I have no idea.

Resources