Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 404
zilleplus Avatar asked Mar 18 '14 17:03

zilleplus


4 Answers

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.

like image 179
prabhugs Avatar answered Sep 27 '22 02:09

prabhugs


make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes

make install CFGDIR=/usr/bin/cfg
like image 22
user3990375 Avatar answered Sep 27 '22 02:09

user3990375


I had same issue few days ago and solved by changing the way I run makefile on cppcheck.

I use Linux Red Hat version and cppcheck version is 1.65.

make SRCDIR=build CFGDIR=/home/###/####/cppcheck-1.65/cfg/ && make install

I didn't really dig into the detail but makefile of cppcheck look like they are clearing up obj and build cppcheck including cfg location by first make command

make SRCDIR=build CFGDIR=/home/###/####/cppcheck-1.65/cfg/ &&

and second make command would distribute cppcheck into /usr/bin/ location.

make install

Now all you have to do is to set up bash.

like image 2
j. cho Avatar answered Sep 28 '22 02:09

j. cho


Check permissions, with file /usr/bin/cfg/std.cfg, to ensure you have permissions to access the config file that you think it should be trying to read.

Then, failing that, run cppcheck under strace to find the system call that's failing: strace -o /tmp/strace.out cppcheck ListLib.c.

like image 1
R Perrin Avatar answered Sep 28 '22 02:09

R Perrin