can't build with clang on windows
reported here https://github.com/conan-io/conan-center-index/issues/9835
When does the problem happen
- [x] During build
- [ ] During run-time
- [ ] When capturing a hard crash
Environment
Package Name/Version: sentry-crashpad/0.4.14 Operating System+version: windows 10 Compiler+version: clang 12 Conan version: conan 1.46.0
Steps To Reproduce conan install sentry-crashpad/0.4.14@ --build missing -pr clang
sentry-crashpad/0.4.14: Copying sources to build folder sentry-crashpad/0.4.14: Building your package in D:.conan\ff5f25\1 sentry-crashpad/0.4.14: Generator cmake created conanbuildinfo.cmake sentry-crashpad/0.4.14: Aggregating env generators sentry-crashpad/0.4.14: Calling build() sentry-crashpad/0.4.14: Found Visual Studio 16
** Visual Studio 2019 Developer Command Prompt v16.11.11 ** Copyright (c) 2021 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x64'
----Running------
cd D:.conan\ff5f25\1\build_subfolder && cmake -G "Ninja" -DCONAN_LINK_RUNTIME="/MD" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="12" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCMAKE_INSTALL_PREFIX="D:.conan\684af1\1" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DCRASHPAD_ENABLE_INSTALL="True" -DCRASHPAD_ENABLE_INSTALL_DEV="True" -DCRASHPAD_ZLIB_SYSTEM="True" -Wno-dev D:.conan\ff5f25\1
-- The C compiler identification is Clang 12.0.0 with MSVC-like command-line -- The CXX compiler identification is Clang 12.0.0 with MSVC-like command-line -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Conan: called by CMake conan helper -- Conan: called inside local cache -- Conan: Adjusting output directories -- Conan: Using cmake global configuration -- Conan: Adjusting default RPATHs Conan policies -- Conan: Adjusting language standard -- Conan: Compiler Clang>=8, checking major version 12 -- Conan: Checking correct version: 12 -- Found ZLIB: D:/.conan/storage/zlib/1.2.11///package/e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc/lib/zlib.lib (found version "1.2.11") -- The ASM_MASM compiler identification is MSVC -- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/ml64.exe -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:
CMAKE_EXPORT_NO_PACKAGE_REGISTRY
-- Build files have been written to: D:/.conan/ff5f25/1/build_subfolder sentry-crashpad/0.4.14: Found Visual Studio 16
** Visual Studio 2019 Developer Command Prompt v16.11.11 ** Copyright (c) 2021 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x64'
----Running------
cmake --build D:.conan\ff5f25\1\build_subfolder -- -j12
[58/175] Building CXX object source_subfolder\external\crashpad\snapshot\CMakeFiles\crashpad_snapshot.dir\win\system_snapshot_win.cc.obj FAILED: source_subfolder/external/crashpad/snapshot/CMakeFiles/crashpad_snapshot.dir/win/system_snapshot_win.cc.obj C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\Llvm\x64\bin\clang-cl.exe /nologo -TP -DCRASHPAD_LSS_SOURCE_EMBEDDED -DCRASHPAD_ZLIB_SOURCE_SYSTEM -DNOMINMAX -DUNICODE -DWIN32_LEAN_AND_MEAN -DZLIB_CONST -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_UNICODE -ID:.conan\storage\zlib\1.2.11__\package\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc\include -I..\source_subfolder\external\crashpad -I..\source_subfolder\external\crashpad\third_party\mini_chromium\mini_chromium -I..\source_subfolder\external\crashpad\compat\win -I..\source_subfolder\external\crashpad\third_party\mini_chromium /DWIN32 /D_WINDOWS /GR /EHsc -m64 /MD /O2 /Ob2 /DNDEBUG /wd4201 -Wno-unknown-attributes /FS /W4 /WX /bigobj /wd4100 /wd4127 /wd4324 /wd4351 /wd4577 /wd4996 -std:c++14 /showIncludes /Fosource_subfolder\external\crashpad\snapshot\CMakeFiles\crashpad_snapshot.dir\win\system_snapshot_win.cc.obj /Fdsource_subfolder\external\crashpad\snapshot\CMakeFiles\crashpad_snapshot.dir\crashpad_snapshot.pdb -c -- ..\source_subfolder\external\crashpad\snapshot\win\system_snapshot_win.cc ..\source_subfolder\external\crashpad\snapshot\win\system_snapshot_win.cc(97,55): error: missing field 'dwMajorVersion' initializer [-Werror,-Wmissing-field-initializers] OSVERSIONINFOEX version_info = {sizeof(version_info)}; ^ 1 error generated. [69/175] Building CXX object source_subfolder\external\crashpad\util\CMakeFiles\crashpad_util.dir\file\file_writer.cc.obj ninja: build stopped: subcommand failed. sentry-crashpad/0.4.14: sentry-crashpad/0.4.14: ERROR: Package 'd7795b001c531c02924943b0987aa8ac0b822520' build failed sentry-crashpad/0.4.14: WARN: Build folder D:.conan\ff5f25\1 ERROR: sentry-crashpad/0.4.14: Error in build() method, line 101 cmake.build() ConanException: Error 1 while executing cmake --build D:.conan\ff5f25\1\build_subfolder -- -j12
This looks like a problem with upstream crashpad. We should update our fork soon anyway, though not sure that will magically fix this issue.
Is the -Wmissing-field-initializers flag specific to the conan build?
Also, crashpad upstream suppresses a bunch of MSVC warnings, and I see those supression flags are listed in the above command line as well. (eg /wd4100 /wd4127 /wd4324 etc).
I wonder if this specific warning is being suppressed using one of these flags explicitly, and it would just be a matter of duplicating that when building with clang.
it's not conan specific, no. clang has it's own warnings list, different from one in MSVC
In this case, warning's name is 'missing-field-initializers'