Menu

cppcheck --library=config.file in container get "cppcheck: Failed to load library configuration file“

James Wang
2016-11-09
2016-11-13
  • James Wang

    James Wang - 2016-11-09

    I run ubuntu docker and install cppcheck in container. Most cppcheck actions are fine. But when I ran cppcheck with config file which is tested fine on host machine, got message "cppcheck: Failed to load library configuration file“.

    I tried "strace -o /tmp/strace.out cppcheck --library=config.file" and got :

    open("std", O_RDONLY) = -1 ENOENT (No such file or directory)
    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)
    open("soter.cfg", O_RDONLY) = 3
    fstat(3, {st_mode=S_IFREG|0664, st_size=123, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f318e90e000
    fstat(3, {st_mode=S_IFREG|0664, st_size=123, ...}) = 0
    lseek(3, 0, SEEK_SET) = 0
    read(3, "<?xml version=\"1.0\"?>\n<def>\n<res"..., 123) = 123
    lseek(3, 123, SEEK_SET) = 123
    fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f318e90d000
    write(1, "cppcheck: Failed to load library"..., 64) = 64
    exit_group(1) = ?

    It seems config file was read out and finished with error immediatlly.

    Any tip will be appreciated!

    James

     
  • Daniel Marjamäki

    strange.

    in that output it looks to me as it failed to load std.cfg.

    but you wrote "Most cppcheck actions are fine". So that can't be the problem.

    The code that writes that error message is:

        std::string errmsg;
        switch (err.errorcode) {
        case Library::OK:
            break;
        case Library::FILE_NOT_FOUND:
            errmsg = "File not found";
            break;
        case Library::BAD_XML:
            errmsg = "Bad XML";
            break;
        case Library::UNKNOWN_ELEMENT:
            errmsg = "Unexpected element";
            break;
        case Library::MISSING_ATTRIBUTE:
            errmsg = "Missing attribute";
            break;
        case Library::BAD_ATTRIBUTE_VALUE:
            errmsg = "Bad attribute value";
            break;
        case Library::UNSUPPORTED_FORMAT:
            errmsg = "File is of unsupported format version";
            break;
        case Library::DUPLICATE_PLATFORM_TYPE:
            errmsg = "Duplicate platform type";
            break;
        case Library::PLATFORM_TYPE_REDEFINED:
            errmsg = "Platform type redefined";
            break;
        }
        if (!err.reason.empty())
            errmsg += " '" + err.reason + "'";
        std::cout << "cppcheck: Failed to load library configuration file '" << filename << "'. " << errmsg << std::endl;
    

    Is there no reason why it failed written?

     

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.