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

Regression? undefined reference when using different compiler #1753

Closed
Phygon opened this issue Jul 6, 2020 · 6 comments
Closed

Regression? undefined reference when using different compiler #1753

Phygon opened this issue Jul 6, 2020 · 6 comments

Comments

@Phygon
Copy link

Phygon commented Jul 6, 2020

I just tried to upgrade from fmt 6.2.1 to fmt 7.0.0.
I compiled fmt with the default compiler (GCC 8.3 on Debian Buster), while the application is compiled with the most current clang++.

Reduced example code:

#include <fmt/format.h>
int main()
{
        fmt::memory_buffer mb;
        fmt::format_to(mb, "Hello {}!", 42);
}

Compiled with:
clang++ -std=c++14 -o test test.cpp -lfmt

This results in the following error:

/usr/bin/ld: /tmp/test-cbfe70.o: in function `fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<char> >, char>::iterator fmt::v6::format_to<char [10], int, 500ul, char>(fmt::v6::basic_memory_buffer<char, 500ul, std::allocator<char> >&, char const (&) [10], int&&)':
test.cpp:(.text._ZN3fmt2v69format_toIA10_cJiELm500EcEENS0_20basic_format_contextISt20back_insert_iteratorINS0_6detail6bufferIT2_EEES7_E8iteratorERNS0_19basic_memory_bufferIS7_XT1_ESaIS7_EEERKT_DpOT0_[_ZN3fmt2v69format_toIA10_cJiELm500EcEENS0_20basic_format_contextISt20back_insert_iteratorINS0_6detail6bufferIT2_EEES7_E8iteratorERNS0_19basic_memory_bufferIS7_XT1_ESaIS7_EEERKT_DpOT0_]+0x88): undefined reference to `fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<char> >, char>::iterator fmt::v6::detail::vformat_to<char>(fmt::v6::detail::buffer<char>&, fmt::v6::basic_string_view<char>, fmt::v6::basic_format_args<fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<fmt::v6::type_identity<char>::type> >, fmt::v6::type_identity<char>::type> >)'

A similar error is printed when using clang++ for the fmt library and g++ for the test. No error if the compiler matches. With fmt 6.x, this also works without error.

@SpaceIm
Copy link

SpaceIm commented Jul 6, 2020

I don't know if it's exactly the same issue, but I have similar undefined references with Visual Studio when fmt 7.0.0 is compiled as a shared lib and then consumed in a simple cpp executable (FMT_SHARED is defined of course).

@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2020

Interesting. For some reason gcc doesn't resolve the buffer_context<char> alias to basic_format_context<...> which results in a symbol mismatch.

@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2020

Here's a minimal repro: https://godbolt.org/z/4C2Bd8

@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2020

@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2020

Worked around in fbf3b94. Thanks for reporting.

@vitaut vitaut closed this as completed Jul 7, 2020
@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2020

@Phygon, this looks like a bug in gcc so I recommend reporting there.

tchaikov added a commit to tchaikov/ceph that referenced this issue Jun 18, 2021
fmtlib v7.1.3 contains the fix of fmtlib/fmt#1753

so let's bump up the submodule to the latest master HEAD of fmtlib
for more fixes.

Signed-off-by: Kefu Chai <[email protected]>
josephsawaya pushed a commit to josephsawaya/ceph that referenced this issue Jun 22, 2021
fmtlib v7.1.3 contains the fix of fmtlib/fmt#1753

so let's bump up the submodule to the latest master HEAD of fmtlib
for more fixes.

Signed-off-by: Kefu Chai <[email protected]>
pereman2 pushed a commit to rhcs-dashboard/ceph that referenced this issue Jul 12, 2021
fmtlib v7.1.3 contains the fix of fmtlib/fmt#1753

so let's bump up the submodule to the latest master HEAD of fmtlib
for more fixes.

Signed-off-by: Kefu Chai <[email protected]>
cypherean pushed a commit to cypherean/ceph that referenced this issue Aug 20, 2021
fmtlib v7.1.3 contains the fix of fmtlib/fmt#1753

so let's bump up the submodule to the latest master HEAD of fmtlib
for more fixes.

Signed-off-by: Kefu Chai <[email protected]>
Waadkh7 pushed a commit to rhcs-dashboard/ceph that referenced this issue Aug 25, 2021
fmtlib v7.1.3 contains the fix of fmtlib/fmt#1753

so let's bump up the submodule to the latest master HEAD of fmtlib
for more fixes.

Signed-off-by: Kefu Chai <[email protected]>
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