Hi Reagan, On Fri, Apr 14, 2023 at 10:36:35PM +1200, No Name wrote: > This is my first time reporting a bug, so apologies if I get something wrong. Thanks for the report! "See something, say something", even if it is not quite right out of the gate, we can get down to the bottom of it. > In tools/build/feature/Makefile, line 342, the c++ std is set to > gnu++14, whereas LLVM 16 now requires c++17 to include the headers. > This results in the llvm feature being falsely disabled for bpfutil. I cannot find any reference to bpfutil either in tree or when doing a web search, did you mean bpftool? I am going to assume yes, so I have gone ahead and added Quentin (the maintainer of bpftool in MAINTAINERS) and bpf@xxxxxxxxxxxxxxx to the thread. > Perhaps the --cxxflags, --ldflags and --libs options of llvm-config > should instead? The tools system is pretty much Greek to me, so I am hoping someone else will have a better idea of what is going on and how to fix it. For the record, I think I see the issue you are talking about on Fedora, which has clang-16, whereas I do not see the same issue on Arch Linux, which still has clang-15. $ clang --version | head -1 clang version 15.0.7 $ make -C tools/bpf/bpftool -j(nproc) -s Auto-detecting system features: ... clang-bpf-co-re: [ on ] ... llvm: [ on ] ... libcap: [ on ] ... libbfd: [ on ] compared to $ clang --version | head -1 clang version 16.0.0 (Fedora 16.0.0-1.fc39) $ make -C tools/bpf/bpftool -j(nproc) -s Auto-detecting system features: ... clang-bpf-co-re: [ on ] ... llvm: [ OFF ] ... libcap: [ on ] ... libbfd: [ on ] This is the output of tools/build/feature/test-llvm.make.output on my machine, which seems to confirm that the headers expect to be compiled with '-std=c++17', but that is just a superficial observation at this point. In file included from /usr/include/llvm/Support/raw_ostream.h:16, from test-llvm.cpp:3: /usr/include/llvm/ADT/SmallVector.h: In static member function ‘static void llvm::SmallVectorTemplateBase<T, <anonymous> >::uninitialized_move(It1, It1, It2)’: /usr/include/llvm/ADT/SmallVector.h:352:10: error: ‘uninitialized_move’ is not a member of ‘std’; did you mean ‘uninitialized_copy’? 352 | std::uninitialized_move(I, E, Dest); | ^~~~~~~~~~~~~~~~~~ | uninitialized_copy In file included from /usr/include/llvm/ADT/StringRef.h:12, from /usr/include/llvm/Support/raw_ostream.h:17: /usr/include/llvm/ADT/DenseMapInfo.h: At global scope: /usr/include/llvm/ADT/DenseMapInfo.h:294:52: error: ‘variant’ is not a member of ‘std’ 294 | template <typename... Ts> struct DenseMapInfo<std::variant<Ts...>> { | ^~~~~~~ /usr/include/llvm/ADT/DenseMapInfo.h:294:52: note: ‘std::variant’ is only available from C++17 onwards /usr/include/llvm/ADT/DenseMapInfo.h:294:52: error: ‘variant’ is not a member of ‘std’ /usr/include/llvm/ADT/DenseMapInfo.h:294:52: note: ‘std::variant’ is only available from C++17 onwards /usr/include/llvm/ADT/DenseMapInfo.h:294:62: error: expected parameter pack before ‘...’ 294 | template <typename... Ts> struct DenseMapInfo<std::variant<Ts...>> { | ^~~ /usr/include/llvm/ADT/DenseMapInfo.h:294:62: error: template argument 1 is invalid /usr/include/llvm/ADT/DenseMapInfo.h:294:65: error: expected unqualified-id before ‘>’ token 294 | template <typename... Ts> struct DenseMapInfo<std::variant<Ts...>> { | ^~ In file included from /usr/include/llvm/ADT/STLFunctionalExtras.h:18, from /usr/include/llvm/ADT/StringRef.h:13: /usr/include/llvm/ADT/STLForwardCompat.h:46:35: error: ‘optional’ in namespace ‘std’ does not name a template type 46 | auto transformOptional(const std::optional<T> &O, const Function &F) | ^~~~~~~~ /usr/include/llvm/ADT/STLForwardCompat.h:46:30: note: ‘std::optional’ is only available from C++17 onwards 46 | auto transformOptional(const std::optional<T> &O, const Function &F) | ^~~ /usr/include/llvm/ADT/STLForwardCompat.h:46:43: error: expected ‘,’ or ‘...’ before ‘<’ token 46 | auto transformOptional(const std::optional<T> &O, const Function &F) | ^ /usr/include/llvm/ADT/STLForwardCompat.h:47:13: error: ‘optional’ in namespace ‘std’ does not name a template type 47 | -> std::optional<decltype(F(*O))> { | ^~~~~~~~ /usr/include/llvm/ADT/STLForwardCompat.h:47:8: note: ‘std::optional’ is only available from C++17 onwards 47 | -> std::optional<decltype(F(*O))> { | ^~~ /usr/include/llvm/ADT/STLForwardCompat.h:47:21: error: expected initializer before ‘<’ token 47 | -> std::optional<decltype(F(*O))> { | ^ /usr/include/llvm/ADT/STLForwardCompat.h:56:29: error: ‘optional’ is not a member of ‘std’ 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^~~~~~~~ /usr/include/llvm/ADT/STLForwardCompat.h:56:29: note: ‘std::optional’ is only available from C++17 onwards /usr/include/llvm/ADT/STLForwardCompat.h:56:39: error: expected primary-expression before ‘>’ token 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^ /usr/include/llvm/ADT/STLForwardCompat.h:56:43: error: label ‘O’ referenced outside of any function 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^ /usr/include/llvm/ADT/STLForwardCompat.h:56:46: error: expected primary-expression before ‘const’ 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^~~~~ /usr/include/llvm/ADT/STLForwardCompat.h:56:63: error: expression list treated as compound expression in initializer [-fpermissive] 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^ /usr/include/llvm/ADT/STLForwardCompat.h:56:64: error: expected ‘;’ before ‘->’ token 56 | auto transformOptional(std::optional<T> &&O, const Function &F) | ^ | ; 57 | -> std::optional<decltype(F(*std::move(O)))> { | ~~ /usr/include/llvm/ADT/StringRef.h:104:54: error: expected ‘)’ before ‘Str’ 104 | /*implicit*/ constexpr StringRef(std::string_view Str) | ~ ^~~~ | ) /usr/include/llvm/ADT/StringRef.h:248:14: error: expected type-specifier 248 | operator std::string_view() const { | ^~~ /usr/include/llvm/ADT/StringRef.h: In member function ‘size_t llvm::StringRef::find(char, size_t) const’: /usr/include/llvm/ADT/StringRef.h:296:19: error: ‘string_view’ is not a member of ‘std’ 296 | return std::string_view(*this).find(C, From); | ^~~~~~~~~~~ /usr/include/llvm/ADT/StringRef.h:296:19: note: ‘std::string_view’ is only available from C++17 onwards /usr/include/llvm/Support/raw_ostream.h: At global scope: /usr/include/llvm/Support/raw_ostream.h:252:38: error: ‘string_view’ in namespace ‘std’ does not name a type 252 | raw_ostream &operator<<(const std::string_view &Str) { | ^~~~~~~~~~~ /usr/include/llvm/Support/raw_ostream.h:252:33: note: ‘std::string_view’ is only available from C++17 onwards 252 | raw_ostream &operator<<(const std::string_view &Str) { | ^~~ /usr/include/llvm/Support/raw_ostream.h: In member function ‘llvm::raw_ostream& llvm::raw_ostream::operator<<(const int&)’: /usr/include/llvm/Support/raw_ostream.h:253:22: error: request for member ‘data’ in ‘Str’, which is of non-class type ‘const int’ 253 | return write(Str.data(), Str.length()); | ^~~~ /usr/include/llvm/Support/raw_ostream.h:253:34: error: request for member ‘length’ in ‘Str’, which is of non-class type ‘const int’ 253 | return write(Str.data(), Str.length()); | ^~~~~~ /usr/include/llvm/Support/raw_ostream.h: At global scope: /usr/include/llvm/Support/raw_ostream.h:459:16: error: ‘optional’ in namespace ‘std’ does not name a template type 459 | mutable std::optional<bool> HasColors; | ^~~~~~~~ /usr/include/llvm/Support/raw_ostream.h:459:11: note: ‘std::optional’ is only available from C++17 onwards 459 | mutable std::optional<bool> HasColors; | ^~~ /usr/include/llvm/Support/raw_ostream.h:757:47: error: ‘std::nullopt_t’ has not been declared 757 | raw_ostream &operator<<(raw_ostream &OS, std::nullopt_t); | ^~~~~~~~~ /usr/include/llvm/Support/raw_ostream.h:761:53: error: ‘optional’ in namespace ‘std’ does not name a template type 761 | raw_ostream &operator<<(raw_ostream &OS, const std::optional<T> &O) { | ^~~~~~~~ /usr/include/llvm/Support/raw_ostream.h:761:48: note: ‘std::optional’ is only available from C++17 onwards 761 | raw_ostream &operator<<(raw_ostream &OS, const std::optional<T> &O) { | ^~~ /usr/include/llvm/Support/raw_ostream.h:761:61: error: expected ‘,’ or ‘...’ before ‘<’ token 761 | raw_ostream &operator<<(raw_ostream &OS, const std::optional<T> &O) { | ^ /usr/include/llvm/Support/raw_ostream.h: In function ‘llvm::raw_ostream& llvm::operator<<(raw_ostream&, int)’: /usr/include/llvm/Support/raw_ostream.h:762:7: error: ‘O’ was not declared in this scope; did you mean ‘OS’? 762 | if (O) | ^ | OS /usr/include/llvm/Support/raw_ostream.h:765:16: error: ‘nullopt’ is not a member of ‘std’ 765 | OS << std::nullopt; | ^~~~~~~ /usr/include/llvm/Support/raw_ostream.h:765:16: note: ‘std::nullopt’ is only available from C++17 onwards Cheers, Nathan