Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-13 Thread domin144
This patch works for me.
--- a/src/libs/clangsupport/CMakeLists.txt
+++ b/src/libs/clangsupport/CMakeLists.txt
@@ -5,8 +5,8 @@
   PUBLIC_DEPENDS Utils Sqlite Qt5::Core Qt5::Network
   PUBLIC_DEFINES
 CLANG_VERSION="${CLANG_VERSION}"
-CLANG_INCLUDE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
-CLANG_BINDIR="${IDE_LIBEXEC_PATH}/clang/bin"
+CLANG_INCLUDE_DIR="${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include"
+CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}"
   DEFINES CLANGSUPPORT_BUILD_LIB
   PUBLIC_INCLUDES
 "${CMAKE_CURRENT_LIST_DIR}"


Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-09 Thread Alexis Murzeau
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=amd64=4.14.0-2=1608716918=0
https://buildd.debian.org/status/fetch.php?pkg=qtcreator=amd64=4.14.0-1=1608260627=0


-- 
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC  2787 E7BD 1904 F480 937F|



signature.asc
Description: OpenPGP digital signature


Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-08 Thread Michael Weghorn



Thanks for the quick reply!

On 08/01/2021 17.28, Pino Toscano wrote:

qtcreator 4.14.0-2 has been available in unstable (which you use) for
more than two weeks, so reading this problem now seems slightly
awkward. Have you used qtcreator 4.14.0-2 (and it code model)
successfully so far in the past two weeks?


I'm usually using testing (and use unstable for double-checking before 
reporting bugs) and haven't really used qtcreator since Christmas as far 
as I can remember. (The package migrated to testing on 2020-12-28.)




My suspect is the upload of llvm-toolchain-11 done yesterday, and your
package list:

ii  libclang1-11   1:11.0.1-2

show you updated to it.
Can you please try to backport your LLVM/Clang 11 packages to the same
version used to build qtcreator? You can get the list of installed
packages using:
$ dpkg -l '*llvm*11*' | grep ^ii
$ dpkg -l '*clang*11*' | grep ^ii
and then use the `debsnap` tool, part of the devscripts package, to
download them, e.g.:
$ debsnap -d . -a amd64 libclang-11 1:11.0.1~+rc2-1
(you will need to repeat that for all the packages you have installed,
removing the :amd64 suffix in the packages that have multi-arch
annotations).


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



Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-08 Thread Roman Lebedev
On Fri, Jan 8, 2021 at 7:29 PM Pino Toscano  wrote:
>
> In data venerdì 8 gennaio 2021 16:52:02 CET, Michael Weghorn ha scritto:
> > Package: qtcreator
> > Version: 4.14.0-2
> > Severity: normal
> > X-Debbugs-Cc: m.wegh...@posteo.de
> >
> > Dear Maintainer,
> >
> > since version 4.14.0-2, Qt Creator's Clang Code Model is unable to find the
> > 'stddef.h' header. It still works OK with version 4.14.0-1.
>
> qtcreator 4.14.0-2 has been available in unstable (which you use) for
> more than two weeks, so reading this problem now seems slightly
> awkward. Have you used qtcreator 4.14.0-2 (and it code model)
> successfully so far in the past two weeks?
Not original bugreporter, but i've been having this issue for at least one week.

> My suspect is the upload of llvm-toolchain-11 done yesterday, and your
> package list:
> > ii  libclang1-11   1:11.0.1-2
> show you updated to it.
> Can you please try to backport your LLVM/Clang 11 packages to the same
> version used to build qtcreator? You can get the list of installed
> packages using:
> $ dpkg -l '*llvm*11*' | grep ^ii
> $ dpkg -l '*clang*11*' | grep ^ii
> and then use the `debsnap` tool, part of the devscripts package, to
> download them, e.g.:
> $ debsnap -d . -a amd64 libclang-11 1:11.0.1~+rc2-1
> (you will need to repeat that for all the packages you have installed,
> removing the :amd64 suffix in the packages that have multi-arch
> annotations).
>
> Thanks,
> --
> Pino Toscano



Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-08 Thread Pino Toscano
In data venerdì 8 gennaio 2021 16:52:02 CET, Michael Weghorn ha scritto:
> Package: qtcreator
> Version: 4.14.0-2
> Severity: normal
> X-Debbugs-Cc: m.wegh...@posteo.de
> 
> Dear Maintainer,
> 
> since version 4.14.0-2, Qt Creator's Clang Code Model is unable to find the
> 'stddef.h' header. It still works OK with version 4.14.0-1.

qtcreator 4.14.0-2 has been available in unstable (which you use) for
more than two weeks, so reading this problem now seems slightly
awkward. Have you used qtcreator 4.14.0-2 (and it code model)
successfully so far in the past two weeks?

My suspect is the upload of llvm-toolchain-11 done yesterday, and your
package list:
> ii  libclang1-11   1:11.0.1-2
show you updated to it.
Can you please try to backport your LLVM/Clang 11 packages to the same
version used to build qtcreator? You can get the list of installed
packages using:
$ dpkg -l '*llvm*11*' | grep ^ii
$ dpkg -l '*clang*11*' | grep ^ii
and then use the `debsnap` tool, part of the devscripts package, to
download them, e.g.:
$ debsnap -d . -a amd64 libclang-11 1:11.0.1~+rc2-1
(you will need to repeat that for all the packages you have installed,
removing the :amd64 suffix in the packages that have multi-arch
annotations).

Thanks,
-- 
Pino Toscano

signature.asc
Description: This is a digitally signed message part.


Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-08 Thread Roman Lebedev
I'm also experiencing this problem.

On Fri, 08 Jan 2021 16:52:02 +0100 Michael Weghorn  wrote:
> Package: qtcreator
> Version: 4.14.0-2
> Severity: normal
> X-Debbugs-Cc: m.wegh...@posteo.de
>
> Dear Maintainer,
>
> since version 4.14.0-2, Qt Creator's Clang Code Model is unable to find the
> 'stddef.h' header. It still works OK with version 4.14.0-1.
>
> Sample steps to reproduce:
>
> * create a simple C++ project with a source file that
>   (directly or indirectly) includes 'stddef.h',
>   e.g. via "File" -> "New File or Project" -> "Plain C++ Application"
>   (or use files from sample project at the end)
> * open the source file 'main.cpp'
> * if not present yet, add an '#include ' or '#include stddef.h'
>
> Result:
>
> A warning shows up:
>
> > Warning: The code model could not parse an included file, which might lead 
> > to
> incorrect code completion and highlighting, for example.
> >
> > wchar.h:35:10: error: 'stddef.h' file not found
> > [...]
>
> and the Code Model does not work properly.
>
> It works again as expected when downgrading to qtcreator 4.14.0-1.
>
>
> Files for sample project to reproduce the issue:
>
> main.cpp:
>
> #include 
>
> using namespace std;
>
> int main()
> {
> cout << "Hello World!" << endl;
> return 0;
> }
>
> CMakeLists.txt:
>
> cmake_minimum_required(VERSION 3.5)
>
> project(testp-project LANGUAGES CXX)
>
> set(CMAKE_CXX_STANDARD 11)
> set(CMAKE_CXX_STANDARD_REQUIRED ON)
>
> add_executable(testp-project main.cpp)
>
>



Bug#979577: qtcreator: Clang Code Model no longer finds 'stddef.h' since version 4.14.0-2

2021-01-08 Thread Michael Weghorn
Package: qtcreator
Version: 4.14.0-2
Severity: normal
X-Debbugs-Cc: m.wegh...@posteo.de

Dear Maintainer,

since version 4.14.0-2, Qt Creator's Clang Code Model is unable to find the
'stddef.h' header. It still works OK with version 4.14.0-1.

Sample steps to reproduce:

* create a simple C++ project with a source file that
  (directly or indirectly) includes 'stddef.h',
  e.g. via "File" -> "New File or Project" -> "Plain C++ Application"
  (or use files from sample project at the end)
* open the source file 'main.cpp'
* if not present yet, add an '#include ' or '#include stddef.h'

Result:

A warning shows up:

> Warning: The code model could not parse an included file, which might lead to
incorrect code completion and highlighting, for example.
>
> wchar.h:35:10: error: 'stddef.h' file not found
> [...]

and the Code Model does not work properly.

It works again as expected when downgrading to qtcreator 4.14.0-1.


Files for sample project to reproduce the issue:

main.cpp:

#include 

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(testp-project LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(testp-project main.cpp)



-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-1-amd64 (SMP w/2 CPU threads)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages qtcreator depends on:
ii  clang-11   1:11.0.1-2
ii  libc6  2.31-9
ii  libclang1-11   1:11.0.1-2
ii  libdw1 0.182-3
ii  libelf10.182-3
ii  libgcc-s1  10.2.1-3
ii  libkf5syntaxhighlighting5  5.77.0-2
ii  libqt5concurrent5  5.15.2+dfsg-2
ii  libqt5core5a [qtbase-abi-5-15-2]   5.15.2+dfsg-2
ii  libqt5designer55.15.2-3
ii  libqt5designercomponents5  5.15.2-3
ii  libqt5gui5 5.15.2+dfsg-2
ii  libqt5help55.15.2-3
ii  libqt5network5 5.15.2+dfsg-2
ii  libqt5printsupport55.15.2+dfsg-2
ii  libqt5qml5 [qtdeclarative-abi-5-15-2]  5.15.2+dfsg-2
ii  libqt5quick5   5.15.2+dfsg-2
ii  libqt5quickwidgets55.15.2+dfsg-2
ii  libqt5serialport5  5.15.2-2
ii  libqt5sql5 5.15.2+dfsg-2
ii  libqt5sql5-sqlite  5.15.2+dfsg-2
ii  libqt5svg5 5.15.2-2
ii  libqt5widgets5 5.15.2+dfsg-2
ii  libqt5xml5 5.15.2+dfsg-2
ii  libstdc++6 10.2.1-3
ii  libyaml-cpp0.6 0.6.3-9
ii  libzstd1   1.4.8+dfsg-1
ii  qml-module-qtqml-models2   5.15.2+dfsg-2
ii  qml-module-qtquick-controls5.15.2-2
ii  qml-module-qtquick25.15.2+dfsg-2
ii  qtchooser  66-2
ii  qtcreator-data 4.14.0-2

Versions of packages qtcreator recommends:
ii  clang-tidy1:11.0-51+nmu1
ii  gdb-minimal [gdb] 10.1-1.7
ii  gnome-terminal [x-terminal-emulator]  3.38.1-2
ii  konsole [x-terminal-emulator] 4:20.12.1-1
ii  make  4.3-4
ii  qmlscene  5.15.2+dfsg-2
ii  qt5-doc   5.15.2-2
ii  qt5-qmltooling-plugins5.15.2+dfsg-2
ii  qtbase5-dev-tools 5.15.2+dfsg-2
ii  qtcreator-doc 4.14.0-2
ii  qtdeclarative5-dev-tools  5.15.2+dfsg-2
ii  qttools5-dev-tools5.15.2-3
ii  qttranslations5-l10n  5.15.1-2
ii  qtxmlpatterns5-dev-tools  5.15.2-2

Versions of packages qtcreator suggests:
pn  clazy   
ii  cmake   3.18.4-1+b1
ii  g++ 4:10.2.0-1
ii  git 1:2.30.0-1
ii  meson   0.56.1-1
pn  subversion  
pn  valgrind

-- no debconf information