BUG: Cannot build C++ project using MSVC 2019 due to lapack.h · Issue #683 · Reference-LAPACK/lapack (original) (raw)
Description
Over in OpenBLAS (OpenMathLib/OpenBLAS#3661) they vendor the reference lapack.h
. If I take their compiled OpenBLAS lib (or the one that SciPy makes) and try to use it in a C++ project that uses LAPACK (which requires including the OpenBLAS lapack headers, which are really yours I think) and compiling with MSVC 2019, I end up with an error like:
[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:
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:
Anyone run into this before? Perhaps it's a cmake+MSVC+CPP issue, and there is some cmake fix...? Not sure.
An identical build configuration using mingw64 to build my project 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...
Checklist
- I've included a minimal example to reproduce the issue
- I'd be willing to make a PR to solve this issue
No minimal example yet but I could make one if it would help. I think it would probably just require using MSVC 2019+ and building a C++ project, but maybe there is more to it!