Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When compiled using Windows bazel, the following error occurs: ``` cl: 命令行 warning D9002 :忽略未知选项“-pthread” cl: 命令行 warning D9002 :忽略未知选项“-std=c++17” time_util.cc src/fury/util/time_util.cc(43): warning C4477: “snprintf”: 格式字符串“%03ld”需要类型“long”的参数,但可变参数 1 拥有了类型“_Rep” with [ _Rep=__int64 ] src/fury/util/time_util.cc(43): note: 请考虑在格式字符串中使用“%lld” src/fury/util/time_util.cc(43): note: 请考虑在格式字符串中使用“%Id” src/fury/util/time_util.cc(43): note: 请考虑在格式字符串中使用“%I64d” INFO: From Compiling absl/debugging/failure_signal_handler.cc: failure_signal_handler.cc INFO: From Compiling absl/strings/str_replace.cc: str_replace.cc INFO: From Compiling absl/strings/match.cc: match.cc INFO: From Compiling absl/strings/internal/stringify_sink.cc: stringify_sink.cc ERROR: C:/users/sui/desktop/incubator-fury/src/fury/util/BUILD:5:11: Compiling src/fury/util/buffer.cc failed: (Exit 2): cl.exe failed: error executing CppCompile command (from target //src/fury/util:fury_util) C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-opt/bin/src/fury/util/_objs/fury_util/buffer.obj.params cl: 命令行 warning D9002 :忽略未知选项“-pthread” cl: 命令行 warning D9002 :忽略未知选项“-std=c++17” buffer.cc bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(31): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(50): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(50): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(50): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(50): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(51): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(55): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(55): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(55): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(55): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(56): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(59): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(59): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(61): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(61): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(61): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(61): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(66): error C3533: 参数不能为包 含“auto”的类型 bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(66): note: 非类型模板参数中的“auto”至少需要“/std:c++17” bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(97): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(105): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(108): error C7525: 内联变量至少 需要 "/std:c++17" bazel-out/x64_windows-opt/bin/src/fury/meta/_virtual_includes/fury_meta\fury/meta/type_traits.h(120): error C7525: 内联变量至少 需要 "/std:c++17" Target //src/fury/util:fury_util failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 13.649s, Critical Path: 2.07s INFO: 42 processes: 6 internal, 36 local. ERROR: Build did NOT complete successfully ``` The root cause is that in Windows, specifying C++17 requires the use of `/std:c++17`, while in unix/linux systems, use `-std=c++17`. Since the operating system name cannot be determined in fury.bzl to dynamically set COPTS, so I moved them to .bazelrc. Later, I will solve the warnings generated by compiling in windows, for example `src/fury/util/time_util.cc(43): note: 请考虑在格式字符串中使用“%lld”`. Signed-off-by: LiangliangSui <[email protected]> Co-authored-by: Twice <[email protected]>
- Loading branch information