Skip to content

BUG: Cannot build C++ project using MSVC 2019 and OpenBLAS #3661

Closed
@larsoner

Description

@larsoner

On VS2019, trying to build using MSVC I get errors like the following:

[1/86] Building CXX object OpenMEEGMaths\CMakeFiles\OpenMEEGMaths.dir\src\vector.cpp.obj
FAILED: OpenMEEGMaths/CMakeFiles/OpenMEEGMaths.dir/src/vector.cpp.obj 
C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DH5_BUILT_AS_DYNAMIC_LIB -DHAVE_BLAS -DHAVE_LAPACK -DHAVE_SHARED_PTR_ARRAY_SUPPORT -DOpenMEEGMaths_EXPORTS -DUSE_OPENBLAS -I%SRC_DIR%\OpenMEEGMaths\include -I%SRC_DIR%\build_Release\OpenMEEGMaths -I%SRC_DIR%\build_Release -I%SRC_DIR%\OpenMEEGMaths\OpenMEEGMaths\src -external:I%PREFIX%\Library\include -external:W0 /wd4275 /wd4101 -openmp /MD /O2 /Ob2 /DNDEBUG -std:c++17 /showIncludes /FoOpenMEEGMaths\CMakeFiles\OpenMEEGMaths.dir\src\vector.cpp.obj /FdOpenMEEGMaths\CMakeFiles\OpenMEEGMaths.dir\ /FS -c %SRC_DIR%\OpenMEEGMaths\src\vector.cpp
%PREFIX%\Library\include\lapack.h(104): error C2143: syntax error: missing ',' before '*'
%PREFIX%\Library\include\lapack.h(106): error C2143: syntax error: missing ',' before '*'
... <hundreds of these>

You can see it on conda-forge here for example, where it uses the OpenBLAS libraries that they build:

https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=524975&view=logs&jobId=5be07ae1-d8ba-5406-47b6-8e3a3a12f825&j=5be07ae1-d8ba-5406-47b6-8e3a3a12f825&t=0bf03e01-0bec-5b85-5316-b1633322e895

And on GitHub actions here from earlier this week, same error -- this is using the OpenBLAS builds SciPy makes with mingw64, but I had the same problem when I tried previously just by downloading the 0.3.20 release binaries from GitHub:

Run cmake --build build  --config Release
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
  Checking Build System
  Building Custom Rule D:/a/openmeeg/openmeeg/OpenMEEGMaths/CMakeLists.txt
  vector.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.16.27023\include\xlocale(319): warning C4[53](https://github.com/openmeeg/openmeeg/runs/6975816876?check_suite_focus=true#step:16:54)0: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [D:\a\openmeeg\openmeeg\build\OpenMEEGMaths\OpenMEEGMaths.vcxproj]
d:\a\openmeeg\openmeeg\openblas\64\include\lapack.h(104): error C2143: syntax error: missing ',' before '*' [D:\a\openmeeg\openmeeg\build\OpenMEEGMaths\OpenMEEGMaths.vcxproj]
d:\a\openmeeg\openmeeg\openblas\64\include\lapack.h(106): error C2143: syntax error: missing ',' before '*' [D:\a\openmeeg\openmeeg\build\OpenMEEGMaths\OpenMEEGMaths.vcxproj]
... <hundreds of these>

I am a bit mystified by this because these lines are protected by an ifdef that should take care of this I think:

https://github.com/xianyi/OpenBLAS/blob/9283c7c0b5a9ec7bbe3b6dfc1a019b29b3e112e5/lapack-netlib/LAPACKE/include/lapack.h#L71-L104

Anyone run into this before? I didn't see any mention of anything like this in the Visual Studio wiki docs, but maybe I just missed it. Perhaps it's a cmake+MSVC+CPP issue, and there is some cmake fix...? Not sure.

An identical build configuration using mingw64 doesn't have this problem... but I think for conda-forge I might need to build with MSVC. And in any case it would be nice if it worked...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions