cppcheck build issue

2017-02-06
2017-02-06
  • RupeshKumar

    RupeshKumar - 2017-02-06

    I downloaded the zip file from https://github.com/danmar/cppcheck/tree/1.77, unzipped it and gave a make command which generated cppcheck binary.

    Next when I run the cppcheck on a test code no error is generated.

    sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # cppcheck /home/demo_code/test_code.c 
    Checking /home/demo_code/test_code.c ...
    

    The source code is

    sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # vi  /home/demo_code/test_code.c
    main(int argc, char* argv[])
    {
            char cobj[7] = "yahoo";
            char    *cobjPtr = cobj;
            int iobj = 4;
    
            printf("###########################     CPPCHECK TEST   ############################\n");
          yahoo
    
    }
    

    When I tried to compile using the other build command specified in the above mentioned page I get below error

    sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # make SRCDIR=build CFGDIR=cfg HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"
    
    make: pcre-config: Command not found
    g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/analyzerinfo.o build/analyzerinfo.cpp
    make: pcre-config: Command not found
    g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/astutils.o build/astutils.cpp
    make: pcre-config: Command not found
    g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/check.o build/check.cpp
    make: pcre-config: Command not found
    .
    .
    .
    

    I tried building the cppcheck 1.76 version but I get different error there:

    sles12-box:/home/test/cppchecker_test/1.76/cppcheck-1.76.1 # sudo make install
    Makefile:88: Extraneous text after `else' directive
    Makefile:90: Extraneous text after `else' directive
    Makefile:90: *** only one `else' per conditional.  Stop.
    

    How to get the cppcheck setup ready and functional?

     
  • Daniel Marjamäki

    If you write HAVE_RULES=yes then pcre must be available. So you have two options:
    1. Remove HAVE_RULES=yes
    2. Install pcre

     
    Last edit: Daniel Marjamäki 2017-02-08

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks