Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. linking .so file

linking .so file

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 256 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by JacobNovitsky
    #1

    When I'm trying to link my so objects from Qt inner terminal or External gnome terminal from my CPP app it does not work, has no effect

    if I set if from gnome-terminal it works nicely

    I made simple build function but it only works if I loop it and copy then paste manually to gnome-terminal

    if there any way to fix it?

    j@j:~/QUI-Debug$ cd /home/j/QUI-Debug && export LD_LIBRARY_PATH=/home/j/QPL-Debug/debug/debug:/home/j/SPL-Debug/debug/debug:/home/j/SML-Debug/debug/debug:$LD_LIBRARY_PATH
    j@j:~/QUI-Debug$ ldd QUI
    linux-vdso.so.1 (0x00007ffedabd8000)
    libSpl.so.1 => /home/j/SPL-Debug/debug/debug/libSpl.so.1 (0x00007fe78f188000)
    libSml.so.1 => /home/j/SML-Debug/debug/debug/libSml.so.1 (0x00007fe78efd7000)

    chunk below did not help either

    const char* paths[] = {
    "/home/j/SPL-Debug/debug/debug",
    "/home/j/SML-Debug/debug/debug"
    };

    std::string ld_library_path;
    for (const char* path : paths) {
        if (!ld_library_path.empty()) ld_library_path += ":";
        ld_library_path += path;
    }
    
    cout << "ld_library_path:" << ld_library_path <<endl;
    
    setenv("LD_LIBRARY_PATH", ld_library_path.c_str(), 1);
    
    J 1 Reply Last reply
    0
    • J JacobNovitsky

      When I'm trying to link my so objects from Qt inner terminal or External gnome terminal from my CPP app it does not work, has no effect

      if I set if from gnome-terminal it works nicely

      I made simple build function but it only works if I loop it and copy then paste manually to gnome-terminal

      if there any way to fix it?

      j@j:~/QUI-Debug$ cd /home/j/QUI-Debug && export LD_LIBRARY_PATH=/home/j/QPL-Debug/debug/debug:/home/j/SPL-Debug/debug/debug:/home/j/SML-Debug/debug/debug:$LD_LIBRARY_PATH
      j@j:~/QUI-Debug$ ldd QUI
      linux-vdso.so.1 (0x00007ffedabd8000)
      libSpl.so.1 => /home/j/SPL-Debug/debug/debug/libSpl.so.1 (0x00007fe78f188000)
      libSml.so.1 => /home/j/SML-Debug/debug/debug/libSml.so.1 (0x00007fe78efd7000)

      chunk below did not help either

      const char* paths[] = {
      "/home/j/SPL-Debug/debug/debug",
      "/home/j/SML-Debug/debug/debug"
      };

      std::string ld_library_path;
      for (const char* path : paths) {
          if (!ld_library_path.empty()) ld_library_path += ":";
          ld_library_path += path;
      }
      
      cout << "ld_library_path:" << ld_library_path <<endl;
      
      setenv("LD_LIBRARY_PATH", ld_library_path.c_str(), 1);
      
      J Offline
      J Offline
      JacobNovitsky
      wrote on last edited by
      #2

      @JacobNovitsky below seem to solve this task

      #!/bin/bash

      Set the directories containing the shared object files

      SPL_DIR="/home/j/SPL-Debug/debug/debug"
      SML_DIR="/home/j/SML-Debug/debug/debug"
      QPL_DIR="/home/j/QPL-Debug/debug/debug"

      Concatenate the directories with the current LD_LIBRARY_PATH

      export LD_LIBRARY_PATH="$SPL_DIR:$SML_DIR:$QPL_DIR:$LD_LIBRARY_PATH"

      Print the current LD_LIBRARY_PATH for verification

      echo "LD_LIBRARY_PATH is set to: $LD_LIBRARY_PATH"

      Use ldd to show the shared libraries used by the QUI application

      ldd /home/j/QUI-Debug/QUI

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved