[cfe-dev] Build problems on svn trunk. Autotools. Definition does not match in clang::ento

Tim Murphy tnmurphy at gmail.com
Tue Aug 13 01:00:34 PDT 2013


Hi,

I had a couple of mysterious build problems on the svn trunk recently
and I'm not smart enough to fix them but I thought I could at least
mention them to someone else.  I don't know if the problems are really
bugs or just my poor reading of the build instructions.

I was building with clang and clang++ 3.3 on Fedora 19 x86_64. I don't
remember the revision at this point although it was Sunday 11th August
and must have been on or before r161722.

1. GNU Autotools build.
Whatever I did, I couldn't get this to work.  I tried building only
the x86_64 platform and that caused a lot of failures from pieces of
code that obviously expected the other platforms to be there.  When I
built with all the platforms I got almost everything to build but
still had errors about the MBlaze platform (obviously llvm not clang)
and then some much more mysterious problems which seemed to be related
to undefined macros that were clang related.  I forgot to save the
output from this which is stupid and I'm not greatly eager to repeat
the experience but I certainly will if asked.  I don't know if
autotools is supposed to be maintained but if so then it doesn't work
for me.

2. Cmake
With cmake there was eventual success but I had to patch it because I
reached something very hard to understand that related to namespaces.
I don't want to submit a full patch because I don't really understand
the problem and what I did could easily have been incorrect but I
thought that the registration of checkers was not very uniform and
seemed to be happening in the wrong namespaces. It might have been a
clang3.3 bug in the way namespaces are handled - that is the only
reason I can imagine for everyone else being able to build this and
not me.

The kind of error I got was:

========
[ 96%] Building CXX object
tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/clangStaticAnalyzerCheckers.dir/DebugCheckers.cpp.o
/home/tim/build/llvm/tools/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp:200:12:
error:
      out-of-line definition of 'registerExplodedGraphViewer' does not
match any declaration in
      namespace 'clang::ento'
void ento::registerExplodedGraphViewer(CheckerManager &mgr) {
========

e.g. in lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp I had
to do this kind of thing to get past namespace errors

 #define REGISTER_CHECKER(name) \
-void ento::register##name(CheckerManager &mgr) {\
+void clang::ento::register##name(CheckerManager &mgr) {\
   mgr.registerChecker<SecuritySyntaxChecker>()->filter.check_##name = true;\
 }

And then there were other complaints about other functions that
weren't declared in the clang:ento namespace but changing them like
this didn't work (in lib/StaticAnalyzer/Checkers/DebugCheckers.cpp):

-void ento::registerExplodedGraphViewer(CheckerManager &mgr) {
+void clang::ento::registerExplodedGraphViewer(CheckerManager &mgr) {
   mgr.registerChecker<ExplodedGraphViewer>();
 }

only this worked:

-void ento::registerExplodedGraphViewer(CheckerManager &mgr) {
+namespace clang { namespace ento {
+void registerExplodedGraphViewer(CheckerManager &mgr) {
   mgr.registerChecker<ExplodedGraphViewer>();
 }
+}}


The total list of modified files was:

ndex: lib/Frontend/CMakeLists.txt   (had to add LLVMBitReader for some reason)
Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
Index: lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
Index: lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp

I'm sorry this isn't more detailed or reasoned. Hope it's useful to someone.

Regards,

Tim



-- 
You could help some brave and decent people to have access to
uncensored news by making a donation at:

http://www.thezimbabwean.co.uk/friends/



More information about the cfe-dev mailing list