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

error compiling bundled fmt #2761

Closed
punytroll opened this issue Jun 14, 2023 · 1 comment
Closed

error compiling bundled fmt #2761

punytroll opened this issue Jun 14, 2023 · 1 comment

Comments

@punytroll
Copy link

punytroll commented Jun 14, 2023

Hi there, I'm getting the following error when trying to compile my application.

[31/91] Compiling C++ object subprojects/spdlog-1.11.0/tests/tests_exe.p/test_stopwatch.cpp.o
FAILED: subprojects/spdlog-1.11.0/tests/tests_exe.p/test_stopwatch.cpp.o 
c++ -Isubprojects/spdlog-1.11.0/tests/tests_exe.p -Isubprojects/spdlog-1.11.0/tests -I../subprojects/spdlog-1.11.0/tests -I../subprojects/spdlog-1.11.0/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c++14 -O3 -pthread -MD -MQ subprojects/spdlog-1.11.0/tests/tests_exe.p/test_stopwatch.cpp.o -MF subprojects/spdlog-1.11.0/tests/tests_exe.p/test_stopwatch.cpp.o.d -o subprojects/spdlog-1.11.0/tests/tests_exe.p/test_stopwatch.cpp.o -c ../subprojects/spdlog-1.11.0/tests/test_stopwatch.cpp
In file included from ../subprojects/spdlog-1.11.0/include/spdlog/fmt/fmt.h:27,
                 from ../subprojects/spdlog-1.11.0/include/spdlog/common.h:45,
                 from ../subprojects/spdlog-1.11.0/include/spdlog/spdlog.h:12,
                 from ../subprojects/spdlog-1.11.0/tests/includes.h:26,
                 from ../subprojects/spdlog-1.11.0/tests/test_stopwatch.cpp:1:
In member function ‘constexpr void fmt::v9::detail::fill_t<Char>::operator=(fmt::v9::basic_string_view<Char>) [with Char = char]’,
    inlined from ‘constexpr void fmt::v9::detail::specs_setter<Char>::on_fill(fmt::v9::basic_string_view<Char>) [with Char = char]’ at ../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:2210:17,
    inlined from ‘constexpr const Char* fmt::v9::detail::parse_align(const Char*, const Char*, Handler&&) [with Char = char; Handler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at ../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:2385:24,
    inlined from ‘constexpr const Char* fmt::v9::detail::parse_format_specs(const Char*, const Char*, SpecHandler&&) [with Char = char; SpecHandler = specs_checker<dynamic_specs_handler<fmt::v9::basic_format_parse_context<char> > >&]’ at ../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:2576:22,
    inlined from ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = double; Char = char]’ at ../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:3044:41:
../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:2096:48: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 2096 |     for (size_t i = 0; i < size; ++i) data_[i] = s[i];
      |                                       ~~~~~~~~~^~~~
../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h: In member function ‘constexpr decltype (ctx.begin()) fmt::v9::formatter<T, Char, typename std::enable_if<(fmt::v9::detail::type_constant<T, Char>::value != fmt::v9::detail::type::custom_type), void>::type>::parse(ParseContext&) [with ParseContext = fmt::v9::basic_format_parse_context<char>; T = double; Char = char]’:
../subprojects/spdlog-1.11.0/include/spdlog/fmt/bundled/core.h:2089:8: note: at offset 4 into destination object ‘fmt::v9::detail::fill_t<char>::data_’ of size 4
 2089 |   Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)};
      |        ^~~~~
cc1plus: all warnings being treated as errors

As you can see, I'm using spdlog as a meson subproject. But I don't think it has anything to do with that, as I am building the project successfully on my main computer. This build is inside a docker container and the only difference I can see is that gcc is in version 12.3. On my main computer it is 12.2. (Unfortunately, I can neither upgrade one nor downgrade the other to cross-check.)

Any ideas on this? Is there an upstream solution for this which needs to be integrated?

Thanks for your time and work!

@punytroll punytroll changed the title error in bundled fmt error compiling bundled fmt Jun 14, 2023
@tt4g
Copy link
Contributor

tt4g commented Jun 14, 2023

Related fmtlib/fmt#2708

As far as this comment is concerned, This is a GCC bug.

The only way is to remove the -Werror=stringop-overflow option.

Note
fmt removes -Werror=stringop-overflow in CMakeLists.txt (fmtlib/fmt#2442), but spdlog does not contain fmt's CMakeLists.txt.

@gabime gabime closed this as completed Jun 17, 2023
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

3 participants