Skip to content

Tutorial : How to link against other kind of libraries ?

mbats edited this page Jan 13, 2013 · 13 revisions

This tutorial describes how to configure Eclipse to link against libraries which are not exposed by pkg-config.

Buildroot setup

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.

Update Eclipse project properties

In the Eclipse project which uses your Buildroot toolchain, if you write some code using the PolarSSL library, the includes will be unresolved : Eclipse Unresolved Inclusion

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 : Eclipse Project Properties

Next, go to C/C++ Build -> Build Variables and add the following variable : SYSROOT = /your/toolchain/output/host/usr/arm-unknown-linux-gnueabi/sysroot Eclipse Build Variables Eclipse Build Variables Eclipse Build Variables

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 Eclipse Settings Includes

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 Eclipse Linker Flags

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 Eclipse Paths and Symbols

Click on the OK button.

Build the project.

In the current editor, you can see that the PolarSSL inclusions are now resolved : Eclipse Resolved Inclusion