-
Notifications
You must be signed in to change notification settings - Fork 17
Tutorial : How to link against other kind of libraries ?
This tutorial describes how to configure Eclipse to link against libraries which are not exposed by pkg-config.
To see how to configure build to add some specific library to the toolchain have a look to the section Select a library in Buildroot in the How to link against libraries exposed by pkg-config tutorial.
In the Eclipse project which uses your Buildroot toolchain, if you write some code using the PolarSSL library, the includes will be unresolved :
We must add the PolarSSL library to the list of libraries against which the project will be built. To do so, go to the project build properties, by right-clicking on the project in the Project Explorer :
Next, go to C/C++ Build
-> Build Variables
and add the following variable :
SYSROOT = /your/toolchain/output/host/usr/arm-unknown-linux-gnueabi/sysroot
In a future version of the Buildroot Toolchain Eclipse plugin, the SYSROOT
variable will be created automatically.
Then, go to C/C++ Build
-> Settings
-> Tool Settings
tab and select Buildroot ARM C Compiler
.
Set Includes
-> Include paths (-l)
to the library include folder existing in your toolchain : ${SYSROOT}/usr/include/polarssl
We have to define now the flags for the linker, so go to C/C++ Build
-> Settings
-> Buildroot ARM C Linker
and set in Libraries
-> Libraries (-l)
: polarssl
Finally, we should define include paths and preprocessor symbols so that the CDT parser understands the contents of the C/C++ source code. Then we will be able to use the search and code completion features more effectively.
In C/C++ General
-> Paths and Symbols
-> Includes
-> GNU C
, set :
${SYSROOT}/usr/include/polarssl
Click on the OK
button.
Build the project.
In the current editor, you can see that the PolarSSL inclusions are now resolved :