Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while loading shared libraries: libcmocka.so.0: No such file or directory

Tags:

c

unit-testing

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
/* A test case that does nothing and succeeds. */
static void null_test_success(void **state) {
    (void) state; /* unused */
}
int main(void) {
    const UnitTest tests[] = {
        unit_test(null_test_success),
    };
    return run_tests(tests);
}

I am new to cmocka unit testing framework, http://www.ohloh.net/p/cmocka. When I compiled the above program as gcc program.c -lcmocka and when i ran ./a.out I got the error:

./a.out:error while loading shared libraries: libcmocka.so.0: cannot open shared object file: No such file or directory

I tried but cannot fix it. What exactly is the problem here?

like image 366
Abhishek Singh Avatar asked Feb 23 '13 16:02

Abhishek Singh


1 Answers

can you check if you have permission to access the folder /usr/local/lib/

Do a ls -lart /usr/local/lib/libcmocka.so and check for the access permission and check if you have read permission

like image 83
Pradheep Avatar answered Nov 14 '22 04:11

Pradheep