Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not build avcleaner.bin #25

Open
sanguiyh opened this issue Nov 20, 2022 · 4 comments
Open

can not build avcleaner.bin #25

sanguiyh opened this issue Nov 20, 2022 · 4 comments

Comments

@sanguiyh
Copy link

sanguiyh commented Nov 20, 2022

Hello, I got the following error when building avcleaner.bin with ubuntu20.04. Could you please give me some advice?

root@24c0b22321e9:/avcleaner/CMakeBuild# make
[ 16%] Building CXX object CMakeFiles/avcleaner.bin.dir/main.cpp.o
In file included from /avcleaner/Consumer.h:10,
                 from /avcleaner/main.cpp:17:
/avcleaner/MatchHandler.h:53:73: error: 'clang::DynTypedNode' has not been declared
   53 |     bool climbParentsIgnoreCast(const clang::StringLiteral &NodeString, clang::DynTypedNode node,
      |                                                                         ^~~~~
/avcleaner/MatchHandler.h:65:60: error: 'clang::DynTypedNode' has not been declared
   65 |     getNodeParents(const clang::StringLiteral &NodeString, clang::DynTypedNode Node,
      |                                                            ^~~~~
/avcleaner/MatchHandler.h:75:32: error: 'clang::DynTypedNode' has not been declared
   75 |                                clang::DynTypedNode node, std::string StringType);
      |                                ^~~~~
/avcleaner/MatchHandler.h:84:25: error: 'clang::DynTypedNode' has not been declared
   84 |                         clang::DynTypedNode node, std::string StringType);
      |                         ^~~~~
/avcleaner/MatchHandler.h:96:51: error: 'clang::DynTypedNode' has not been declared
   96 |     findInjectionSpot(clang::ASTContext *Context, clang::DynTypedNode Parent,
      |                                                   ^~~~~
/avcleaner/MatchHandler.h:107:29: error: 'clang::DynTypedNode' has not been declared
  107 |                             clang::DynTypedNode node, std::string StringType);
      |                             ^~~~~
/avcleaner/MatchHandler.h:123:21: error: 'clang::DynTypedNode' has not been declared
  123 |                     clang::DynTypedNode node, std::string StringType="", std::string NewType="");
      |                     ^~~~~
/avcleaner/MatchHandler.h:126:28: error: 'clang::DynTypedNode' has not been declared
  126 |                            clang::DynTypedNode node, std::string StringType);
      |                            ^~~~~
In file included from /avcleaner/main.cpp:19:
/avcleaner/ApiMatchHandler.h:67:83: error: 'clang::DynTypedNode' has not been declared
   67 |     static clang::SourceRange findInjectionSpot(clang::ASTContext *const Context, clang::DynTypedNode Parent,
      |                                                                                   ^~~~~
/avcleaner/ApiMatchHandler.h:88:41: error: 'clang::DynTypedNode' has not been declared
   88 |     getParents(const clang::Expr &pExr, clang::DynTypedNode Node, clang::ASTContext *const Context,
      |                                         ^~~~~
/avcleaner/ApiMatchHandler.h:91:75: error: 'clang::DynTypedNode' has not been declared
   91 |     clang::SourceLocation findFirstFunctionDecl(const clang::Expr &pExpr, clang::DynTypedNode Node,
      |                                                                           ^~~~~
/avcleaner/main.cpp: In function 'int main(int, const char**)':
/avcleaner/main.cpp:214:78: error: no matching function for call to 'clang::tooling::CommonOptionsParser::create(int&, const char**&, llvm::cl::OptionCategory&)'
  214 |     auto option_parser = CommonOptionsParser::create(argc, argv, ToolCategory);
      |                                                                              ^
In file included from /avcleaner/main.cpp:8:
/usr/lib/llvm-10/include/clang/Tooling/CommonOptionsParser.h:97:3: note: candidate: 'static llvm::Expected<clang::tooling::CommonOptionsParser> clang::tooling::CommonOptionsParser::create(int&, const char**, llvm::cl::OptionCategory&, llvm::cl::NumOccurrencesFlag, const char*)'
   97 |   create(int &argc, const char **argv, llvm::cl::OptionCategory &Category,
      |   ^~~~~~
/usr/lib/llvm-10/include/clang/Tooling/CommonOptionsParser.h:97:3: note:   candidate expects 5 arguments, 3 provided
make[2]: *** [CMakeFiles/avcleaner.bin.dir/build.make:63: CMakeFiles/avcleaner.bin.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/avcleaner.bin.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

My clang version:

root@24c0b22321e9:/avcleaner/CMakeBuild# clang -v
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64

In fact, I use clang12.0 and have the same error. I don't know what's the reason

Ubuntu clang version 12.0.0-3ubuntu1~20.04.5
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
@plowsec
Copy link
Contributor

plowsec commented Jan 31, 2023

Thanks for the bug report, I will look into it

@httpszhengshu
Copy link

我也遇到了同样的问题

@httpszhengshu
Copy link

好了,我修改了一些代码,可以编译成功了
main.cpp -> auto option_parser = CommonOptionsParser::create(argc, argv, ToolCategory,llvm::cl::OneOrMore, nullptr);
ApiMatchHandler.cpp 和 MatchHandler.cpp 里面 clang::DynTypedNode 修改为 clang::ast_type_traits::DynTypedNode

@erenyenigul
Copy link

I am having the same issue. Is there a solution for this? @sanguiyh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants