Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Modularized QT application - my program can't find .so files



  • I'm writing modularized application using QtCreator and QT 5.10. The program is being compiled using CLANG toolkit on an instance of GhostBSD (FreeBSD derivative).

    My program consists of serveral .so modules (let's say file1.so and file2.so) linked using -L option and the main binary.

    The problem I have is I can't start the main binary, because the program loader can't find file1.so and file2.so even if they are in the same directory as the main program.

    So the question is, how to install an output files (.so) into /usr/lib directory?
    My very first idea was to call make install as an extra build step, but it needs root.
    How to do that correctly?


  • Lifetime Qt Champion


  • Lifetime Qt Champion

    @BSDUser said in Modularized QT application - my program can't find .so files:

    The problem I have is I can't start the main binary, because the program loader can't find file1.so and file2.so even if they are in the same directory as the main program.

    On Windows it would work that way, but Unix explicitely forbidds loading libraries from the working directory - for security resaon. You can however, force the linker to load them anyway, e.g. by modifying LD_LIBRARY_PATH.

    So the question is, how to install an output files (.so) into /usr/lib directory?
    My very first idea was to call make install as an extra build step, but it needs root.

    Correct, but for testing that's not needed. Creator automatically extends LD_LIBRAY_PATH if the linker options are correctly set. So can you please show your projects .pro file?

    Regards


Log in to reply