3

I have installed the raspicam API as instructed here: http://www.uco.es/investiga/grupos/ava/node/40

It appears to be installed correctly.

When I compile any programs linking libmmal I get the errors:
/usr/bin/ld: cannot find -lmmal
/usr/bin/ld: cannot find -lmmal_core
/usr/bin/ld: cannot find -lmmal_util

I have tried updating the pi and reinstalling the API but I just can't get it to compile.

1 Answer 1

3

Try ldconfig -p | grep libmmal. On raspbian you should get:

    libmmal_vc_client.so (libc6,hard-float) => /opt/vc/lib/libmmal_vc_client.so
    libmmal_util.so (libc6,hard-float) => /opt/vc/lib/libmmal_util.so
    libmmal_core.so (libc6,hard-float) => /opt/vc/lib/libmmal_core.so
    libmmal_components.so (libc6,hard-float) => /opt/vc/lib/libmmal_components.so
    libmmal.so (libc6,hard-float) => /opt/vc/lib/libmmal.so

If not, add to your question the contents of the few short files in /etc/ld.so.conf.d. If you are not using raspbian, you should give your OS.


This means the relevant libraries are available on the system and if you build an executable linking them, there should not be a problem. However, there may be a problem building the executable; in this case it seems when gcc invokes the linker, /opt/vc/lib is not in its path even though it is in the runtime loader path (they are not quite the same). If you use gcc -v, you'll see there are some non-standard paths being used as options (e.g., /usr/lib/gcc/arm-linux-gnueabihf), but not that one. However, you can specify it yourself:

gcc test.c -L/opt/vc/lib -lmmal

Should work. You can also:

export LIBRARY_PATH=/opt/vc/lib

This variable is probably not predefined but you'll see those other paths added to it in gcc -v output. Note it is not the same as LD_LIBRARY_PATH, which is used by the runtime loader.

4
  • I get exactly this output Nov 10, 2014 at 15:09
  • Hmm, I just downloaded v0.1.1 and test compiled it following the instructions from that page; make seems to have completed without error. There's a .so in build/src and some tests in build/utils.
    – goldilocks
    Nov 10, 2014 at 15:33
  • Sorry, I wasn't clear I'll update the question - the error is when I compile a test program. So anything of the form: g++ -o out main.cpp -lraspicam -lmmal -lmmal_core -lmmal_util Nov 10, 2014 at 15:43
  • Okay, the issue is the difference between the paths used by the compile time linker and the runtime loader ;) I've added a few paragraphs about that.
    – goldilocks
    Nov 10, 2014 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.