Results 1 to 4 of 4

Thread: external library linking problem in release compilation

  1. #1
    Join Date
    Feb 2016
    Posts
    15
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,341
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default 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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Feb 2016
    Posts
    15
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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 View Post
    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 ?
    Last edited by abshaev; Yesterday at 09:15.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,341
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: external library linking problem in release compilation

    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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. External library linking problem
    By ayanda83 in forum Qt Programming
    Replies: 1
    Last Post: 6th March 2017, 13:34
  2. Replies: 3
    Last Post: 27th August 2015, 19:30
  3. Problem with compilation in release mode.
    By code_err in forum Newbie
    Replies: 3
    Last Post: 22nd October 2011, 18:02
  4. Replies: 5
    Last Post: 9th June 2011, 12:22
  5. QLibrary, problem with using external dll, in release
    By Jeddite in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2010, 10:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.