carloscn/blog

How to compile mbedtls library on Linux/Mac/Windows

carloscn opened this issue · 0 comments

How to compile mbedtls library on Linux/Mac/Windows

[Brief] mbedtls library is arm security suite for embedded device. It can be MAKE on multi-platform as host linux, mac os even windows OS. This paper guide you configuring and compiling the mbedtls library on Linux/Mac/Windows OS and link the output binary library files on your C project.

1 Code Prepare

MKDIR a path for saving your code. I named it work and cd work path. Using the git clone function to pull the newest mbedtls code as follows cmd.

git clone https://github.com/ARMmbed/mbedtls.git

2 Env Prepare

As a Linux user you need prepare gcc compiler.

As a Windows user I recommend you using the mingw compiler.

As a Mac user you can use same as linux gcc.

3 Compile Code

linux and mac user : make SHARED=1

and sudo make install

that is different from linux and mac user:

set WINDOWS=1 mingw32-make CC=gcc

windows mingw user: mingw32-make CC=gcc SHARED=1 -j8

4 Detail the Path

linux and mac user please find library files and include path in /usr/local/lib and /usr/local/include you can find

libmbedcrypto.so

libmbedtls.so

libmbedx509.so

and related .a file.

windows mingw user need copy the library and include path or files on compiled path.