Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile failures with clang-cl version 9 (MSVC 2019). #18

Closed
KineticTheory opened this issue Mar 28, 2020 · 3 comments
Closed

Compile failures with clang-cl version 9 (MSVC 2019). #18

KineticTheory opened this issue Mar 28, 2020 · 3 comments

Comments

@KineticTheory
Copy link
Contributor

FYI, I can't compile the current version of mdspan when using clang-cl.exe that ships with Visual Studio 2019 (LLVM clang version 9.0). The first couple of build errors are shown below.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\Llvm\bin\clang-cl.exe /c /Z7 /nologo /W0 /WX- /diagnostics:column /FS /Od /D WIN32 /D _WINDOWS /D _CRT_SECURE_NO_DEPRECATE /D _SCL_SECURE_NO_DEPRECATE /D _SECURE_SCL=0 /D DEBUG /D _DEBUG/MDd /D _DEBUG /D _HAS_ITERATOR_DEBUGGING=0 /D __STDC_CONSTANT_MACROS /D _POSIX_C_SOURCE=200112 /D _XOPEN_SOURCE=600 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /EHa /MDd /GS /Gy /fp:precise /std:c++14 /Fo"Ut_experimental_tst_mdspan_exe.dir\Debug\\" /Gd /TP -m64   /Zc:__cplusplus C:\work\KineticTheory\Draco\src\experimental\test\tst_mdspan.cc
           In file included from C:\work\KineticTheory\Draco\src\experimental\test\tst_mdspan.cc:12:
           In file included from C:\work\KineticTheory\Draco\src\experimental/mdspan:61:
C:\work\KineticTheory\Draco\src\experimental\__p0009_bits\array_workaround.hpp(112,3): error : too many arguments provided to function-like macro invocation 
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(150,3): message : expanded from macro 'MDSPAN_FUNCTION_REQUIRES' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(158,17): message : expanded from macro 'MDSPAN_TEMPLATE_REQUIRES' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(124,29): message : expanded from macro 'MDSPAN_PP_CAT' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
           note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
         (107,1): message : expanded from here [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(170,17): message : expanded from macro 'MDSPAN_TEMPLATE_REQUIRES_2' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(147,35): message : expanded from macro 'MDSPAN_CLOSE_ANGLE_REQUIRES' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(123,9): message : macro 'MDSPAN_PP_CAT_IMPL' defined here [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
           In file included from C:\work\KineticTheory\Draco\src\experimental\test\tst_mdspan.cc:12:
           In file included from C:\work\KineticTheory\Draco\src\experimental/mdspan:61:
C:\work\KineticTheory\Draco\src\experimental\__p0009_bits\array_workaround.hpp(112,3): error : unknown type name 'MDSPAN_PP_CAT_IMPL' 
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(150,3): message : expanded from macro 'MDSPAN_FUNCTION_REQUIRES' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(158,3): message : expanded from macro 'MDSPAN_TEMPLATE_REQUIRES' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
         C:\work\KineticTheory\Draco\src\experimental/__p0009_bits/macros.hpp(124,29): message : expanded from macro 'MDSPAN_PP_CAT' [C:\work\vs2019-x64-Clang-Debug\draco\src\experimental\test\Ut_experimental_tst_mdspan_exe.vcxproj]
           In file included from C:\work\KineticTheory\Draco\src\experimental\test\tst_mdspan.cc:12:
           In file included from C:\work\KineticTheory\Draco\src\experimental/mdspan:61:
@dhollman
Copy link
Contributor

Hmmm...this is interesting. It looks to me like clang-cl.exe may think that it's MSVC when it comes to preprocessing (since MSVC has some weird preprocessor behavior I had to account for). I don't have easy access to a Windows machine to test this, but I'll poke around and see what I can find.

@KineticTheory
Copy link
Contributor Author

@dhollman This is new territory for me too. Here is what I have found so far...

  • CMake's MSVC and WIN32 variables are both true for cl.exe and clang-cl.exe.
  • CMake's CMAKE_<LANG>_COMPILER_ID is MSVC or Clang for cl.exe and clang-cl.exe, respectively.

@dhollman
Copy link
Contributor

This was fixed in pull request #25. The problem was that clang sets the _MSC_VER variable even though it actually has a working C preprocessor, unlike MSVC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants