Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2
Alexis Murzeau
Sat, 09 Jan 2021 18:15:25 -0800
Hi,
On Fri, 8 Jan 2021 17:49:57 +0100 Michael Weghorn wrote:>
> The issue is still reproducible after downgrading the LLVM/Clang
> packages this way.
>
> It disappears when downgrading qtcreator and qtcreator-data to 4.14.0-1,
> though.
>
> Michael
>
>
I have the same behavior, qtcreator 4.14.0-1 works fine, but upgrading
qtcreator to 4.14.0-2 (without upgrading any other package) cause
highlighting errors about stddef.h.
So to sum up details bellow, the issue comes from bad values in
CLANG_INCLUDE_DIR define.
CLANG_INCLUDE_DIR, CLANG_BINDIR and RELATIVE_LIBEXEC_PATH have different
path than before, partially caused by a probably wrong IDE_LIBEXEC_PATH
cmake variable.
Upstream has made a change to use system paths, probably helping with bad
IDE_LIBEXEC_PATH value:
https://bugreports.qt.io/browse/QTCREATORBUG-25142
https://codereview.qt-project.org/c/qt-creator/qt-creator/+/328958
Commit in 4.14 branch: c81baf1a9cc938a283f6c52c8fd10bab84183391
This can be backported maybe, but fixing CLANG_INCLUDE_DIR and probably
CLANG_BINDIR is still required to make the clang code model work again.
Details below:
By debugging clangbackend with a breakpoint on clang_parseTranslationUnit2,
and then printing args.m_arguments from
TranslationUnitUpdater::createTranslationUnitIfNeeded
I've found that:
qtcreator 4.14.0-1 has "-isystem" "/usr/lib/llvm-11/lib/clang/11.0.1/include"
qtcreator 4.14.0-2 has "-isystem" "" instead
This path comes from the CLANG_INCLUDE_DIR preprocessor define used in
clangutils.cpp in LibClangOptionsBuilder constructor.
That define is set by qmake/cmake and has this value:
qtcreator 4.14.0-1 has
-D"CLANG_INCLUDE_DIR=\"/usr/lib/llvm-11/lib/clang/11.0.1/include\""
qtcreator 4.14.0-2 has
"-DCLANG_INCLUDE_DIR=\"libexec/qtcreator/clang/lib/clang/11.0.1/include\""
I guess the "libexec/qtcreator/clang/lib/clang/11.0.1/include" doesn't
exist and is replaced by an empty string somewhere and this explains why
it becomes empty in clangbackend process.
CLANG_INCLUDE_DIR is set in src/libs/clangsupport/CMakeLists.txt:
CLANG_INCLUDE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
and in src/shared/clang/clang_defines.pri:
CLANG_INCLUDE_DIR=$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)
So while moving from qmake to cmake, the path became wrong, probably
because cmake scripts assume clang is bundled with qtcreator while qmake
scripts use LLVM_LIBDIR.
By checking the compiler command line used to compile clangutils.cpp,
there is other variables that have differences:
4.14.0-1:
-DCLANG_BINDIR=\"/usr/lib/llvm-11/bin\""
-DCLANG_INCLUDE_DIR=\"/usr/lib/llvm-11/lib/clang/11.0.1/include\""
-DRELATIVE_LIBEXEC_PATH="../lib/x86_64-linux-gnu/qtcreator/libexec"
4.14.0-2:
-DCLANG_BINDIR=\"libexec/qtcreator/clang/bin\"
-DCLANG_INCLUDE_DIR=\"libexec/qtcreator/clang/lib/clang/11.0.1/include\"
-DRELATIVE_LIBEXEC_PATH=\"../libexec/qtcreator\"
See build logs here:
https://buildd.debian.org/status/fetch.php?pkg=qtcreator&arch=amd64&ver=4.14.0-2&stamp=1608716918&raw=0
https://buildd.debian.org/status/fetch.php?pkg=qtcreator&arch=amd64&ver=4.14.0-1&stamp=1608260627&raw=0
--
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC 2787 E7BD 1904 F480 937F |
signature.asc
Description: OpenPGP digital signature
Previous message
View by thread
View by date
Next message
Bug#979577: qtcreator: Clang Code Model no long... Michael Weghorn
Bug#979577: qtcreator: Clang Code Model no... Roman Lebedev
Bug#979577: qtcreator: Clang Code Model no... Pino Toscano
Bug#979577: qtcreator: Clang Code Mode... Roman Lebedev
Bug#979577: qtcreator: Clang Code Mode... Michael Weghorn
Bug#979577: qtcreator: Clang Code ... Alexis Murzeau
Bug#979577: qtcreator: Clang Code Model no... domin144
Bug#979577: marked as done (qtcreator: Cla... Debian Bug Tracking System
Reply via email to
|