Zygo / bees

Best-Effort Extent-Same, a btrfs dedupe agent
GNU General Public License v3.0
630 stars 57 forks source link

Build failure (ppc64le): fiemap.cc no matching function for call to 'min(__u64&, long long unsigned int)' #194

Closed kdave closed 2 years ago

kdave commented 2 years ago

The build of 0.7 succeeds on all other arches, fails on ppc64le (gcc 11.2), full log at: https://build.opensuse.org/package/live_build_log/filesystems/bees/openSUSE_Tumbleweed/ppc64le

The relevant part:

[   81s] g++ -Wall -Wextra -Werror -O3 -I../include -D_FILE_OFFSET_BITS=64 -std=c++11 -Wold-style-cast  -o fiemap.o -c fiemap.cc
[   83s] fiemap.cc: In lambda function:
[   83s] fiemap.cc:31:35: error: no matching function for call to 'min(__u64&, long long unsigned int)'
[   83s]    31 |                 fm.fm_length = min(fm.fm_length, FIEMAP_MAX_OFFSET - fm.fm_start);
[   83s]       |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   83s] In file included from /usr/include/c++/11/array:40,
[   83s]                  from /usr/include/c++/11/tuple:39,
[   83s]                  from /usr/include/c++/11/functional:54,
[   83s]                  from ../include/crucible/error.h:8,
[   83s]                  from ../include/crucible/lockset.h:4,
[   83s]                  from ../include/crucible/namedptr.h:4,
[   83s]                  from ../include/crucible/fd.h:4,
[   83s]                  from fiemap.cc:1:
[   83s] /usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
[   83s]   230 |     min(const _Tp& __a, const _Tp& __b)
[   83s]       |     ^~~
[   83s] /usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
[   83s] fiemap.cc:31:35: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'long long unsigned int')
[   83s]    31 |                 fm.fm_length = min(fm.fm_length, FIEMAP_MAX_OFFSET - fm.fm_start);
[   83s]       |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   83s] In file included from /usr/include/c++/11/array:40,
[   83s]                  from /usr/include/c++/11/tuple:39,
[   83s]                  from /usr/include/c++/11/functional:54,
[   83s]                  from ../include/crucible/error.h:8,
[   83s]                  from ../include/crucible/lockset.h:4,
[   83s]                  from ../include/crucible/namedptr.h:4,
[   83s]                  from ../include/crucible/fd.h:4,
[   83s]                  from fiemap.cc:1:
[   83s] /usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
[   83s]   278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
[   83s]       |     ^~~
[   83s] /usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
[   83s] fiemap.cc:31:35: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'long long unsigned int')
[   83s]    31 |                 fm.fm_length = min(fm.fm_length, FIEMAP_MAX_OFFSET - fm.fm_start);
[   83s]       |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zygo commented 2 years ago

If adding #undef min after the last #include in fiemap.cc fixes the build (or at least gets rid of those particular errors), it's a libc headers problem. They aren't detecting C++ properly and polluting the namespace with macros.

Zygo commented 2 years ago

wait no that's completely not this problem. :-P

FIEMAP_MAX_OFFSET and __u64 are different types on this arch?

Zygo commented 2 years ago

Can you test the fix-issue-194 branch?

Zygo commented 2 years ago

Bah, I'm pushing things early a lot these days. Try 12e8065, it actually builds. :-P

kdave commented 2 years ago

This fixed the ppc64le build, thanks.

Zygo commented 2 years ago

I was considering dropping fiemap completely since filefrag -vX now exists, but it's easy enough to keep fiemap alive, and I don't want to open the worm can of dropping a whole binary today.