Menu

can't compile cppcheck 2.0 gui

2020-05-10
2020-05-10
  • Volker Dirr

    Volker Dirr - 2020-05-10

    Hallo,

    i can't compile cppcheck 2.0 anymore (while i was able to compile older
    versions fine).
    it failed, because:
    resultsview.ui: Warning: The name 'layoutWidget' (QWidget) is already in
    use, defaulting to 'layoutWidget1'.
    ../lib/exprengine.cpp:145:10: fatal error: z3++.h: Datei oder
    Verzeichnis nicht gefunden
    145 | #include <z3++.h>
    | ^~~~~~~~
    compilation terminated.</z3++.h>

    What do i need to install for that?

    Best Regards

     
  • Volker Dirr

    Volker Dirr - 2020-05-10

    ahh... sorry. i found myself.
    i need to install
    sudo apt-get install libz3-dev

    but now i get this errors:
    ../lib/exprengine.cpp: In member function ‘z3::expr ExprData::getExpr(ExprEngine::ValuePtr)’:
    ../lib/exprengine.cpp:844:71: error: call of overloaded ‘int_val(long long int)’ is ambiguous
    844 | return context.int_val((long long)(intRange->minValue));
    | ^
    In file included from ../lib/exprengine.cpp:145:
    /usr/include/z3++.h:3098:17: note: candidate: ‘z3::expr z3::context::int_val(int)’
    3098 | inline expr context::int_val(int n) { Z3_ast r = Z3_mk_int(m_ctx, n, int_sort()); check_error(); return expr(this, r); }
    | ^~~~~~~
    /usr/include/z3++.h:3099:17: note: candidate: ‘z3::expr z3::context::int_val(unsigned int)’
    3099 | inline expr context::int_val(unsigned n) { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, int_sort()); check_error(); return expr(
    this, r); }
    | ^~~~~~~
    /usr/include/z3++.h:3100:17: note: candidate: ‘z3::expr z3::context::int_val(int64_t)’
    3100 | inline expr context::int_val(int64_t n) { Z3_ast r = Z3_mk_int64(m_ctx, n, int_sort()); check_error(); return expr(this, r); }
    | ^~~~~~~
    /usr/include/z3++.h:3101:17: note: candidate: ‘z3::expr z3::context::int_val(uint64_t)’
    3101 | inline expr context::int_val(uint64_t n) { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, int_sort()); check_error(); return expr(
    this, r); }
    | ^~~~~~~
    make: *** [Makefile:5029: temp/exprengine.o] Fehler 1

    What to do now?

     
  • Daniel Marjamäki

    hmm.. it seems you would need to change lib/exprengine.cpp line 844 from

    return context.int_val((long long)(intRange->minValue));
    

    To:

    return context.int_val((int64_t)(intRange->minValue));
    

    It feels highly unfortunate that this is needed :-(

     
  • Daniel Marjamäki

    Maybe you saw it.. but you can compile Cppcheck with NEW_Z3 ... something like:

    make USE_Z3=yes CPPFLAGS="-DUSE_Z3 -DNEW_Z3" ....
    
     
  • Volker Dirr

    Volker Dirr - 2020-05-10

    Thank you! It compiled fine now. (excpet of 4 warnings, but i guess you know them yourself)

    ../externals/picojson.h: In function ‘bool picojson::parse(Context&, picojson::input<iter>&) [with Context = picojson::default_parse_context; Iter = std::istreambuf_iterator<char, std::char_traits<char=""> >]</char,>’:
    ../externals/picojson.h:249:10: warning: ‘<anonymous>.picojson::value::u</anonymous></iter>
    ’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    249 | u_ = x.u_;
    | ~~~^~~~~~
    ../lib/tokenize.cpp: In member function ‘void Tokenizer::setVarIdPass1()’:
    ../lib/tokenize.cpp:3450:13: warning: ‘decl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    3450 | if (decl) {
    | ^~
    projectfile.cpp: In member function ‘bool ProjectFile::readBool(QXmlStreamReader&)’:
    projectfile.cpp:283:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    283 | ret = (reader.text().toString() == "true");
    | ~~~~~~~~~~~^~
    projectfile.cpp:284:9: note: here
    284 | case QXmlStreamReader::EndElement:
    | ^~~~
    projectfile.cpp: In member function ‘int ProjectFile::readInt(QXmlStreamReader&, int)’:
    projectfile.cpp:308:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
    308 | ret = reader.text().toString().toInt();
    | ~~~~~~~~~~~^~
    projectfile.cpp:309:9: note: here
    309 | case QXmlStreamReader::EndElement:
    | ^~~~
    translationhandler.cpp:30:13: warning: ‘void unused()’ defined but not used [-Wunused-function]
    30 | static void unused()
    | ^~~~~~

     
  • Volker Dirr

    Volker Dirr - 2020-05-10

    By the way:
    i solved it the first time with your first trick (editing lib/exprengine.cpp line 844 ).
    i didn't tried your second trick.
    but i tried this:
    i revertred your first trick and
    edit gui.pro line 29 into "QMAKE_CXXFLAGS += -DUSE_Z3 -DNEW_Z3"
    that also works fine.
    i am not sure. maybe this is nice also in the official release?

     

    Last edit: Volker Dirr 2020-05-10
  • Daniel Marjamäki

    yes that works also

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.