Trying to build bcc with LLVM 19 fails with the following error:
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::MapVisitor::VisitCallExpr(clang::CallExpr*)’:
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc:341:27: error: ‘class llvm::StringRef’ has no member named ‘startswith’; did you mean ‘starts_with’?
341 | if (!A->getName().startswith("maps"))
| ^~~~~~~~~~
| starts_with
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::ProbeVisitor::assignsExtPtr(clang::Expr*, int*)’:
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc:393:29: error: ‘class llvm::StringRef’ has no member named ‘startswith’; did you mean ‘starts_with’?
393 | if (!A->getName().startswith("maps"))
| ^~~~~~~~~~
| starts_with
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitCallExpr(clang::CallExpr*)’:
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc:940:27: error: ‘class llvm::StringRef’ has no member named ‘startswith’; did you mean ‘starts_with’?
940 | if (!A->getName().startswith("maps"))
| ^~~~~~~~~~
| starts_with
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
/root/rpmbuild/BUILD/bcc-0.30.0-build/bcc-0.30.0/src/cc/frontends/clang/b_frontend_action.cc:1458:23: error: ‘class llvm::StringRef’ has no member named ‘startswith’; did you mean ‘starts_with’?
1458 | if (!A->getName().startswith("maps"))
| ^~~~~~~~~~
| starts_with
StringRef::startswith was marked for deprecation in LLVM 18 and finally removed in LLVM 19 in commit 4ec9a662. Replacing the ocurrences of startswith with starts_with fixes the build.
Trying to build bcc with LLVM 19 fails with the following error:
StringRef::startswith was marked for deprecation in LLVM 18 and finally removed in LLVM 19 in commit 4ec9a662. Replacing the ocurrences of
startswith
withstarts_with
fixes the build.Reproduced in Fedora 41 with bcc-0.30.0