Zygo / bees

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

clang++ error: "... function 'operator<<' ... neither visible in the template definition nor found by argument-dependent lookup" #159

Closed telans closed 3 years ago

telans commented 3 years ago

Hi, I'm encountering an error when compiling bees with clang. I'm not sure how to fix this.

clang++ -march=znver2 -O3 -pipe -Wall -Wextra -I../include -fpic -D_FILE_OFFSET_BITS=64 -std=c++11 -Wold-style-cast -L../lib -o ../bin/fiemap fiemap.o -lcrucible -lpthread
In file included from bees-roots.cc:1:
In file included from ./bees.h:5:
../include/crucible/chatter.h:59:15: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
                        c.get_os() << arg;
                                   ^
../include/crucible/chatter.h:68:10: note: in instantiation of member function 'crucible::ChatterTraits<btrfs_ioctl_search_key>::operator()' requested here
                return ChatterTraits<T>()(*this, arg);
                       ^
bees-roots.cc:983:34: note: in instantiation of function template specialization 'crucible::Chatter::operator<<<btrfs_ioctl_search_key>' requested here
        BEESTRACE("Searching crawl sk " << static_cast<btrfs_ioctl_search_key&>(sk));
                                        ^
../include/crucible/fs.h:173:12: note: 'operator<<' should be declared prior to the call site or in the global namespace
        ostream & operator<<(ostream &os, const btrfs_ioctl_search_key &key);
                  ^
2 warnings and 1 error generated.
make[1]: *** [<builtin>: bees-roots.o] Error 1

complete build log: build.log

Thanks

mischaelschill commented 3 years ago

Did you try to compile with -std=gnu++17?

telans commented 3 years ago

No change unfortunately

https://dpaste.com/BCCNXJ6MW#line-341

Zygo commented 3 years ago

I got it to build with clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final). It should be fixed in my next push to master.