Linking custom library error

Forum related to ERIKA Enterprise and RT-Druid version 3

Moderator: paolo.gai

Post Reply
reis220
Newbie
Posts: 9
Joined: Sun Feb 17, 2019 8:48 pm

Linking custom library error

Post by reis220 » Tue Apr 09, 2019 3:48 pm

I'm trying to link a custom library i've downloaded (https://github.com/IAIK/armageddon) to use with Erika.
I've included the header file which contains the library function declarations and the path to the library as you can see below:

Code: Select all

CFLAGS = "-I/home/joao/armageddon/libflush/libflush";
LIBS = "-lflush";
LDFLAGS = "-L/home/joao/armageddon/libflush/build/armv8/release";
But somehow i receive many errors saying that there are undefined references to most of the functions included in the library.

When i try to compile a linux code that uses the library functions using the following command:

Code: Select all

aarch64-linux-gnu-gcc linux_code.c -L/home/joao/armageddon/libflush/build/armv8/release -lflush -o linux_code.o
It compiles without errors. Do you have any idea what might be the problem with compiling the Erika code?
Attachments
Captura de ecrã de 2019-04-09 15-43-25.png
Captura de ecrã de 2019-04-09 15-43-25.png (219.9 KiB) Viewed 2135 times

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: Linking custom library error

Post by e.guidieri » Tue Apr 09, 2019 6:14 pm

Hi,

the problem seems to be that libflush, depends on C library, so you need a baremetal port of the lib C in your toolchain (and link it explicitly through LDFLAGS and LIBS in OIL as you have done for the flush lib it self).

When you link for linux the toolchains implicitly links the libc (if you don't prevent so).
ERIKA's buildsystem prevents automatic libc linking especially since linking a libc compiled for linux would crash everything at runtime.

Here some reference to get a baremetal toolchain for ARM with a newlib port (the tutorial is about using C++ code in ERIKA, but the problem it's the same).

http://www.erika-enterprise.com/wiki/in ... 2B_support

The default linker script of ERIKA's should be enough to link the newlib, but the support is still experimental.

Errico

Post Reply