KomputeProject / kompute

General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
http://kompute.cc/
Apache License 2.0
1.97k stars 151 forks source link

build fails Ubuntu 20.23 - fmt/core.h:1706:15: error: possibly dangling reference to a temporary #368

Closed panjea closed 6 months ago

panjea commented 6 months ago
[ 38%] Linking CXX static library ../../lib/libkp_logger.a
[ 38%] Built target kp_logger
[ 44%] Building CXX object src/CMakeFiles/kompute.dir/Algorithm.cpp.o
[ 50%] Building CXX object src/CMakeFiles/kompute.dir/Manager.cpp.o
In file included from /home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/format.h:48,
                 from /home/rap/arx86/kompute/src/include/kompute/Algorithm.hpp:6,
                 from /home/rap/arx86/kompute/src/include/kompute/operations/OpAlgoDispatch.hpp:4,
                 from /home/rap/arx86/kompute/src/include/kompute/Sequence.hpp:6,
                 from /home/rap/arx86/kompute/src/include/kompute/Manager.hpp:9,
                 from /home/rap/arx86/kompute/src/Manager.cpp:3:
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h: In instantiation of ‘constexpr fmt::v8::detail::value<Context> fmt::v8::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; type <anonymous> = fmt::v8::detail::type::custom_type; T = fmt::v8::join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*> >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*> >, char>&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’:
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h:1855:77:   required from ‘constexpr fmt::v8::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {fmt::v8::join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, char>&}; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {fmt::v8::join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, char>}]’
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h:1872:38:   required from ‘constexpr fmt::v8::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<Args>::type>::type ...> fmt::v8::make_format_args(Args&& ...) [with Context = basic_format_context<appender, char>; Args = {join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, char>&}]’
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h:3119:44:   required from ‘std::string fmt::v8::format(format_string<T ...>, T&& ...) [with T = {join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, char>}; std::string = std::__cxx11::basic_string<char>; format_string<T ...> = basic_format_string<char, join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*, std::allocator<const char*> > >, char> >]’
/home/rap/arx86/kompute/src/Manager.cpp:425:9:   required from here
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h:1706:15: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
 1706 |   const auto& arg = arg_mapper<Context>().map(std::forward<T>(val));
      |               ^~~
/home/rap/arx86/kompute/build/_deps/fmt-src/include/fmt/core.h:1706:46: note: the temporary was destroyed at the end of the full expression ‘fmt::v8::detail::arg_mapper<fmt::v8::basic_format_context<fmt::v8::appender, char> >().fmt::v8::detail::arg_mapper<fmt::v8::basic_format_context<fmt::v8::appender, char> >::map<fmt::v8::join_view<__gnu_cxx::__normal_iterator<const char**, std::vector<const char*> >, __gnu_cxx::__normal_iterator<const char**, std::vector<const char*> >, char>&>((* & std::forward<fmt::v8::join_view<__gnu_cxx::__normal_iterator<const char**, vector<const char*> >, __gnu_cxx::__normal_iterator<const char**, vector<const char*> >, char>&>((* & val))))’
 1706 |   const auto& arg = arg_mapper<Context>().map(std::forward<T>(val));
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/kompute.dir/build.make:90: src/CMakeFiles/kompute.dir/Manager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:256: src/CMakeFiles/kompute.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
panjea commented 6 months ago

fixed with: CMakeLists.txt : line 259

    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
axsaucedo commented 6 months ago

Thanks for the heads up, good to see it's resolved although seems a workaround - having said that seems an internal issue with the fmt library (which may require a newer version). However if you run the tests you can validate if any issues in your env. Closing for now but please reopen if issues persist.