Bug 394334

Summary: Building target fails
Product: [Developer tools] clazy Reporter: ndurner
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED FIXED    
Severity: normal CC: smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description ndurner 2018-05-16 15:10:41 UTC
Hi,

the instructions for running clazy on Windows do not work for me (tried with Qt's Examples\Qt-5.10.1\widgets\mainwindows\application.

When I call
   qmake -spec linux-clang QMAKE_CXX="clazy-cl.bat"
on the Windows command line (Developer Command Prompt for VS 2017), I get:
	Info: creating stash file C:\Qt\5.10.1\Examples\Qt-5.10.1\widgets\mainwindows\.q
	make.stash
	Project ERROR: Cannot run compiler 'clang -Xclang -load -Xclang ClangLazy.dll -X
	clang -add-plugin -Xclang clang-lazy'. Output:
	===================
	'clang' is not recognized as an internal or external command,
	operable program or batch file.
	===================
	Maybe you forgot to setup the environment?
When I add the bin\clang subdirectory to the PATH, qmake works, but nmake fails with:
	Microsoft (R) Program Maintenance Utility Version 14.12.25830.2
	Copyright (C) Microsoft Corporation.  All rights reserved.

			cd application\ && ( if not exist Makefile c:\qt\5.10.1\5.10.1\msvc2015\
	bin\qmake.exe -o Makefile C:\Qt\5.10.1\Examples\Qt-5.10.1\widgets\mainwindows\ap
	plication\application.pro -spec linux-clang "QMAKE_CXX=clazy-cl.bat" ) && "C:\Pr
	ogram Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.12.25
	827\bin\HostX86\x86\nmake.exe" -f Makefile

	Microsoft (R) Program Maintenance Utility Version 14.12.25830.2
	Copyright (C) Microsoft Corporation.  All rights reserved.

			clazy-cl.bat -c -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGE
	TS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:\qt\5.10.1\5.10.1\msvc2015\include -IC
	:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets -IC:\qt\5.10.1\5.10.1\msvc2015\inc
	lude\QtGui -IC:\qt\5.10.1\5.10.1\msvc2015\include\QtANGLE -IC:\qt\5.10.1\5.10.1\
	msvc2015\include\QtCore -I. -IC:\qt\5.10.1\5.10.1\msvc2015\mkspecs\linux-clang -
	o main.obj main.cpp
	clang.exe: warning: unknown argument ignored in clang-cl: '-fPIC' [-Wunknown-arg
	ument]
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:45:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\type_traits:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xstddef:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\cstddef:8:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xtr1common(199,22) :  error:
		  use of undeclared identifier 'char16_t'
			struct _Is_integral<char16_t>
								^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xtr1common(205,22) :  error:
		  use of undeclared identifier 'char32_t'
			struct _Is_integral<char32_t>
								^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:45:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\type_traits:6:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xstddef(257,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Unfancy(_Ptrty _Ptr)
			^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:45:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\type_traits(898,47) :  error:
		  '_Ty' does not refer to a value
					: bool_constant<__is_trivially_destructible(_Ty)>
																^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\type_traits(896,16) :  note:
		  declared here
	template<class _Ty>
				   ^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\type_traits(899,2) :  error:
		  expected class name
			{       // determine whether _Ty has a trivial destructor
			^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:47:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\utility:7:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\iosfwd(356,21) :  error:
		  use of undeclared identifier 'char16_t'
			struct char_traits<char16_t>
							   ^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\iosfwd(365,21) :  error:
		  use of undeclared identifier 'char32_t'
			struct char_traits<char32_t>
							   ^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:110:

	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\algorithm:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xmemory:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xmemory0:8:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\limits(612,33) :  error:
		  use of undeclared identifier 'char16_t'
	template<> class numeric_limits<char16_t>
									^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\limits(902,33) :  error:
		  use of undeclared identifier 'char32_t'
	template<> class numeric_limits<char32_t>
									^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:110:

	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\algorithm:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xmemory:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xmemory0:10:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xutility(521,13) :  error:
		  deduced return types are a C++14 extension
					constexpr decltype(auto) operator()(_Args&&... _Vals)
							  ^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xutility(772,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Unchecked_n(_Iter _Src, _Diff)
			^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xutility(816,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Unchecked_n_backward(_Iter _Src, _Diff)
			^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xutility(1226,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Distance_any(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2...
			^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xutility(1280,12) :  error:
		  deduced return types are a C++14 extension
			constexpr decltype(auto) _Operator_arrow(_Iterator&& _Target, fa...
					  ^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:110:

	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\algorithm:6:
	In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterp
	rise\VC\Tools\MSVC\14.12.25827\include\xmemory:6:
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xmemory0(412,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Const_cast(_Ptrty _Ptr)
			^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\xmemory0(422,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Const_cast(_Ty * _Ptr)
			^
	In file included from main.cpp:52:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets\QApplicatio
	n:1:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qapplicatio
	n.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtWidgets/qtwidgetsgl
	obal.h:43:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtGui/qtguiglobal.h:4
	3:
	In file included from C:\qt\5.10.1\5.10.1\msvc2015\include\QtCore/qglobal.h:110:

	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\algorithm(2588,2) :  error:
		  'auto' return without trailing return type; deduced return types are a
		  C++14 extension
			auto _Idl_dist_add(_Diff1 _Lhs, _Diff2 _Rhs)
			^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\algorithm(3936,3) :  error:
		  statement not allowed in constexpr function
					while (++_First != _Last)
					^
	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.
	12.25827\include\algorithm(3972,3) :  error:
		  statement not allowed in constexpr function
					while (++_First != _Last)
					^
	fatal error: too many errors emitted, stopping now [-ferror-limit=]
	20 errors generated.
	NMAKE : fatal error U1077: 'c:\dev\clazy\bin\clazy-cl.bat' : return code '0x1'
	Stop.
	NMAKE : fatal error U1077: 'cd' : return code '0x2'
	Stop.

The instructions I am referring to are at
https://github.com/KDE/clazy/blob/master/README.md#3rdparty-pre-built-msvc2015-clang-and-clazy-binaries
and I am using the prebuilt 1.2 clazy binary.
Comment 1 Sergio Martins 2018-05-16 15:47:12 UTC
The -spec linux-clang is wrong, I need to update that section.

Try leaving out the -spec, or try win32-clang-msvc, or try win32-msvc.

Haven't tested with 2017, only 2015 though.
Comment 2 ndurner 2018-05-16 16:00:02 UTC
win32-clang-msvc vs. win32-msvc vs. no -spec doesn't make a difference for me, so I suppose it's a VC 2017 problem
Comment 3 Sergio Martins 2018-11-11 17:18:54 UTC
can you try with no spec at all ?

Did you build clazy and clang on your own ? Which clazy version did you try ?
Comment 4 ndurner 2018-11-15 16:57:18 UTC
(In reply to Sergio Martins from comment #3)
> can you try with no spec at all ?

Looking at comment #2, I think I did (but don't remember).
 
> Did you build clazy and clang on your own ? Which clazy version did you try ?

There's
 http://www.mirrorservice.org/sites/download.kde.org/stable/clazy/1.2/clazy_v1.2-msvc2015.zip
in my download history, but I don't remember this either. I did definitely not build clazy or clang myself.
Comment 5 Sergio Martins 2018-11-15 17:04:22 UTC
1.2 was built specifically for 2015

Here's 1.4: https://downloads.kdab.com/clazy/
both for 2015 and 2017