How install qt libraries near to executable file - qt

There was such a problem: using cmake to install the compiled executable in a certain directory, along with all the dependent libraries (qt), so that later this folder could be simply transferred to another computer, with the same architecture (and installed packages, like built-essential). And do it on two systems: linux & windows. And there are two problems:
what are the dependencies of Qt libraries and how to identify them with cmake (if it possible)?
when using install(FILES $<TARGET_FILE:Qt5::some_packet> DESTINATION bin) on Linux, the following libraries will be copied: libQt5some_packet.so.5.11.1 and when you try to start the program, it will immediately declare that it cannot find the corresponding libraries. And the command export LD_LIBRARY_PATH=/install path/bin haven't any result.
UDP i find how fix problem 2:
install(FILE $<TARGET_SONAME_FILE:Qt::some_package> DESTINATION bin)
but first problem (for windows) is open.

You can use Dependency Walker to get the complete list of dll dependencies

Related

Compiling R from source: RStudio doesn't find the libraries if started directly

I have compiled R 4.1.0 from source against the Intel MKL.
I have put:
source /opt/intel/oneapi/mkl/latest/env/vars.sh intel64
in ~/.bashrc.
If I open a .R file with RStudio, no problem.
But if I open RStudio directly, it is unable to start R correctly, giving me the error:
/usr/lib/rstudio/bin/rsession: error while loading shared libraries: libmkl_gf_lp64.so.1: cannot open shared object file: No such file or directory
Why is that? Doesn't RStudio run ~/.bashrc when started directly?
I am running Fedora 34 Workstation.
When shared libraries are stored in "non-standard locations" we have to tell the dynamic linker about it. That is sometimes done in the calling script (often the case with bundled software, e.g. when you download RStudio which ships with a fair number of local builds of shared libraries) but a more general solution is to tell ldconfig via its configuration.
Older systems used a line per directory in /etc/ld.so.conf. Newer systems generalize this (like many other configurations) with a directory containing small files with entries. So you can create a file named, say, /etc/ld.so.conf.d/local-mkl.conf, and place the directory path in there. If you then run sudo ldconfig all applications will know about it -- including R and RStudio calling R.

libsqlite3 issue: I am not able to use cl-sql

I am trying to use cl-sql for database access to sqlite3.
But I am getting the error
Couldn't load foreign libraries "libsqlite3", "sqlite3". (searched CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*: (#P"/usr/lib/clsql/" #P"/usr/lib/"))
The same is with sqlite.
I have installed sqlite3 using apt-get and there is a file libsqlite.so.0 in /usr/lib directory.
I also tried to build sqlite3 from source but I couldn't get the so file. What is that I am doing wrong?
Your problem is that cl-sql has a third party dependency. If you inspect the implementation of cl-sql (probably under "~/quicklisp/dists/quicklisp/software/clsql-202011220-git/db-sqlite3/sqlite3-loader.lisp") you will see that the function database-type-load-foreign is trying to load a library named either "libsqlite3" or "sqlite3".
Depending on your operating system this is either looking for a .dll or .so with exactly one of those names.
Given that the version of of libsqlite.so has a different name on your particular distribution of linux, you have a number of different options to make this library work.
Install a version of sqlite3 with the correct binary
Create a soft link to your binary that redirects via ln -s /usr/lib/libsqlite.so.0 /usr/lib/libsqlite3.so (assuming libsqlite.so.0 is the file that clsql is looking for)
Add new paths to CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS* to point to the correct binary if it is installed elsewhere (via clsql:push-libary-path)

GLEW program can't find libglew.so even when file exists

I am trying to set up an OpenGL development environment on a Linux machine (Mint 17). I have just installed GLEW from the source on the GLEW source forge page (Downloaded source; extracted; make install).
I want to check that everything is set up correctly and am trying to run a test program. My program compiles and links but when I try to run it I get the error "error while loading shared libraries: libGLEW.so.1.12: cannot open shared object file: No such file or directory"
libGLEW.so.1.12 exists; from what I read I think I have a 32bit executable and the SO is 64bit. However I can't find a solution to this problem; I know I need to create a 32bit library but I can't find any instructions for doing this.
Can someone please provide instructions to either (or preferably both):
Install 32bit libraries for GLEW
Link with GLEW statically
Preferably I'd like to link statically for now (I find it far more convenient for testing) but the instructions on the GLEW website only say how to do this for windows. Eventually I do plan to link everything dynamically.

Compiling haskell module Network on win32/cygwin

I am trying to compile Network.HTTP (http://hackage.haskell.org/package/network) on win32/cygwin. However, it does fail with following message:
Setup.hs: Missing dependency on a foreign library:
* Missing (or bad) header file: HsNet.h
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.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Unfortuntely it does not give more clues. The HsNet.h includes sys/uio.h which, actually should not be included, and should be configurered correctly.
Don't use cygwin, instead follow Johan Tibells way
Installing MSYS
Install the latest Haskell Platform. Use the default settings.
Download version 1.0.11 of MSYS. You'll need the following files:
MSYS-1.0.11.exe
msysDTK-1.0.1.exe
msysCORE-1.0.11-bin.tar.gz
The files are all hosted on haskell.org as they're quite hard to find in the official MinGW/MSYS repo.
Run MSYS-1.0.11.exe followed by msysDTK-1.0.1.exe. The former asks you if you want to run a normalization step. You can skip that.
Unpack msysCORE-1.0.11-bin.tar.gz into C:\msys\1.0. Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of C:\msys\1.0, unpack it there, and then rename the copy back to C:\msys\1.0.
Add C:\Program Files\Haskell Platform\VERSION\mingw\bin to your PATH. This is neccesary if you ever want to build packages that use a configure script, like network, as configure scripts need access to a C compiler.
These steps are what Tibell uses to compile the Network package for win and I have used this myself successfully several times on most of the haskell platform releases.
It is possible to build network on win32/cygwin. And the above steps, though useful (by Jonke) may not be necessary.
While doing the configuration step, specify
runghc Setup.hs configure --configure-option="--build=mingw32"
So that the library is configured for mingw32, else you will get link or "undefined references" if you try to link or use network library.
This combined with #Yogesh Sajanikar's answer made it work for me (on win64/cygwin):
Make sure the gcc on your path is NOT the Mingw/Cygwin one, but the
C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe
(Run
export PATH="/cygdrive/.../ghc-7.8.2/mingw/bin:$PATH"
before running cabal install network in the Cygwin shell)

none of fink macports and homebrew useful on lion?

I have an library (flam3) that depends on a few utility libraries from unix (xml2, jpeg, png, z) and I am trying to make an application on Lion that uses it. I am building with the latest Xcode and when I try to link with the libraries from fink, macports, and homebrew I get the same error:
ld: warning: ignoring file /opt/local/lib/libxml2.a, file was built
for archive which is not the architecture being linked (i386)
and the libraries look different from ones that work:
bash-3.2$ file /sw/lib/libxml2.a
/sw/lib/libxml2.a: current ar archive random library
by comparision
bash-3.2$ file ~/Documents/FLAM3/libflam3.a
/Users/spot/Documents/FLAM3/libflam3.a: Mach-O universal binary with 2
architectures
/Users/spot/Documents/FLAM3/libflam3.a (for architecture x86_64):
current ar archive random library
/Users/spot/Documents/FLAM3/libflam3.a (for architecture i386):
current ar archive random library
that's the library that I compiled with Xcode.
Is there any way to get Xcode to accept this library? Is there any way to get fink/macports/homebrew to generate a library that works with Xcode? Seems like I am "doing it wrong" as these projects would all be useless if everyone had this problem.... but I don't feel like I've done anything unusual. Help?
The problem is that your libxml2.a is not built as "Universal binary". I.e. it doesn't contain all necessary architectures (In your case I believe it is i386). You need to ask fink, macports, or homebrew to build/download/install library with all necessary platforms. I know that macports has such flag (I don't remember how it's called).
The "file" command list all available architectures for .a file only when the file is trully universal (contains two or more of ppc, i386, x86_64), otherwise it only shows the vanilla "ar archive..." message. That confirms your libxml2.a has only one architecture.
The problem is not in Xcode or Lion. Possibly the default link architecture on Lion changed.

Resources