aristocratos / btop

A monitor of resources
Apache License 2.0
21.38k stars 656 forks source link

Build fallout from #721? (fmt-related build issue) #758

Closed sbradnick closed 9 months ago

sbradnick commented 9 months ago

Describe the bug

Starting with 7f5b060 (bf56185 builds fine), I can't get a successful build in 2 distros which likely have older libraries - but this wasn't an issue before this specific commit. They both can use GCC13 but start throwing errors like fmt::v10::basic_format_args from 7f5b060 onward.

I'm happy to share more details, but I don't know if I'm simply missing a requirement (that's NOW necessary as a result of #721); I don't need to add any [lib]fmt* type of requirements to openSUSE-Tumbleweed and it builds w/o issue, doesn't really mention [fmt][FMT] at all in the build process aside from this:

LDCXXFLAGS :| -pthread -DFMT_HEADER_ONLY ...

To Reproduce

Start a standard build which works up to bf56185, but starts failing @ 7f5b060

Expected behavior

Build is successful :wink:

Screenshots

Info (please complete the following information):

The rest of this shouldn't apply because this is a build issue

Additional context

Contents of ~/.config/btop/btop.log

Note: The snap uses: ~/snap/btop/current/.config/btop

(try running btop with --debug flag if btop.log is empty)

GDB Backtrace

If btop++ is crashing at start the following steps could be helpful:

(Extra helpful if compiled with make OPTFLAGS="-O0 -g")

  1. run (linux): gdb btop (macos): lldb btop

  2. r to run, wait for crash and press enter if prompted, CTRL+L to clear screen if needed.

  3. (gdb): thread apply all bt (lldb): bt all to get backtrace for all threads

  4. Copy and paste the backtrace here:

sbradnick commented 9 months ago

I will add that for openSUSE-Tumbleweed, which builds successfully, it has these available:

fmt-9-devel v9.1.0 fmt-devel v10.2.1 libfmt9 v9.1.0 libfmt10 v10.2.1

And my daily-driver desktop has them installed, by default as far as I can tell.

But none of them are listed as BuildRequires in the .spec file or appear to be installed during building of btop. openSUSE-Leap-15.5 seems to have a v8.0.1 version of fmt - maybe that's the issue, it's a soft really low-level requirement?

sbradnick commented 9 months ago

Here's the errors from a build of openSUSE-Leap-15.6:

[   56s] Linking and optimizing binary...
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `argumentParser(int, char**)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x1f82): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x1fc8): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x2051): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x2097): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x2385): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x23cb): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x2423): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x2469): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x24aa): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x24eb): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x252b): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x2571): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x25c4): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text+0x2605): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `clean_quit(int)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x2853): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `clean_quit(int)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/ostream.h:163:(.text+0x28ba): undefined reference to `void fmt::v10::detail::vformat_to<char>(fmt::v10::detail::buffer<char>&, fmt::v10::basic_string_view<char>, fmt::v10::detail::vformat_args<char>::type, fmt::v10::detail::locale_ref)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `term_resize(bool)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x3955): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `Runner::_runner(void*)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x67b6): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x6c42): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `Runner::_runner(void*)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/format.h:4167:(.text+0x6ff9): undefined reference to `fmt::v10::detail::locale_ref::locale_ref<std::locale>(std::locale const&)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o:/home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/format.h:4167:(.text+0x7029): undefined reference to `void fmt::v10::detail::vformat_to<char>(fmt::v10::detail::buffer<char>&, fmt::v10::basic_string_view<char>, fmt::v10::detail::vformat_args<char>::type, fmt::v10::detail::locale_ref)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o: in function `main':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text.startup+0x224): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text.startup+0x26f): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text.startup+0x298): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text.startup+0x83c): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876:(.text.startup+0x174c): undefined reference to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans0.ltrans.o:/home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2876: more undefined references to `fmt::v10::vprint(_IO_FILE*, fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)' follow
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans3.ltrans.o: in function `Config::stringValid(std::basic_string_view<char, std::char_traits<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x1789): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans7.ltrans.o: in function `std::deque<long long, std::allocator<long long> > const& Tools::safeVal<std::deque<long long, std::allocator<long long> > >(std::vector<std::deque<long long, std::allocator<long long> >, std::allocator<std::deque<long long, std::allocator<long long> > > > const&, unsigned long const&, std::deque<long long, std::allocator<long long> > const&, std::source_location)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0xa7e): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans7.ltrans.o: in function `unsigned long const& Tools::safeVal<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long>(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned long, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, unsigned long> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&, std::source_location)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0xbde): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans7.ltrans.o: in function `Net::net_stat const& Tools::safeVal<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Net::net_stat>(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Net::net_stat, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, Net::net_stat> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Net::net_stat const&, std::source_location)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0xcfe): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans7.ltrans.o: in function `Mem::disk_info const& Tools::safeVal<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Mem::disk_info>(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Mem::disk_info, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, Mem::disk_info> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Mem::disk_info const&, std::source_location)':
[   56s] /home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771:(.text+0x182e): undefined reference to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)'
[   56s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /tmp/ccd0Q0u3.ltrans7.ltrans.o:/home/abuild/rpmbuild/BUILD/btop-1.3.1+git20240211.9c34ac7/include/fmt/core.h:2771: more undefined references to `fmt::v10::vformat[abi:cxx11](fmt::v10::basic_string_view<char>, fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >)' follow
[   56s] collect2: error: ld returned 1 exit status
[   56s] make: *** [Makefile:355: btop] Error 1
sbradnick commented 9 months ago

Interesting, I did a copy of devel:libraries:c_c++/fmt v10 for openSUSE-Leap-15.5 and explicitly pulled both fmt-devel and libfmt10 in ... made no difference.

So I tacked -DFMT_HEADER_ONLY onto LDCXXFLAGS and it built fine.

I'm going to leave this open ~24hrs, maybe a kind soul can enlighten me on what the whole FMT aspect/implication is or provides, but the issue that popped up for me seems to be that openSUSE-Tumbleweed includes/detects -DFMT_HEADER_ONLY for LDCXXFLAGS and openSUSE-Leap-15.[5,6] do not ...

imwints commented 9 months ago

Btop requires libfmt, which is bundled in the source tree. So you don't need any libraries installed on your system. Since we pass -DFMT_HEADER_ONLY it should not be required to link to libfmt.so and the undefined reference is an indicator that FMT_HEADER_ONLY was not defined. libfmt-10.0.0 or better is required. I have version 9.1.0 and I don't get any build failures due to the bundled headers being preferred.

sbradnick commented 9 months ago

Thanks :) I suppose things get complicated when a build service is involved and we're talking about a project including librar[y,ies] which are generally included in a distro, but the building doesn't need them as a BuildRequires. I also couldn't get LDCXXFLAGS to not be redefined (via %{nil}) to include the other requirements for btop to build on 15.5/15.6 so I have to explicitly include -DFMT_HEADER_ONLY ; not a difficult thing to do, but the fact that Tumbleweed does it using %{nil} (i.e. not adjusted) and Leap can't really threw me for a loop.