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. Qmake flags
Qt 6.11 is out! See what's new in the release blog

Qmake flags

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.7k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mike4
    wrote on last edited by
    #1

    Hi
    I've searched but cannot find any description for -Wl and -rpath. And why not use those flags with g++?
    Also why \
    Thanks
    Michael

    QMAKE_LFLAGS += -g -Wl,-rpath,\\\$\$ORIGIN/liblinux/
    
    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Please see:

      http://doc.qt.nokia.com/latest/qmake-variable-reference.html#qmake-rpath
      and
      http://doc.qt.nokia.com/latest/qmake-variable-reference.html#qmake-rpathdir

      The -Wl,-rpath part just tells the compiler to pass through the option "-rpath" to the linker.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mike4
        wrote on last edited by
        #3

        Thanks, now how to set $ORIGIN? Compilation is at a different location than execution. But it's always in a folder in same directory as the exeutable. ( ./liblinux/libtoinclude.so )

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexisdm
          wrote on last edited by
          #4

          $ORIGIN always represents the directory of the executable. But it doesn't limit you to directory inside the executable directory: you can use, for example, "$ORIGIN/../lib" to put your libraries in a lib directory at the same level as you executable folder:
          @.
          |-- bin
          | -- myexecutable -- lib
          `-- libtoinclude.so
          @

          If the path you want to add is absolute, don't use $ORIGIN, start your path with / (or you could rely on /etc/ld.so.conf to find the correct installed libraries in the default system paths).

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mike4
            wrote on last edited by
            #5

            Thanks now I get a dlerror. Are my includes wrong or how to use the lib without linking? (the lib is GPL so I cannot directly link)
            Many thanks
            Michael

            unix:!macx {
            INCLUDEPATH += ./
            ...
            QMAKE_LFLAGS += -g -Wl,-rpath,\$$ORIGIN
            }

            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