"We are back" « oc.at

cpcheck: "an error occurred"

wergor 12.11.2025 - 08:39 3596 16
Posts

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
ich habe einen bookworm ubuntu 24.04 docker container für meine CI, darin würd ich gern cppcheck ausführen:
Code:
cppcheck --enable=all --inline-suppr --project=application.cppcheck --error-exitcode=-1
cppcheck wirft aber die höchst hilfreiche fehlermeldung
Code:
cppcheck: error: failed to load project 'application.cppcheck'. An error occurred.
einzelne files kann ich aber schon prüfen, z.b.:
Code:
cppcheck src/ltb/ltb_eeprom.c 
Checking src/ltb/ltb_eeprom.c ...
src/ltb/ltb_fstd_info.h:83:25: error: Signed integer overflow for expression '1<<31'. [integerOverflow]
 FSTD_FEATURE_UART = (1 << 31),               //has UART interface
                        ^
src/ltb/ltb_fstd.h:129:26: error: Signed integer overflow for expression '1<<31'. [integerOverflow]
 LTB_ALERT_DIB_SYNC = (1 << 31)
                         ^
root@4185183f62c8:/tmp#

auf debian und ubuntu hosts (nicht im container) funktioniert der check. weis jemand wie ich mehr infos aus cppcheck rauskitzeln kann?
Bearbeitet von wergor am 12.11.2025, 21:11

davebastard

Vinyl-Sammler
Avatar
Registered: Jun 2002
Location: wean
Posts: 13464
hast dus mal mit dem absoluten pfad probiert?

Daeda

Renegade
Registered: Aug 2007
Location: Graz
Posts: 1786
Kommen mit --verbose und/oder --debug vielleicht mehr Details beim Fehler zum Vorschein?

COLOSSUS

Administrator
GNUltra
Avatar
Registered: Dec 2000
Location: ~
Posts: 12340
Poste mal, was (mit installiertem strace, eh klar)
Code:
LC_ALL=C strace -e trace=file -yy -v -Z cppcheck --enable=all --inline-suppr --project=application.cppcheck --error-exitcode=-1
ausgibt. Vielleicht kann man ja schon auf syscall-Ebene nachvollziehen, wo/wie es hakt.

issue

Rock and Stone, brother!
Avatar
Registered: Feb 2003
Location: Linz
Posts: 3718
Mir kommt der --project switch falsch vor:
Zitat

--project=<file>
Run Cppcheck on project. The <file> can be a Visual Studio Solution (*.sln), Visual Studio Project (*.vcxproj), compile database (compile_commands.json), or Borland C++ Builder 6 (*.bpr). The files to analyse, include paths, defines, platform and undefines in the specified file will be used.

edit: oder hast du ein .cppcheck file aus der gui vo dem trum? (hab grad glesn, dass es das geben soll, https://cppcheck.sourceforge.io/manual.pdf page 9)
Bearbeitet von issue am 12.11.2025, 15:29

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
Zitat aus einem Post von davebastard
hast dus mal mit dem absoluten pfad probiert?
gleicher fehler.
Zitat aus einem Post von Daeda
Kommen mit --verbose und/oder --debug vielleicht mehr Details beim Fehler zum Vorschein?
nein, leider nicht.
Zitat aus einem Post von COLOSSUS
Poste mal, was (mit installiertem strace, eh klar)
Code:
LC_ALL=C strace -e trace=file -yy -v -Z cppcheck --enable=all --inline-suppr --project=application.cppcheck --error-exitcode=-1
ausgibt. Vielleicht kann man ja schon auf syscall-Ebene nachvollziehen, wo/wie es hakt.
Code:
root@a5d4aa4b7755:/tmp/repo# LC_ALL=C strace -e trace=file -yy -v -Z cppcheck --enable=all --inline-suppr --project=application.cppcheck --error-exitcode=-1        
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
cppcheck: error: failed to load project 'application.cppcheck'. An error occurred.
+++ exited with 1 +++
oha!

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
Zitat aus einem Post von issue
Mir kommt der --project switch falsch vor:


edit: oder hast du ein .cppcheck file aus der gui vo dem trum? (hab grad glesn, dass es das geben soll, https://cppcheck.sourceforge.io/manual.pdf page 9)

es gibt eine gui? :D
ich hab die hier auf mein projekt zugeschnitten: https://github.com/xanderhendriks/s...cation.cppcheck (benutze auch seinen container dafür)

COLOSSUS

Administrator
GNUltra
Avatar
Registered: Dec 2000
Location: ~
Posts: 12340
Zitat aus einem Post von wergor
Code:
root@a5d4aa4b7755:/tmp/repo# LC_ALL=C strace -e trace=file -yy -v -Z cppcheck --enable=all --inline-suppr -project=application.cppcheck --error-exitcode=-1        
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
cppcheck: error: failed to load project 'application.cppcheck'. An error occurred.
+++ exited with 1 +++
oha!

Das weist lediglich drauf hin, dass beim Lesen deiner Input-Files (mindestens "application.cppcheck") nix schiefgeht, das Problem also eher am Inhalt der Datei(en) liegen wird.

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
ich probiere gerade die gui aus, die sagt beim check einer meiner source files gäb es einen critical error, ich glaub ich weis wo ich weitersuchen muss... danke :)
edit: hab sie gelöscht und cppcheck scheint jetzt durchzulaufen.zu früh gefreut, cppcheck-gui reported keinen fehler mehr aber cppcheck im container zeigt das gleiche verhalten.
Bearbeitet von wergor am 12.11.2025, 18:04

issue

Rock and Stone, brother!
Avatar
Registered: Feb 2003
Location: Linz
Posts: 3718
Vielleicht ists ein bug in der version von cppcheck in debian (die is vo 2023 wenn ich des richtig dales). Der letzte commit in dem sample repo war "Disable cppcheck for now" btw :D

COLOSSUS

Administrator
GNUltra
Avatar
Registered: Dec 2000
Location: ~
Posts: 12340
Wieso soll es eigentlich unbedingt das cppcheck aus bookworm sein, und nicht aus trixie?

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
Zitat aus einem Post von issue
Der letzte commit in dem sample repo war "Disable cppcheck for now" btw
ich weis :D
Zitat aus einem Post von COLOSSUS
Wieso soll es eigentlich unbedingt das cppcheck aus bookworm sein, und nicht aus trixie?
das iamge das ich verwende (https://hub.docker.com/r/xanderhendriks/stm32cubeide) basiert auf bookworm, ich hab noch nicht versucht ein eigenes zu bauen.

issue

Rock and Stone, brother!
Avatar
Registered: Feb 2003
Location: Linz
Posts: 3718
jetzt bin ich dazed and confused: https://github.com/xanderhendriks/d...3/Dockerfile#L1
sagt das ist ein ubuntu 24.04

wergor

connoisseur de mimi
Avatar
Registered: Jul 2005
Location: vulkanland
Posts: 4252
tatsächlich! wie bin ich auf bookworm gekommen? muss ein anderes image gewesen sein :D

issue

Rock and Stone, brother!
Avatar
Registered: Feb 2003
Location: Linz
Posts: 3718
vergleich wirklich mal die versionen, imo ein cppcheck bug mit dem gui project file.
alternativ wurscht die project config auf cli args um und gib die mit
Kontakt | Unser Forum | Über overclockers.at | Impressum | Datenschutz