mkottman / luaclang-parser

Lua binding for libclang, the Clang compiler API to access the AST of C/C++ source files
58 stars 14 forks source link

which version of libclang needed? #2

Open justincormack opened 11 years ago

justincormack commented 11 years ago

I get build errors:

[100%] Building CXX object CMakeFiles/luaclang-parser.dir/luaclang-parser.cpp.o
/home/justin/lua/luaclang-parser/luaclang-parser.cpp: In function ‘void pushDiagnostic(lua_State*, CXDiagnostic)’:
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:70:57: error: ‘clang_getDiagnosticCategoryText’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp: In function ‘int l_parseTU(lua_State*)’:
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:136:77: error: ‘CXTranslationUnit_SkipFunctionBodies’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp: In function ‘const char* cursorKindStr(CXCursorKind)’:
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:370:10: error: ‘CXCursor_VariableRef’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:419:10: error: ‘CXCursor_LambdaExpr’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:420:10: error: ‘CXCursor_ObjCBoolLiteralExpr’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:449:10: error: ‘CXCursor_MSAsmStmt’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:460:10: error: ‘CXCursor_AsmLabelAttr’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp: In function ‘int l_arguments(lua_State*)’:
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:502:58: error: ‘clang_Cursor_getNumArguments’ was not declared in this scope
/home/justin/lua/luaclang-parser/luaclang-parser.cpp:506:47: error: ‘clang_Cursor_getArgument’ was not declared in this scope
make[2]: *** [CMakeFiles/luaclang-parser.dir/luaclang-parser.cpp.o] Error 1
make[1]: *** [CMakeFiles/luaclang-parser.dir/all] Error 2
make: *** [all] Error 2

This is using the version of clang that ships with Ubuntu 12.10 (3.0 I think). Do I need a more recent version?

mkottman commented 11 years ago

On 6 January 2013 20:27, Justin Cormack notifications@github.com wrote:

I get build errors:

This is using the version of clang that ships with Ubuntu 12.10 (3.0 I think). Do I need a more recent version?

Hmm, I built it using clang 3.1, unfortunately these weren't available before. If the values are not essential to you, remove them (cases in cursorKindStr and clang_getDiagnosticCategoryText and l_arguments) and recompile.

justincormack commented 11 years ago

I made a tiny patch here https://github.com/justincormack/luaclang-parser to work with the Ubuntu 3.1 PPAs and thats working fine.

I am giving a short talk about using this to generate bindings next week. If you have any tips that would be useful. I must look through your qt binding code in more detail too.

mkottman commented 11 years ago

Please issue a pull request and I will merge it, the change seems trivial and special enough not to influence anything important.

Regarding the binding code, there is actually no binding done yet using luaclang-parser, however there is some special logic in qt4-qobjectdefs-injected.h to recognize Qt signals and slots. lqt uses a custom C++ parser which outputs XML and a custom generator dealing with various kinds of C++ magic. The code looks a bit ugly, if there is anything you'd like to know just ask.