[Qt-creator] Linker probably picks up wrong LLVM libraries when linking Qt Creator 4.9

Andrzej Telszewski atelszewski at gmail.com
Sun Jul 28 13:33:09 CEST 2019

On 01/06/2019 13:28, Andrzej Telszewski wrote:
> On 28/05/2019 09:23, Eike Ziller wrote:
>>> On 28. May 2019, at 07:38, Andrzej Telszewski <atelszewski at gmail.com> 
>>> wrote:
>>> where:
>>> -L/usr/lib64
>>> is put before:
>>> -Wl,-rpath,/usr/libexec/qtcreator/clang/lib
>>> ?
>>> Uninstalling this system-wide version of LLVM for the time of 
>>> building Qt Creator allows it to compile and link just fine.
>>> Please advice.
>>> Patches welcome :-)
>>> Thanks in advance!
>> Your diagnosis sounds correct, so the question is where that -L path 
>> comes from. My guess that it’s from the mkspecs, but maybe running 
>> qmake with additional -d -d -d gives something useful?
>> Br, Eike
> Hi,
> I tried running qmake with -d -d -d and the output is enormous.
> My brain was not capable of parsing the text. Need to use a different 
> parser ;-)
> Anyway, I ended up in: _src/plugins/clangformat/Makefile_
> For the clarity of this conversation, I attach a patch showing what has 
> to be done in order to link correctly.
> Basically, the search directory for LLVM has to be placed before the 
> system libraries.
> Do you know a way to do it at the qmake stage, so that I don't have to 
> patch the Makefile?
> Help appreciated!

For the time being I solved the problem by passing the following to qmake:

QMAKE_LFLAGS="-L/usr/libexec/qtcreator/clang/lib -L/usr/lib$LIBDIRSUFFIX"

This way the supplied LLVM libdir is searched before the system-wide 
libdir and consequently correct version of LLVM libs are picked up.

($LIBDIRSUFFIX is "64" on 64-bit system and empty on 32-bit system).

Hope this helps!

If there's a better way, please let me know.


Best regards / Pozdrawiam,
Andrzej Telszewski

More information about the Qt-creator mailing list