[Qt-creator] Bundling clang (for code model) with qt-creator package

Eike Ziller Eike.Ziller at qt.io
Wed Aug 31 09:12:03 CEST 2016


> On Aug 31, 2016, at 6:07 AM, Andrzej Telszewski <atelszewski at gmail.com> wrote:
> 
> On 29/08/16 08:40, Nikolai Kosjar wrote:
>> Hi!
>> 
>> On 08/28/2016 03:05 AM, Andrzej Telszewski wrote:
>>> Hi,
>>> 
>>> As mentioned here:
>>> https://blog.qt.io/blog/2016/08/25/qt-creator-4-1-0-released/ it might
>>> be valuable to use clang 3.8.1 with Qt Creator 4.1.0.
>>> 
>>> But my system's llvm package is at version 3.8.0 and will stay like that
>>> for quite some time.
>> 
>> Note that there is hardly any difference between llvm 3.8.0 and 3.8.1
>> when it comes to the clang code model. The changes between 3.8.0 and
>> 3.8.1 look all backend-specific, but we use only the frontend.
>> 
>> For some reason the mentioned patch in the blog post is not part of the
>> official 3.8.1 release, but of our shipped build.
>> 
> 
> What would be your suggestion as of using 3.8.1 (when it comes to the code model of course)?
> Does it make any sense to switch to it or is it fine to stay with 3.8.0?
> Please note, I'm targeting Linux platform only, so the MSVC patch is irrelevant for me.
> 
>>> As I don't want to update the system's llvm, I would like to package
>>> version 3.8.1 of llvm together with qt-creator, for the purpose of Code
>>> Model (is there anything else internal to Qt Creator that uses llvm?).
>> 
>> The Clang Static Analyzer plugin needs the clang executable + the
>> intrinsics headers (currently installed, e.g. for Linux at
>> ${QTCREATOR_INSTALL_ROOT}/share/qtcreator/cplusplus/clang/3.8.1/include).
>> 
>>> I see two solutions:
>>> 1. Create separate package for llvm, something like "qt-creator-llvm"
>>> that installs under non-system wide directory and then, when building Qt
>>> Creator, adjust LLVM_INSTALL_DIR to point to that directory.
>>> 2. Create single package containing both llvm and Qt Creator.
>>> 
>>> Solution 1) is straightforward, in that I can first build and install
>>> qt-creator-llvm and then build and install qt-creator.
>>> 
>>> Solution 2) requires that I can somehow point the qt-creator
>>> LLVM_INSTALL_DIR to the temporary directory where the llvm has been
>>> installed for the purpose of packaging. But once the packaging has been
>>> finished, LLVM_INSTALL_DIR has to point to a different directory,
>>> relative to the package installation directory and not package creation
>>> directory.
>>> 
>>> I would much preferred the second solution.
>>> So the question is: is it possible?
>> 
>> I'm not sure I understand the requirements needed for this, but we do
>> this is already for our official packages.
>> 
>> Build Qt Creator with LLVM_INSTALL_DIR set and install it (see link
>> below). The relevant parts of the LLVM_INSTALL_DIR will be copied over
>> to Qt Creator's installation directory (+ adapting the rpath etc.).
>> 
> 
> I'm thinking of the following _pseudo_ build and packaging instructions:
> 
> $ mkdir /tmp/package-qt-creator
> 
> LLVM:
> $ cmake \
>    -DCMAKE_INSTALL_PREFIX=/usr/libexec/qtcreator/llvm
> $ make install DESTDIR=/tmp/package-qt-creator
> 
> QTC:
> $ qmake-qt5 qtcreator.pro \
>    QTC_PREFIX=/usr \
>    LLVM_INSTALL_DIR=/tmp/package-qt-creator/usr/libexec/qtcreator/llvm
> $ make install INSTALL_ROOT=/tmp/package-qt-creator
> 
> Then I create a package out of /tmp/package-qt-creator and once it's installed, the paths will look like that:
> 
> /usr/bin/qtcreator
> /usr/libexec/qtcreator/llvm
> (..)
> 
> Is this the correct path :-) to follow?

The default path that the clang static analyzer checks is libexec/qtcreator/clang/ (+bin/clang etc)
http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp#n61

> 
> 
>> 
>> http://wiki.qt.io/Building_Qt_Creator_from_Git#Installing_Qt_Creator_.28optional.29
>> 
> 
> Is it possible you provide me the full build script/instructions you're using to build the official binary package for Linux?

Our clang build:
http://code.qt.io/cgit/qtsdk/qtsdk.git/tree/packaging-tools/build_clang.py

Deployment into Qt Creator binary packages:
http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/scripts/deployqt.py?h=4.1#n200

Br, Eike

> I would like to see the exact configuration flags and which source code tarballs of LLVM are needed for the code model and static analyzer.
> The point is that I probably don't need to build the fully fledged LLVM/Clang compiler set, but as you mentioned before, only part of it should be sufficient.
> 
>> 
>> 
>> Nikolai
>> 
>> 
> 
> Many thanks!
> 
> -- 
> Best regards,
> Andrzej Telszewski
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B






More information about the Qt-creator mailing list