surge-synthesizer / surge-rack

Take Surge and factor it into modules for VCV Rack
GNU General Public License v3.0
168 stars 12 forks source link

Build Error on Fedora 40 with gcc-14.0.1 #999

Open ycollet opened 6 months ago

ycollet commented 6 months ago

I am trying to build surge-rack on Fedora 40 with gcc-14.0.1 and I met an error message:

/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h: In instantiation of ‘constexpr fmt::v9::detail::value<Context> fmt::v9::detail::make_value(T&&) [with Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; T = fmt::v9::basic_string_view<char>&]’:
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1777:29:   required from ‘constexpr fmt::v9::detail::value<Context> fmt::v9::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; type <anonymous> = fmt::v9::detail::type::string_type; T = fmt::v9::basic_string_view<char>&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
 1777 |   return make_value<Context>(val);
      |          ~~~~~~~~~~~~~~~~~~~^~~~~
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1901:77:   required from ‘constexpr fmt::v9::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {fmt::v9::basic_string_view<char>&, const char (&)[3]}; Context = fmt::v9::basic_format_context<fmt::v9::appender, char>; Args = {fmt::v9::basic_string_view<char>, char [3]}]’
 1899 |         data_{detail::make_arg<
      |               ~~~~~~~~~~~~~~~~~                                              
 1900 |             is_packed, Context,
      |             ~~~~~~~~~~~~~~~~~~~                                              
 1901 |             detail::mapped_type_constant<remove_cvref_t<T>, Context>::value>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 1902 |             FMT_FORWARD(args))...} {
      |             ~~~~~~~~~~~~~~~~~~                                               
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1918:31:   required from ‘OutputIt fmt::v9::format_to(OutputIt, format_string<T ...>, T&& ...) [with OutputIt = appender; T = {basic_string_view<char>&, const char (&)[3]}; typename std::enable_if<detail::is_output_iterator<OutputIt, char>::value, int>::type <anonymous> = 0; format_string<T ...> = basic_format_string<char, basic_string_view<char>&, const char (&)[3]>]’
 1918 |   return {FMT_FORWARD(args)...};
      |                               ^
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/format-inl.h:65:14:   required from here
   65 |     format_to(it, FMT_STRING("{}{}"), message, SEP);
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:3235:52:   in ‘constexpr’ expansion of ‘fmt::v9::make_format_args<>(args#0, args#1)’
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1735:15: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
 1735 |   const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(val));
      |               ^~~
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1735:46: note: the temporary was destroyed at the end of the full expression ‘fmt::v9::detail::arg_mapper<fmt::v9::basic_format_context<fmt::v9::appender, char> >().fmt::v9::detail::arg_mapper<fmt::v9::basic_format_context<fmt::v9::appender, char> >::map<fmt::v9::basic_string_view<char> >((*(const fmt::v9::basic_string_view<char>*)(& val)))’
 1735 |   const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(val));
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
gmake[3]: *** [libs/fmt/CMakeFiles/fmt.dir/build.make:76: libs/fmt/CMakeFiles/fmt.dir/src/format.cc.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:1098: libs/fmt/CMakeFiles/fmt.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....

The problem:

/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:3235:52:   in ‘constexpr’ expansion of ‘fmt::v9::make_format_args<>(args#0, args#1)’
/builddir/build/BUILD/Rack/SurgeXTRack_plugin/surge/libs/fmt/include/fmt/core.h:1735:15: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
baconpaul commented 6 months ago

Thanks

None of us have used gcc14 Looks like we either need to turn of werror for fmt upgrade fmt or fix gcc14 if the warning is wrong

our tested compilers end at gcc13 now but will look

baconpaul commented 6 months ago

That line does look odd but I don’t know what map returns

ycollet commented 6 months ago

Thanks a lot for this fast answer :)

baconpaul commented 6 months ago

No problem

surge is still on fmt9 and when we tried to pull to 10 had some problem I don’t recall.

My guess is by far the most expedient thing would be comment out this line https://github.com/surge-synthesizer/surge-rack/blob/4e0c376ab1995ab7c02fc0201039be407a1d457c/CMakeLists.txt#L72 and see if it builds

if that works we can condition that on gcc 14 pretty easily but since I don’t have the compiler would appreciate a test if you have time

baconpaul commented 6 months ago

Actually I really just want that error on the rack modules anyway so if it works with that commented out maybe we take a different tack. But that’s still the data point I need!

ycollet commented 6 months ago

Checking ... I will keep you informed tonight I think.

baconpaul commented 6 months ago

Great. No rush here! And thanks!

baconpaul commented 6 months ago

The other fix we could try which is most correct is in the block above add a compile options for fmt with -wno-blah - I think it’s pretty clear what that would look like if the hammer above works

ycollet commented 6 months ago

Commenting the -Werror line in CMakeLists.txt didn't work. Replacing -Werror by -Wno-error in surge/libs/fmt/CMakeLists.txt didn't work

Replacing -Werror by -Wno-error in surge/CMakeLists.txt worked finally :)

baconpaul commented 6 months ago

Oooh OK.

Well lemme ponder how to do that safely

How about if you add -Wno-angling-reference instead of -Wno-error

baconpaul commented 6 months ago

Dangling not angling of course

ycollet commented 6 months ago

Finally, I added: add_compile_options(-Wno-error=dangling-reference) in surge/CMakeLists.txt and it worked.

baconpaul commented 6 months ago

Ok cool thank you

let me figure out right way to make that mergeable next few days and will revert with a branch for a test

thanks for flagging