Integrating external library (libsodium)

I’m trying to integrate my code as a library. It depends on a library called (lib)sodium, probably well known to many of you. My folders are structured like this:

root --> main.cpp
     --> OurLibrary --> OurLIbrary.h
                    --> OurLibrary.a
                    --> libsodium    --> sodium.h
                                     --> libsodium.a
                                     --> sodium      --> ...

The libsodium headers include <types.h> somewhere, which doesn’t work using the online compiler. I get the following compiler error:
Info: ‘types.h’ file not found in “OurLibrary/libsodium/sodium/crypto_onetimeauth_poly1305.h”, Line: 15, Col: 10

Why is <types.h> not findable in MBed OS? It seems to be a system library. And libsodium should compile to ARM.

Any insight will be of help!

Hi Yuri,

Have you tried using sys/types.h?


I think that configuring libsodium in a different way caused the “types.h” to be rewritten to “sys/types.h”, because that’s the way it is compiled now. And that works!

@sayhuthut I posed another question related to libsodium on Mbed through Stackoverflow:

Maybe you could provide some insight on that as well?

The most common reason of Mutex Not allowed in ISR context is using printf() in ISR. Check if it is used in libsodium, and maybe try to configure it in release level or just disable the function call.