[Interest] Best practice to packages on Ubuntu with QtIF

Nikos Chantziaras realnc at gmail.com
Mon Feb 22 09:51:16 CET 2016


That will not work. The rpath needs to be $ORIGIN. A string. Not a 
variable that is expanded.

Also, I used the wrong syntax before. Escaping this string is difficult 
since it contains an "$". This should work:

   QMAKE_LFLAGS=-Wl,-rpath,\'\$\$ORIGIN\'

If you use that one, you should find that your program keeps working 
even if you move the directory that contains it and the libraries to 
somewhere else. With your current method, the program will only work if 
the libraries are in "/home/igor/Qt/5.5/gcc_64", a hardcoded path.


On 22/02/16 10:31, Igor Mironchik wrote:
> In my Makefile I have:
>
> LFLAGS        = -Wl,-O1 -Wl,-rpath,/home/igor/Qt/5.5/gcc_64
> -Wl,-rpath,${ORIGIN} -Wl,-rpath,/home/igor/Qt/5.5/gcc_64/lib
>
>
> On 22.02.2016 10:26, Nikos Chantziaras wrote:
>> That doesn't do anything useful. It just uses an absolute path. If you
>> move the executable to a different directory, it stops working.
>>
>> You can verify that by looking at the Makefile. For example, here, this:
>>
>>   QMAKE_RPATHDIR += ${ORIGIN}
>>
>> becomes:
>>
>>   -Wl,-rpath,/home/realnc/projects/myapp/
>>
>> Which is completely useless.
>>
>> Do do what you want, you really need to pass the string "$ORIGIN" to
>> the linker:
>>
>>   QMAKE_LFLAGS += -Wl,-rpath,\$\$ORIGIN
>>
>> This results in:
>>
>>   -Wl,-rpath,$ORIGIN
>>
>> in the Makefile.
>>
>>
>> On 22/02/16 09:13, Igor Mironchik wrote:
>>> Hi,
>>>
>>> Got it:
>>>
>>> QMAKE_RPATHDIR += ${ORIGIN}
>>>
>>> On 22.02.2016 10:11, Nikos Chantziaras wrote:
>>>> On 22/02/16 08:55, Igor Mironchik wrote:
>>>>> On 22.02.2016 09:22, Koehne Kai wrote:
>>>>>>
>>>>>> You should rather utilize rpath, and set it e.g. to $ORIGIN
>>>>>>
>>>>>> https://en.wikipedia.org/wiki/Rpath
>>>>>
>>>>> Interesting, but "QMAKE_RPATHDIR += ." doesn't work. It require full
>>>>> path to work correctly...
>>>>
>>>> qmake doesn't support it. You have to do it by hand:
>>>>
>>>>   QMAKE_LFLAGS += -Wl,-rpath,\$\$ORIGIN/libs
>>>>
>>>> And then I put all libraries in the "lib" directory of the
>>>> execututable.
>>>>
>>>> (And this is obviously linker and platform specific.)
>>>>
>>>> _______________________________________________
>>>> Interest mailing list
>>>> Interest at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>





More information about the Interest mailing list