Building from Source - std::atomic issue with VS2015
-
I am setting up a new machine and having a bear of a time getting QT to configure correctly to build from source.
I am using these options:
configure -debug-and-release -opensource -recheck-all -confirm-license -platform win32-msvc2015 -skip qtwebengine
and I keep getting this error:
ERROR: detected a std::atomic implementation that fails for function pointers.
Please apply the patch corresponding to your Standard Library vendor, found in
qtbase/config.tests/atomicfptrWhat is the most frustrating is that on my first try it worked, during the compile I hit the wrong thing and rebooted the machine. I got errors when I tried to resume the compile up reboot, so I did a clean and tried again and I have never been able to get past this error. What am I missing?
-
Make sure you try it with recent Qt version like 5.9.6 or 5.11. Also, make sure you install all updates to your Visual Studio. Microsoft's compilers are known to have some bugs and missing features that do not play well with Qt.
Since it worked the first time - try removing the whole build dir (and source dir, since you are doing an in-source build), and start completely fresh.
-
@sierdzio Thank you for reminding me about the updates... It was compiling BEFORE running updates on VS2015, afterwards, not so lucky :( When I get back to the system I will go through install of VS2015 again and make sure I have everything C++ related installed.
Any idea what exactly std::atomic is and why there might be issues with it? I am wondering if there is something in particular I should be looking for ;)
-
@Surly said in Building from Source - std::atomic issue with VS2015:
Any idea what exactly std::atomic is and why there might be issues with it? I am wondering if there is something in particular I should be looking for ;)
Simplifying: atomic operations are things that are guaranteed to be done in single CPU cycle - it can be used to synchronize threads without using mutexes. See, for example the docs for QAtomicInteger.
The problem with MSVC is that their implementation of std:atomic is missing/ buggy. Qt has a fallback implementation for compilers which do not support
std::atomic
, thought I don't remember how to turn it back on. You can as on Qt interest mailing list, Qt devs often discuss atomics there and should be able to help. -
I uninstalled VS2015 and reinstalled and got things building! Now I am getting the following error regarding compiling what looks to be bluetooth libraries, which I do NOT need. What is the configuration option to turn them off?
The options I used are:
Command line: -debug-and-release -opensource -confirm-license -platform win32-msvc2015 -skip qtwebengine
cl -c -FIQtBluetoothDepends -YuQtBluetoothDepends -Fp.pch\debug\Qt5Bluetoothd_pch.pch -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -utf-8 /wd4530 /wd4577 -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 /Fd.obj\debug\Qt5Bluetoothd.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_WINRT_BLUETOOTH -DCLASSIC_APP_BUILD -DQT_WINRT_LIMITED_SERVICEDISCOVERY -DQT_UCRTVERSION=10240 -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_BLUETOOTH_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_CORE_LIB -D_WINDLL -I. -I..\..\include -I..\..\include\QtBluetooth -I..\..\include\QtBluetooth\5.11.0 -I..\..\include\QtBluetooth\5.11.0\QtBluetooth -Itmp -IC:\Qt\5.11.0\qtbase\include\QtCore\5.11.0 -IC:\Qt\5.11.0\qtbase\include\QtCore\5.11.0\QtCore -IC:\Qt\5.11.0\qtbase\include -IC:\Qt\5.11.0\qtbase\include\QtCore -I.moc\debug -IC:\Qt\5.11.0\qtbase\mkspecs\win32-msvc -Fo.obj\debug\ @C:\Users\sam\AppData\Local\Temp\nmDB77.tmp qbluetoothdevicediscoveryagent_winrt.cpp .\qbluetoothdevicediscoveryagent_winrt.cpp(457): error C2065: 'IBluetoothLEDevice2': undeclared identifier .\qbluetoothdevicediscoveryagent_winrt.cpp(457): error C2923: 'Microsoft::WRL::ComPtr': 'IBluetoothLEDevice2' is not a valid template type argument for parameter 'T' .\qbluetoothdevicediscoveryagent_winrt.cpp(457): error C2133: 'device2': unknown size .\qbluetoothdevicediscoveryagent_winrt.cpp(457): error C2512: 'Microsoft::WRL::ComPtr': no appropriate default constructor available C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt\wrl\client.h(172): note: see declaration of 'Microsoft::WRL::ComPtr' .\qbluetoothdevicediscoveryagent_winrt.cpp(458): error C2672: 'Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>::As': no matching overloaded function found .\qbluetoothdevicediscoveryagent_winrt.cpp(458): error C2784: 'HRESULT Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>::As(Microsoft::WRL::ComPtr<U> *) throw() const': could not deduce template argument for 'Microsoft::WRL::ComPtr<U> *' from 'Microsoft::WRL::ComPtr *' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt\wrl\client.h(439): note: see declaration of 'Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>::As' .\qbluetoothdevicediscoveryagent_winrt.cpp(458): error C2784: 'HRESULT Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>::As(Microsoft::WRL::Details::ComPtrRef<Microsoft::WRL::ComPtr<U>>) throw() const': could not deduce template argument for 'Microsoft::WRL::Details::ComPtrRef<Microsoft::WRL::ComPtr<U>>' from 'Microsoft::WRL::ComPtr *' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt\wrl\client.h(432): note: see declaration of 'Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>::As' .\qbluetoothdevicediscoveryagent_winrt.cpp(461): error C2678: binary '->': no operator found which takes a left-hand operand of type 'Microsoft::WRL::ComPtr' (or there is no acceptable conversion) C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt\wrl\client.h(335): note: could be 'Details::RemoveIUnknown<T>::ReturnType *Microsoft::WRL::ComPtr<T>::operator ->(void) throw() const' .\qbluetoothdevicediscoveryagent_winrt.cpp(461): note: while trying to match the argument list '(Microsoft::WRL::ComPtr)' .\qbluetoothdevicediscoveryagent_winrt.cpp(461): error C2039: 'get_DeviceInformation': is not a member of 'Microsoft::WRL::ComPtr' C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt\wrl\client.h(172): note: see declaration of 'Microsoft::WRL::ComPtr' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.
-
-
@Surly said in Building from Source - std::atomic issue with VS2015:
What is the configuration option to turn them off?
-skip qtconnectivity
-
Nice! Happy coding :-)
-
Turns out there is one more question... I am upgrading from 4.8.4 to 5.11.0. Both live in C:\Qt\4.8.4 and C:\Qt\5.11.0. Upon compiling 4.8.4 there is a C:\Qt\4.8.4\bin, but with 5.11.0 the only bin directory is within qtbase: C:\Qt\5.11.0\qtbase\bin.
The VS2015 Addon was looking for the bin directory the same place it was for 4.8.4. Did I get a configuration option wrong that prevented the top level bin directory from being created?
-
I wonder... why not use the pre-built Qt from installers? They do support VS2015, too.
Anyway, back to the topic: I have not worked on Windows for several years now, so I can't say with certainty. But on Linux, after
configure
,make
andmake install
is run, the directory is still <prefix>/bin, same as in Qt 4.8. Perhaps you forgot to install? Depending on whether you are using-prefix
or not, that step may be required or unnecessary. Check last lines ofconfigure
output, it usually says ifinstall
needs to be run or not.