[Build] Float16_t and BFloat16_t compile error
cr-galrosen opened this issue · comments
Describe the issue
I'm building my project in VS 2017, and getting the compiler error C3615.
Only by removing the constexpr from the constructor and static function, the build succeed.
I am using version 1.17.3.
Urgency
No response
Target platform
Windows
Build script
/permissive- /Yu"pch.h" /MP /GS /GL /W3 /Gy /Zc:wchar_t /Qspectre /Zi /Gm- /O2 /sdl /Fd /Zc:inline /fp:precise /D "SQLITE_HAS_CODEC" /D "BOOST_USE_STATIC_LIBS" /D "NOMINMAX" /D "WIN32" /D "BOOST_SIGNALS_NO_DEPRECATION_WARNING" /D "ONNXRUNTIME_DYN_LINK" /D "NNG_SHARED_LIB" /D "GTEST_LANG_CXX11=1" /D "GTEST_HAS_TR1_TUPLE=0" /D "BOOST_ALL_NO_LIB" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX /Zc:forScope /Gd /Oi /MD /FC /Fa /EHsc /nologo /Fo /Fp /diagnostics:classic
Error / output
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): error C3615: constexpr function 'Ort::Float16_t::Float16_t' cannot result in a constant expression (compiling source file ***.cpp)
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): note: failure was caused by call of undefined function or one not declared 'constexpr' (compiling source file ***.cpp)
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): note: see usage of 'onnxruntime_float16::Float16ImplOrt::Float16_t::Float16Impl' (compiling source file ***.cpp)
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): error C3615: constexpr function 'Ort::Float16_t::Float16_t' cannot result in a constant expression (compiling source file ***.cpp)
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): note: failure was caused by call of undefined function or one not declared 'constexpr' (compiling source file ***.cpp)
1>c:.conan\cee678\1\include\onnxruntime_cxx_api.h(171): note: see usage of 'onnxruntime_float16::Float16ImplOrt::Float16_t::Float16Impl' (compiling source file ***.cpp)
Visual Studio Version
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30154 for x64
GCC / Compiler Version
We build the onnxruntime library with the following conan profile:
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=Release
@snnn @yuslepukhin can you please advise?
Please use the VS 2022 instead.
@snnn, I tried o build both the onnxruntime library and my application with VS 2022 and I get the same error.