Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Error on Fedora 40 with gcc-14.0.1 #999

Open
ycollet opened this issue Apr 25, 2024 · 13 comments
Open

Build Error on Fedora 40 with gcc-14.0.1 #999

ycollet opened this issue Apr 25, 2024 · 13 comments

Comments

@ycollet
Copy link

ycollet commented Apr 25, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

@ycollet
Copy link
Author

ycollet commented Apr 25, 2024

Thanks a lot for this fast answer :)

@baconpaul
Copy link
Contributor

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

add_compile_options($<$<BOOL:${SURGE_XT_WARNINGS_ARE_ERRORS}>:-Werror>)
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
Copy link
Contributor

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
Copy link
Author

ycollet commented Apr 25, 2024

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

@baconpaul
Copy link
Contributor

Great. No rush here! And thanks!

@baconpaul
Copy link
Contributor

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
Copy link
Author

ycollet commented Apr 25, 2024

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
Copy link
Contributor

Oooh OK.

Well lemme ponder how to do that safely

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

@baconpaul
Copy link
Contributor

Dangling not angling of course

@ycollet
Copy link
Author

ycollet commented Apr 26, 2024

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

@baconpaul
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants