ispras / utopia-hls

Utopia: a High-Level Synthesis framework
Apache License 2.0
7 stars 1 forks source link

`gtest` compilation fails with Clang #30

Closed Muxianesty closed 3 months ago

Muxianesty commented 3 months ago

Upon building Utopia HLS, gtest library source codes are downloaded and compiled into a library. Somehow using clang++ as a C++ compiler causes compilation errors (-DCMAKE_CXX_COMPILER=clang++).

[17/67] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
FAILED: _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o 
/usr/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/user/utopia-hls/build/_deps/googletest-src/googletest/include -I/home/user/utopia-hls/build/_deps/googletest-src/googletest -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++17 -Wall -Wshadow -Werror -Wconversion -DGTEST_HAS_PTHREAD=1 -fexceptions -W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls -UNDEBUG -g3 -Wall -Wignored-qualifiers -MD -MT _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o -MF _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o.d -o _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o -c /home/user/utopia-hls/build/_deps/googletest-src/googletest/src/gtest-all.cc
In file included from /home/user/utopia-hls/build/_deps/googletest-src/googletest/src/gtest-all.cc:41:
/home/user/utopia-hls/build/_deps/googletest-src/googletest/src/gtest.cc:3127:5: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
    default:
    ^
In file included from /home/user/utopia-hls/build/_deps/googletest-src/googletest/src/gtest-all.cc:42:
/home/user/utopia-hls/build/_deps/googletest-src/googletest/src/gtest-death-test.cc:612:5: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
    default:
    ^
2 errors generated.

The referenced code actually includes other labels apart from the default one: I suppose due to some level of optimization all of these labels are removed, causing the error.

Muxianesty commented 3 months ago

Fixed with #34.