Comments (5)
@PiotrZSL @gavinchou - Any idea on how to resolve this issue?
from codebrowser.
How did you generate that compilation database?
It looks like clang's compilation database parser don't support extra key.
Also your version of LLVM is quite old, perhaps output is a recent addition. (I have no idea about that, just a guess. Upgrading clang might or might not help)
from codebrowser.
How did you generate that compilation database?
Since postgres is not a cmake project, I generated compile_commands.json
using bear(https://github.com/rizsotto/Bear).
$ cd postgres
$ bear -- ./configure
$ bear -- make
Also your version of LLVM is quite old, ...
I had installed codebrowser_generator using .deb
file linked in the woboq website: https://woboq.com/codebrowser-download.html. This is a very old build as you mentioned.
I also tried building codebrowser with LLVM-13(latest version). I get the following error while compiling,
$ cd codebrowser
$ cmake . -DCMAKE_BUILD_TYPE=Release
$ make
[ 8%] Building CXX object generator/CMakeFiles/codebrowser_generator.dir/main.cpp.o
In file included from /home/jagadeesha/Downloads/codebrowser/generator/main.cpp:39:
/home/jagadeesha/Downloads/codebrowser/generator/browserastvisitor.h: In member function ‘bool BrowserASTVisitor::VisitEnumConstantDecl(clang::EnumConstantDecl*)’:
/home/jagadeesha/Downloads/codebrowser/generator/browserastvisitor.h:132:130: error: no matching function for call to ‘llvm::APSInt::toString(int) const’
132 | otator.registerReference(d, d->getLocation(), Annotator::EnumDecl, Annotator::Declaration, d->getInitVal().toString(10));
| ^
In file included from /usr/lib/llvm-13/include/clang/AST/Type.h:34,
from /usr/lib/llvm-13/include/clang/AST/CanonicalType.h:17,
from /usr/lib/llvm-13/include/clang/AST/ASTContext.h:19,
from /usr/lib/llvm-13/include/clang/Frontend/ASTUnit.h:17,
from /usr/lib/llvm-13/include/clang/Frontend/FrontendAction.h:23,
from /usr/lib/llvm-13/include/clang/Frontend/FrontendActions.h:12,
from /home/jagadeesha/Downloads/codebrowser/generator/main.cpp:24:
/usr/lib/llvm-13/include/llvm/ADT/APSInt.h:82:8: note: candidate: ‘void llvm::APSInt::toString(llvm::SmallVectorImpl<char>&, unsigned int) const’
82 | void toString(SmallVectorImpl<char> &Str, unsigned Radix = 10) const {
| ^~~~~~~~
/usr/lib/llvm-13/include/llvm/ADT/APSInt.h:82:40: note: no known conversion for argument 1 from ‘int’ to ‘llvm::SmallVectorImpl<char>&’
82 | void toString(SmallVectorImpl<char> &Str, unsigned Radix = 10) const {
| ~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/lib/llvm-13/include/clang/AST/Type.h:33,
from /usr/lib/llvm-13/include/clang/AST/CanonicalType.h:17,
from /usr/lib/llvm-13/include/clang/AST/ASTContext.h:19,
from /usr/lib/llvm-13/include/clang/Frontend/ASTUnit.h:17,
from /usr/lib/llvm-13/include/clang/Frontend/FrontendAction.h:23,
from /usr/lib/llvm-13/include/clang/Frontend/FrontendActions.h:12,
from /home/jagadeesha/Downloads/codebrowser/generator/main.cpp:24:
/usr/lib/llvm-13/include/llvm/ADT/APInt.h:1741:8: note: candidate: ‘void llvm::APInt::toString(llvm::SmallVectorImpl<char>&, unsigned int, bool, bool) const’
1741 | void toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
| ^~~~~~~~
/usr/lib/llvm-13/include/llvm/ADT/APInt.h:1741:8: note: candidate expects 4 arguments, 1 provided
/home/jagadeesha/Downloads/codebrowser/generator/main.cpp: In function ‘bool proceedCommand(std::vector<std::__cxx11::basic_string<char> >, llvm::StringRef, llvm::StringRef, clang::FileManager*, DatabaseType)’:
/home/jagadeesha/Downloads/codebrowser/generator/main.cpp:303:15: error: ‘class clang::tooling::ToolInvocation’ has no member named ‘mapVirtualFile’
303 | Inv.mapVirtualFile(f->filename, {f->content , f->size } );
| ^~~~~~~~~~~~~~
make[2]: *** [generator/CMakeFiles/codebrowser_generator.dir/build.make:82: generator/CMakeFiles/codebrowser_generator.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:138: generator/CMakeFiles/codebrowser_generator.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
The 2 errors are:
codebrowser/generator/browserastvisitor.h:132:130: error: no matching function for call to ‘llvm::APSInt::toString(int) const’
codebrowser/generator/main.cpp:303:15: error: ‘class clang::tooling::ToolInvocation’ has no member named ‘mapVirtualFile’
303 | Inv.mapVirtualFile(f->filename, {f->content , f->size } );
from codebrowser.
Workaround Fix:
I followed the instructions given in rizsotto/Bear#196 (comment) to generate compile_commands.json
in the older format (i.e. without output
field). codebrowser_generator worked fine with the older format.
Adding config.json
that I used for reference here.
{
"compilation": {},
"output": {
"content": {
"include_only_existing_source": true
},
"format": {
"command_as_array": false,
"drop_output_field": true
}
}
}
As for the codebrowser
build failure with LLVM-13, I have logged a new issue (#95).
from codebrowser.
@kanihal Since you've solved the db problem, I would like to share some tips on generating compilation.json. Hope it may help in the future.
For any project I'd like to compile with codebrowser, I would like to write another new CMakeList.txt for it to get full control of the source code and dependencies needed by codebrowser, even though it already has one.
Of course, I need some script to help, here is the example
https://github.com/gavinchou/codebrowser/tree/master/examples/build-project-with-template
from codebrowser.
Related Issues (20)
- Failed to build codebrowser in MAC HOT 2
- Not able to compile Woboq Code Browser. HOT 14
- meet a llvm3.8 error when i cmake the project HOT 1
- Not able to compile Woboq Code Browser HOT 12
- CMake Error: Could not find any clang builtins headers HOT 4
- static link llvm as a standalone command line tool HOT 1
- Which version of linux kernel/gcc etc codebase in codebrowser.dev? HOT 1
- ccache/sccache usage together with codebrowser HOT 5
- Fails to build with LLVM/Clang 16.0.2 HOT 1
- Dark theme for site
- Replace Google with a privacy-respecting search engine
- --threads flag doesn't seem to be used. HOT 11
- Failed to run after building the code browser with llvm/clang-16 HOT 4
- Issues about defining in private and calling in destructor (in llvm/clang-16 and later) HOT 4
- Use .clangd configuration HOT 2
- Error with /usr/include/llvm-7/llvm/ADT/DenseMap.h while compiling HOT 3
- Order buttons don't work HOT 2
- Can not build codebrowser with the latest version of LLVM (LLVM-13) HOT 1
- Declarations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codebrowser.