cppcheck std.cfg not found error when std.cfg file is available

zilleplus picture zilleplus · Mar 18, 2014 · Viewed 15.5k times · Source

If i launch my cppcheck i get following error: cppcheck ListLib.c (information) Failed to load std.cfg. Your Cppcheck installation is broken, please re-install. The Cppcheck binary was compiled with CFGDIR set to "/usr/bin/cfg" and will therefore search for std.cfg in that path.

System : opensuse13 ,cppcheck version: cppcheck-1.64 , compiled with : make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes

checking if file is there: ls /usr/bin/cfg : gtk.cfg posix.cfg qt.cfg sdl.cfg std.cfg windows.cfg

whereis cfg: cfg: /usr/bin/cfg

whereis std.cfg: std: /usr/bin/cfg/std.cfg

cat std: /usr/bin/cfg/std.cfg gives me the output from that file

Stacktrace:

lstat("/home/.../ListLib.c", {st_mode=S_IFREG|0644, st_size=4568, ...}) = 0
stat("/home/.../ListLib.c", {st_mode=S_IFREG|0644, st_size=4568, ...}) = 0
open("std.cfg", O_RDONLY)               = -1 ENOENT (No such file or directory)
open("cfg/std.cfg", O_RDONLY)           = -1 ENOENT (No such file or directory)
write(2, "(information) Failed to load std"..., 213) = 213
write(2, "\n", 1)                       = 1
exit_group(1)                           = ?
+++ exited with 1 +++

changing to /usr/bin directory works: Checking /.../ListLib.c

cppcheck --check-config ListLib.c: gives the same error and works just fine if i do it in /usr/bin/

Okey for people landing on this page i got it working with the cfg files in my homefolder:

make SRCDIR=build CFGDIR=~/cppcheck_cfg and then offcourse
sudo make install

Answer

prabhugs picture prabhugs · Oct 30, 2014

I faced the same problem too.

Solution:

$ make SRCDIR=build CFGDIR=/usr/share/cppcheck/

$ sudo make install CFGDIR=/usr/share/cppcheck/

Got suggestions from the cppcheck community members and came to know that 'make install' also requires the CFGDIR option to be passed.