[riot-devel] Linking new libraries

Kliem, Sebastian Sebastian.Kliem at student.hpi.uni-potsdam.de
Wed Jan 3 10:02:39 CET 2018


Hi altogether,

tl;dr: I want to include an external library for supporting a new board/C++ with that board. That library seems not to get linked when compiling a program for that board. How can I tell the Make system to also link that library?

I am completely new to the RIOT project and for a university project I try to add C++ support for RIOT on Arduino Nano / ATMega328P. There is already a pull request to support this board [1 <https://github.com/RIOT-OS/RIOT/pull/7540>] and I do my work [2 <https://github.com/sebastiankliem/RIOT/tree/arduino-nano-cpp-support>] based on that PR. Compiling programs for this board are done using avr-gcc/avr-g++. These compilers do not ship the C++ STL or the libstdc++, so the abilities of using C++ are a bit limited. Therefore I want to include an Arduino compatible implementation of libstdc++ [3 <https://github.com/tsandmann/ulibcxx>].
I included that external library as additional folder within cpu/atmega328p and added a `export INCLUDES += …` to the corresponding Makefile.include. When I compile an example C++ program for the Nano board, e.g. examples/riot_and_cpp, it seems to work fine until at the very end when all files are linked. I get an `undefined reference` error. As I found out so far, this is very likely a linking problem: When compiling all other files the path for my custom library is included via the -I option, but the library itself does not get compiled.

So how can I tell the Make system to also link that library?


Thanks and best regards,
Sebastian

[1] https://github.com/RIOT-OS/RIOT/pull/7540 <https://github.com/RIOT-OS/RIOT/pull/7540>
[2] https://github.com/sebastiankliem/RIOT/tree/arduino-nano-cpp-support <https://github.com/sebastiankliem/RIOT/tree/arduino-nano-cpp-support>
[3] https://github.com/tsandmann/ulibcxx <https://github.com/tsandmann/ulibcxx>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20180103/6f107a9d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5189 bytes
Desc: not available
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20180103/6f107a9d/attachment-0001.bin>


More information about the devel mailing list