Menu

Cppcheck 2.17-dev : analysis stage is very long (many hours)

cgilles
2025-01-25
2025-01-27
  • cgilles

    cgilles - 2025-01-25

    Hi,

    I'm the digiKam project coordinator and a big cppcheck fan. We have used
    your tool for a decade to verify all the implementation and modernize the
    code (larger than 1.5M C++ lines).

    I currently experiment the current cppcheck code that i installed on my
    Linux Kubuntu 24.04 computer using this configuration:

    https://invent.kde.org/graphics/digikam/-/blob/master/project/scripts/bootstrap-cppcheck.sh?ref_type=heads

    And we run cppcheck over the whole project by this script :

    https://invent.kde.org/graphics/digikam/-/blob/master/project/reports/cppcheck.sh?ref_type=heads

    The configuration is separated in this file :

    https://invent.kde.org/graphics/digikam/-/blob/master/.cppcheck?ref_type=heads

    On my host computer (i9 - 32 cores - 64 Gb of Ram) the analysis is
    separated in 3 stages :

    1/ code parsing : around 10mn.
    2/ the analysis to generate the xml output : around many hours.
    3/ the html report output generated from the xml : few minutes.

    The problem is with the stage 2/. I know that we use the famous "
    --check-level=exhaustive" which is time consuming process especially with a
    large project as digiKam, but i observed this point, visible on my desktop
    screenshot:

    https://imgur.com/a/AocORcn

    As you can see, the stage 2/ process only uses one core on my computer.
    There is no parallelization at all. 3% of computer power is ridiculous
    (:=))))....

    So, my question is: any improvements are planned to speed the stage 2/ in
    the future ?

    Thanks in advance.

    Best regards

    Gilles Caulier

     
  • CHR

    CHR - 2025-01-25

    Does the -j$CPU_CORES option in fact expand to -j32? The behavior seems to be more like -j1.
    You could try adding --cppcheck-build-dir=mybuilddir and see if that changes anything (mybuilddir must exist).

    NB: if you pass --enable=all, you might as well use --inconclusive, since some checks are inconclusive by default.

     
  • cgilles

    cgilles - 2025-01-25

    yes, $CPU_CORES is equal to 31 (max cpu cores -1). This is the trace of the start of the script :

    gilles@KU2404:~/devel/GIT/8.x/project/reports$ ./cppcheck.sh
    CPU Cores to use : 31
    Check Cppcheck static analyzer passed...
    CppCheck Static Analyzer task name: digiKam-master-rev-708da53740
    Skipped dir: ../../core/libs/dimg/filters/transform/lqr/
    Skipped dir: ../../core/libs/pgfutils/libpgf/
    Skipped dir: ../../core/libs/dimg/filters/greycstoration/cimg/
    Skipped dir: ../../core/libs/jpegutils/libjpeg/
    Skipped dir: ../../core/libs/rawengine/libraw/
    Skipped dir: ../../core/libs/dngwriter/extra/
    Skipped dir: ../../core/libs/dplugins/webservices/o2/
    Skipped dir: ../../core/dplugins/generic/tools/mediaserver/upnpsdk/
    Skipped dir: ../../core/dplugins/generic/webservices/unified/
    Skipped dir: ../../core/dplugins/generic/webservices/rajce/
    Skipped dir: ../../core/dplugins/generic/webservices/ipfs/
    Skipped dir: ../../core/dplugins/generic/webservices/facebook/
    Skipped dir: ../../core/libs/video/QtAVPlayer/
    Skipped dir: ../../core/utilities/geolocation/engine/
    Skipped dir: ../../opt/qt6/include/
    Skipped dir: ../../usr/include/
    Skipped dir: ../../project/
    Skipped dir: ../../build/
    Skipped dir: ../../build.qt6/
    Skipped dir: ../../build.scan/
    Skipped dir: ../../build.api/
    Skipped dir: ../../build.win32/
    Skipped dir: ../../build.win64/
    Skipped dir: ../../build.clazy/
    Skipped dir: ../../po/
    Skipped dir: ../../test-data/
    Skipped dir: ../../LICENSES/
    Cppcheck defines : -DQ_OS_LINUX -DQ_OS_UNIX -DQ_PROCESSOR_X86_64 -DHAVE_GEOLOCATION -DHAVE_MEDIA_PLAYER -DHAVE_QWEBENGINE -DHAVE_QTMULTIMEDIA -DHAVE_OPENGL -DHAVE_MYSQLSUPPORT -DHAVE_INTERNALMYSQL -DHAVE_GPHOTO2 -DHAVE_PANORAMA -DHAVE_X11 -DHAVE_X265 -DHAVE_DBUS -DHAVE_LENSFUN -DHAVE_HEIF -DHAVE_JXL -DHAVE_EIGEN3 -DHAVE_JASPER -DHAVE_IMAGE_MAGICK -D_XMP_SUPPORT_
    Cppcheck options : --std=c++17 --library=qt.cfg --library=opencv2.cfg --library=boost.cfg --library=kde.cfg --platform=unix64
    Cppcheck suppressions: --inline-suppr --suppress=:cimg.h --suppress=:libraw.h --suppress=:libpgf.h --suppress=:upnpsdk.h --suppress=:o2.h --suppress=:lqr.h --suppress=:libjpeg.h --suppress=:dng_sdk.h --suppress=:xmp_sdk/.h --suppress=:qav.h --suppress=missingIncludeSystem --suppress=missingInclude --suppress=variableScope --suppress=purgedConfiguration --suppress=toomanyconfigs --suppress=unreadVariable --suppress=unusedVariable --suppress=unusedStructMember --suppress=unusedPrivateFunction --suppress=unknownMacro --suppress=unmatchedSuppression --suppress=unassignedVariable --suppress=class_X_Y --suppress=ConfigurationNotChecked --suppress=checkersReport --suppress=constVariablePointer --suppress=useStlAlgorithm
    cppcheck: unusedFunction check requires --cppcheck-build-dir to be active with -j.
    Checking ../../core/app/date/datefolderview.cpp ...
    ...

     
  • cgilles

    cgilles - 2025-01-25

    ok. i enabled the cache dir and turn on --inconclusive. Wait and see...

     
  • cgilles

    cgilles - 2025-01-25

    Hum the --inconclusive and the cache dir enabled do not change anything. Only one cppcheck process run at analysis time at 3% of CPU.

    Anyway the cache mechanism gain will be only visible at the next analysis as it's the first time that i turn on this option.

    Nota: the file parsing stage at stage 1/ is paralelized and 31 cppcheck instance run at the same time while this process. At stage 2/, only one cppcheck still in memory and run alone.

    Best

    Gilles Caulier

     
  • CHR

    CHR - 2025-01-25

    So all source files have already been processed when stage 2 begins, correct? Would you be able to produce a stack trace during stage 2?

    My side note about --inconclusive was not meant to be related to performance.

     
  • cgilles

    cgilles - 2025-01-25

    So all source files have already been processed when stage 2 begins, correct?

    I supose, as no more message appears on the console. In fact the console trace is like below:

    ...
    2037/2065 files checked 97% done
    2038/2065 files checked 97% done
    Checking ../../core/utilities/setup/metadata/setupmetadata_p.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    2039/2065 files checked 97% done
    Checking ../../core/utilities/setup/metadata/setupmetadata_rotation.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/setuptemplate.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/setupplugins.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/setuptooltip.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/setuplighttable.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/metadata/setupmetadata_sidecars.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/misc/setupmisc.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    2040/2065 files checked 97% done
    2041/2065 files checked 97% done
    2042/2065 files checked 97% done
    Checking ../../core/utilities/setup/setupicc.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    2043/2065 files checked 97% done
    2044/2065 files checked 97% done
    2045/2065 files checked 97% done
    2046/2065 files checked 97% done
    Checking ../../core/utilities/setup/setup.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    Checking ../../core/utilities/setup/setupdatabase.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;XMP_SUPPORT=1...
    2047/2065 files checked 97% done
    2048/2065 files checked 97% done
    2049/2065 files checked 97% done
    2050/2065 files checked 97% done
    2051/2065 files checked 98% done
    2052/2065 files checked 98% done
    2053/2065 files checked 98% done
    2054/2065 files checked 98% done
    2055/2065 files checked 98% done
    2056/2065 files checked 98% done
    2057/2065 files checked 98% done
    2058/2065 files checked 98% done
    2059/2065 files checked 98% done
    2060/2065 files checked 98% done
    2061/2065 files checked 99% done
    2062/2065 files checked 99% done
    2063/2065 files checked 99% done
    2064/2065 files checked 99% done

    Until this point, the processing take a few minutes. After this point, nothing is printed while few hours until stage 3/ where the html report is processed quickly.

    Would you be able to produce a stack trace during stage 2

    Sure. How do you want to process exactly ?

    Best

    Gilles Caulier

     
  • CHR

    CHR - 2025-01-25

    If you are able to build cppcheck from source and break into a debugger, it will probably be pretty easy to spot where the time is spent during stage 2.

     
  • cgilles

    cgilles - 2025-01-26

    Hi,
    First test with the cache dir enabled, the analysis take 10 seconds only. It's very impressive.
    Best

    Gilles Caulier

     
  • cgilles

    cgilles - 2025-01-26

    In GDB, this is where the code run when cache is cleaned and analysis works for a while:

    _GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2039/2065 files checked 97% done
    Checking ../../core/utilities/setup/metadata/setupmetadata_rotation.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/metadata/setupmetadata_p.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/setuplighttable.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2040/2065 files checked 97% done
    Checking ../../core/utilities/setup/metadata/setupmetadata_sidecars.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/misc/setupmisc.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/setuptemplate.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/setupplugins.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2041/2065 files checked 97% done
    Checking ../../core/utilities/setup/setuptooltip.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    Checking ../../core/utilities/setup/setupicc.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2042/2065 files checked 97% done
    2043/2065 files checked 97% done
    Checking ../../core/utilities/setup/setupdatabase.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2044/2065 files checked 97% done
    Checking ../../core/utilities/setup/setup.cpp: Q_OS_LINUX=1;Q_OS_UNIX=1;Q_PROCESSOR_X86_64=1;HAVE_GEOLOCATION=1;HAVE_MEDIA_PLAYER=1;HAVE_QWEBENGINE=1;HAVE_QTMULTIMEDIA=1;HAVE_OPENGL=1;HAVE_MYSQLSUPPORT=1;HAVE_INTERNALMYSQL=1;HAVE_GPHOTO2=1;HAVE_PANORAMA=1;HAVE_X11=1;HAVE_X265=1;HAVE_DBUS=1;HAVE_LENSFUN=1;HAVE_HEIF=1;HAVE_JXL=1;HAVE_EIGEN3=1;HAVE_JASPER=1;HAVE_IMAGE_MAGICK=1;_XMP_SUPPORT_=1...
    2045/2065 files checked 97% done
    2046/2065 files checked 97% done
    2047/2065 files checked 97% done
    2048/2065 files checked 97% done
    2049/2065 files checked 97% done
    2050/2065 files checked 97% done
    2051/2065 files checked 97% done
    2052/2065 files checked 98% done
    2053/2065 files checked 98% done
    2054/2065 files checked 98% done
    2055/2065 files checked 98% done
    2056/2065 files checked 98% done
    2057/2065 files checked 98% done
    2058/2065 files checked 98% done
    2059/2065 files checked 98% done
    2060/2065 files checked 98% done
    2061/2065 files checked 99% done
    2062/2065 files checked 99% done
    2063/2065 files checked 99% done
    2064/2065 files checked 99% done
    ^C
    Program received signal SIGINT, Interrupt.
    0x00007ffff7926c3e in __GI___select (nfds=37, readfds=0x7fffffff34a0, writefds=0x0, exceptfds=0x0, timeout=0x7fffffff33d0) at ../sysdeps/unix/sysv/linux/select.c:69
    warning: 69     ../sysdeps/unix/sysv/linux/select.c: No such file or directory
    (gdb) bt
    #0  0x00007ffff7926c3e in __GI___select (nfds=37, readfds=0x7fffffff34a0, writefds=0x0, exceptfds=0x0, timeout=0x7fffffff33d0) at ../sysdeps/unix/sysv/linux/select.c:69
    #1  0x00005555555b3d1a in ProcessExecutor::check (this=0x7fffffff3b00) at /home/gilles/devel/GIT/cppcheck/cli/processexecutor.cpp:325
    #2  0x000055555559c92c in CppCheckExecutor::check_internal (this=0x7fffffff48f0, settings=...) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:454
    #3  0x000055555559c133 in CppCheckExecutor::check_wrapper (this=0x7fffffff48f0, settings=...) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:382
    #4  0x000055555559c01e in CppCheckExecutor::check (this=0x7fffffff48f0, argc=1206, argv=0x7fffffff4a68) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:367
    #5  0x000055555557aded in main (argc=1206, argv=0x7fffffff4a68) at /home/gilles/devel/GIT/cppcheck/cli/main.cpp:90
    (gdb) 
    
     
  • CHR

    CHR - 2025-01-26

    Can you see if the time is spent in this loop: while (rp != rpipes.cend()) {? I'm not on Linux, so I can't test it myself.

     
  • cgilles

    cgilles - 2025-01-26

    It always break at line 325 of processexecutor.cpp:

    2056/2065 files checked 99% done
    2057/2065 files checked 99% done
    2058/2065 files checked 99% done
    2059/2065 files checked 99% done
    2060/2065 files checked 99% done
    2061/2065 files checked 99% done
    2062/2065 files checked 99% done
    2063/2065 files checked 99% done
    2064/2065 files checked 99% done
    ^C
    Program received signal SIGINT, Interrupt.
    0x00007ffff7926c3e in __GI___select (nfds=18, readfds=0x7fffffff34a0, writefds=0x0, exceptfds=0x0, timeout=0x7fffffff33d0) at ../sysdeps/unix/sysv/linux/select.c:69
    warning: 69     ../sysdeps/unix/sysv/linux/select.c: No such file or directory
    (gdb) bt
    #0  0x00007ffff7926c3e in __GI___select (nfds=18, readfds=0x7fffffff34a0, writefds=0x0, exceptfds=0x0, timeout=0x7fffffff33d0) at ../sysdeps/unix/sysv/linux/select.c:69
    #1  0x00005555555b3d1a in ProcessExecutor::check (this=0x7fffffff3b00) at /home/gilles/devel/GIT/cppcheck/cli/processexecutor.cpp:325
    #2  0x000055555559c92c in CppCheckExecutor::check_internal (this=0x7fffffff48f0, settings=...) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:454
    #3  0x000055555559c133 in CppCheckExecutor::check_wrapper (this=0x7fffffff48f0, settings=...) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:382
    #4  0x000055555559c01e in CppCheckExecutor::check (this=0x7fffffff48f0, argc=1206, argv=0x7fffffff4a68) at /home/gilles/devel/GIT/cppcheck/cli/cppcheckexecutor.cpp:367
    #5  0x000055555557aded in main (argc=1206, argv=0x7fffffff4a68) at /home/gilles/devel/GIT/cppcheck/cli/main.cpp:90
    (gdb) c
    Continuing.
    2065/2065 files checked 100% done
    [Inferior 1 (process 133567) exited normally]
    (gdb) Quit
    (gdb) 
    

    But strangely, when cppcheck cli run in GDB, when i break execution in stage 2/, after the backtrace, i continue the process and it's out immediately and without crash. The analysis output is fine (i clean the cache and run cppcheck from scratch...

    It sound like a lock somewhere. Here all my linux computer run Kubuntu 24.04 and problem is reproducible everywhere. I must have a VM with XBuntu 20.06 and 22.04 in my officie i will double check this point...

    Gilles Caulier

     
  • cgilles

    cgilles - 2025-01-26

    I can confirm a bug here.

    • Running cppcheck in gdb from my script.
    • Pressing CTRL+C while the stage 2/.
    • Continue in debugger quit the cppcheck instance properly.
    • The script continue and generate the html export, which is "DIFFERENT" than one generated if not running in GDB after few hours to process the stage 2/

    What i means by "DIFFERENT": instead to have 200 reports with the long analysis, i obtain over 3900 reports which are right and suitable.

    So i can conclude that something lock the stage 2/ and corrupt the final results.

    Note : in the results, a report indicate one analysis has crashed while reading code :

    ../../core/libs/dimg/filters/greycstoration/greycstorationfilter.cpp
    0   cppcheckError       error   Internal error: Child process crashed with signal 2
    

    The complete reports can be downloaded as tarball at this place:

    https://files.kde.org/digikam/reports/cppcheck_master.tar.xv.mirrorlist

    Best

    Gilles Caulier

     
  • CHR

    CHR - 2025-01-26

    Thanks for your detailed report, I have created this ticket: https://trac.cppcheck.net/ticket/13584

     
  • cgilles

    cgilles - 2025-01-27

    Hi,
    I can confirm the bug with the cppcheck thread crashed in core/libs/dimg/filters/greycstoration/greycstorationfilter.cpp. I disable the cppcheck scan in this directory, and the scan now take 10 mn only.

    The crash is not relevant of large threads created while scanning under linux but a crash due to huge implementation from this directory. It contains a copy of the CImg C+++ header (an image processing lib implemented in of header only):

    https://invent.kde.org/graphics/digikam/-/tree/master/core/libs/dimg/filters/greycstoration/cimg?ref_type=heads

    Disabling the CImg sub directory in greycstoration is not enough. The private usage of CImg.h must be also banned.

    Do not ask me why the CImg author use only one giant header for a C++ library. It's definitively a wrong way at all...

    Best regards

    Gilles Caulier

     
  • CHR

    CHR - 2025-01-27

    Thanks for reporting back, I have updated the ticket accordingly.

     
  • cgilles

    cgilles - 2025-01-27

    How to reproduce :

    1/ Checkout whole digiKam code from the git repository :

    git clone https://invent.kde.org/graphics/digikam.git ./ DIGIKAM

    2/ Checkout cppcheck code from github repository, configure and install in /opt :

    git clone https://github.com/danmar/cppcheck.git ./CPPCHECK
    cp ./DIGIKAM/project/scripts/bootstrap-cppcheck.sh ./CPPCHECK
    cd ./CPPCHECK && ./bootstrap-cppcheck.sh && cd build && make
    sudo make install/fast

    3/ Edit the cppcheck configuration in ./DIGIKAM/.cppcheck to drop the line 13:

    IGNORE_DIRS+="-i ../../core/libs/dimg/filters/greycstoration/ "

    4/ Run the cppcheck script to perform the whole analysis:

    cd ./DIGIKAM/project/reports && ./cppcheck ----nowebupdate

    Enjoy the dysfunction...

    Best

    Gilles Caulier

     

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.