12

I am trying to use unit testing framework for C called Check.

I installed the package as instructed on the file INSTALL in the package:

  1. ./configure
  2. make
  3. make check -> run self-tests that come with the package (pass successfully).
  4. make install

After doing that I failed to run my own test so finally I decided to use the package example in /usr/local/share/doc/check/example.

Did the following commands:

$ autoreconf --install
$ ./configure
$ make
$ make check

And still the same problem :

/usr/local/share/doc/check/example/tests/.libs/lt-check_money: error while loading shared libraries: libcheck.so.0: cannot open shared object file: No such file or directory
FAIL: check_money

Tried to add the directory to LDFLAGS in the make file but that did not help, also tried to do what Rick Hightower did here (...deleting the *.so files (and their links)) by I don't know how to remove the links

sth
  • 222,467
  • 53
  • 283
  • 367
Hagai
  • 1,049
  • 11
  • 13

3 Answers3

17

Try running ldconfig (ie. sudo ldconfig) to rebuild the runtime linker cache.

Nordic Mainframe
  • 28,058
  • 10
  • 66
  • 83
2

On my system at least (Debian), libcheck isn't packaged as a shared library, you have to link it statically, e.g.

gcc -o test_program test1.o test2.o /usr/lib/libcheck.a
Matthew Bloch
  • 357
  • 2
  • 10
  • Alternatively, you can place the line `export LD_LIBRARY_PATH=/usr/lib/` (adjust path to location of your libcheck installation - if you installed it for a single user it may be in `/home/$user/usr/lib/`, for example) in your `.bashrc`. After `source ~/.bashrc`ing it, it should work. This way it should work for your other projects too. – deepbrook Aug 17 '17 at 17:33
0

This project uses check https://github.com/batousik/Practical-C2

  1. For some reason a folder m4 is required
  2. .travis.yml has instructions for dependences
  3. after it is run script -
  4. configure.ac, makefile.am, src/makefile.am, tests/makefile.am are files to look at
Bato-Bair Tsyrenov
  • 1,174
  • 3
  • 17
  • 40