Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    [Solved] How to make relative Qt library path in linux?

    Installation and Deployment
    7
    8
    13275
    Loading More Posts
    • 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.
    • Z
      zither last edited by

      Dear all,

      In Windows deployment, place Qt lib files (*.dll) in same folder with .exe works fine.
      In Mac, we can make relative library address to executable binary files.

      ႈIn Linux, it needs to deploy library files (*.so) into /usr/lib/..
      Is there any methods, to place relative address from binary file to library files like in Windows?

      Thanks

      1 Reply Last reply Reply Quote 0
      • L
        lgeyer last edited by

        "This":http://labs.qt.nokia.com/2011/10/28/rpath-and-runpath/ article might help you - and "RPATH":http://en.wikipedia.org/wiki/Rpath in general.

        1 Reply Last reply Reply Quote 0
        • M
          mkoskim last edited by

          [quote author="zither" date="1320502037"]Dear all,
          In Linux, it needs to deploy library files (*.so) into /usr/lib/..
          Is there any methods, to place relative address from binary file to library files like in Windows?[/quote]

          In Linux, libraries are searched from system directories and directories specified in LD_LIBRARY_PATH environment variable. For security reasons, Linux does not normally search libraries from user directories. You may modify it before loading your program - add "." to it, and libraries are searched from current working directory:

          @$ LD_LIBRARY_PATH=. ./myProgram@

          If you want to make a program that does it automatically, start your program from script, or write a program to modify the variable and then launch the actual program.

          http://mkoskim.wordpress.com
          http://mkoskim.drivehq.com
          http://mkoskim.deviantart.com

          1 Reply Last reply Reply Quote 0
          • D
            dangelog last edited by

            See also http://doc.qt.nokia.com/4.7/deployment-x11.html#creating-the-application-package

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply Reply Quote 0
            • B
              baysmith last edited by

              Use $ORIGIN in the executable's rpath. For example, add the following to your qmake project file.
              @
              unix:!mac{
              QMAKE_LFLAGS += -Wl,--rpath=\$$ORIGIN
              QMAKE_RPATH=
              }
              @
              Setting the QMAKE_RPATH clears the default rpath setting for the Qt libraries. This allows for bundling the Qt libraries with the application. If you want the rpath to include the path to the Qt libraries, don’t set QMAKE_RPATH.

              Nokia Certified Qt Specialist.

              1 Reply Last reply Reply Quote 0
              • Z
                zither last edited by

                The way I want is to make relative address to application without effecting system variables.

                I solve the problem with @Bradley said.

                Thanks to all

                1 Reply Last reply Reply Quote 0
                • B
                  BorisSclauzero last edited by

                  Hi zither,

                  [quote author="zither" date="1320502037"]In Mac, we can make relative library address to executable binary files.[/quote]

                  Can you explain me how to do this?
                  It's about two days that I am stuck with this problem.

                  Thanks in advance
                  Boris

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    Hi,

                    Please don't revive old thread that are almost 3 years old.

                    That said, have a look at the install_name_tool command. It's what is used on OS X (and e.g. macdeployqt)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post