external library linking problem in release compilation
Hello everyone!
I have an issue with project release. Qt shows an error that external HDF5 librairy cannot be accessed, however debugging goes well and I get no error message.
What maybe the difference for external libraries linking between release and debug modes?
Re: external library linking problem in release compilation
What platform? Windows? Linux? Other?
What development environment and toolchain? Qt Creator, CMake, Visual Studio?
On Windows with Visual Studio, all external libraries must be of the same "bitness" (32 or 64) and for C++ must all be either compiled in Debug mode (for a debug executable) or Release mode (for a release executable). This is because the name mangling done by the compiler to decorate class, method, and variable names is different between debug and release builds. I also think that all external libraries must be built with the same compiler; you cannot mix MSVC and gcc builds, for example.
Re: external library linking problem in release compilation
My OS is Linux Ubuntu, I use Qt Creator 18.0.0, Built on Oct 28 2025 10:06:27 based on Qt 6.10.0 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), x86_64) From revision 86fea009e7
When I try to launch release executable I get following message -
alik@alik-PowerEdge-R620:~/projects/build/Desktop_Qt_6_10_1-Release$ ./myproject
./myproject: error while loading shared libraries: libhdf5.so.103: cannot open shared object file: No such file or directory
Now both debug and release executable raise same error
Quote:
Originally Posted by
d_stranz
What platform? Windows? Linux? Other?
What development environment and toolchain? Qt Creator, CMake, Visual Studio?
On Windows with Visual Studio, all external libraries must be of the same "bitness" (32 or 64) and for C++ must all be either compiled in Debug mode (for a debug executable) or Release mode (for a release executable). This is because the name mangling done by the compiler to decorate class, method, and variable names is different between debug and release builds. I also think that all external libraries must be built with the same compiler; you cannot mix MSVC and gcc builds, for example.
My OS is Linux Ubuntu, I use Qt Creator 18.0.0, Built on Oct 28 2025 10:06:27 based on Qt 6.10.0 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), x86_64) From revision 86fea009e7
When I try to launch release executable I get following message -
alik@alik-PowerEdge-R620:~/projects/build/Desktop_Qt_6_10_1-Release$ ./myproject
./myproject: error while loading shared libraries: libhdf5.so.103: cannot open shared object file: No such file or directory
Now both debug and release executable raise same error
Added after 1 42 minutes:
So I am wondering, why project compilation in qt creator passes well and application windows opens normally, without any libraries issues, but debug and release executable fail to find library in the same /usr/local/hdf5/lib folder ?
Re: external library linking problem in release compilation
Quote:
So I am wondering, why project compilation in qt creator passes well and application windows opens normally, without any libraries issues, but debug and release executable fail to find library in the same /usr/local/hdf5/lib folder ?
Very often an IDE will set up additional PATH variables so it can locate shared libraries at runtime to aid in debugging, etc. Qt Creator probably added the path to your hdf5 library when you added it to the build configuration. This PATH may not be the same as the normal runtime environment PATH that you access from the command line (terminal) to execute the program outside of the IDE.
Check your PATH in a terminal window to make sure that your /usr/local/hdf5/lib folder is on the search path.