[Olsr-dev] Loading plugin fails, undefined symbol for olsrd functions

Sven-Ola Tuecke (spam-protected)
Wed Mar 24 13:11:14 CET 2010


Hey,

in trunk, not all functions are exported to plugins to save space, provided 
that you use a recent version of binutils/gnu linker. Have a look at the 
EXPORT() macro definition and be sure to check out the "-Wl,--dynamic-list" 
in Makefile.inc

// Sven-Ola

Am Dienstag 23 März 2010 22:03:16 schrieb Jonathan P. Chapman:
> Hi everyone!
>
> I am working on a link quality plugin with a challenge-response
> mechanism. The HELLO packet format will be incompatible with the regular
> (LQ-)HELLO, so I had to write my own packet parsers etc., but I tried to
> use the existing functions where it seemed appropriate.
>
> However, I am a little stuck now. I will describe my problem with the
> create_lq_hello function below, but it appears with some other functions
> exactly the same way:
>
> Since create_lq_hello is declared and defined in the lq_packet.c file
> only, I declared it as an extern in my lq_challenge_plugin.c file:
> extern void create_lq_hello(struct lq_hello_message *lq_hello, struct
> interface *outif);
>
> This will allow me to compile, however when I try to run olsrd including
> that file, I get the following error:
>
> ---------- LOADING LIBRARY olsrd_lq_etx_challenge.so.0.1 ----------
> DL loading failed: "olsrd_lq_etx_challenge.so.0.1: undefined symbol:
> create_lq_hello"!
>
> I took a look at the olsrd binary with (GNU binutils) nm and the symbol
> does show up (t = The symbol is in the text (code) section.):
> $ nm olsrd |grep create_lq_hello
> 0000000000414917 t create_lq_hello
>
> It does not show up, when using the --extern-only flag, so I tried to
> compile the function into the library.
> When looking at the library with the extern, I get (U = The symbol is
> undefined.):
> $ nm olsrd_lq_etx_challenge.so.0.1 |grep create_lq_hello
>                  U create_lq_hello
>
> To add the respective objects, I added to the (otherwise exactly as in
> lib/mini) Makefile:
>
> SRCS +=        $(TOPDIR)/src/lq_packet.c $(TOPDIR)/src/process_package.c
> HDRS +=        $(TOPDIR)/src/lq_packet.h $(TOPDIR)/src/process_package.h
> OBJS = $(SRCS:%.c=%.o)
>
> While the result looks good to me:
> $ nm olsrd_lq_etx_challenge.so.0.1 |grep create_lq_hello
> 000000000000b877 t create_lq_hello
>                  U create_lq_hello
>
> ...but I still get the same error message when trying to run olsrd :-(
>
> Do you see or have an idea what I might have done wrong? I have to admit
> that I never tried writing a library before, so don't hesitate to point
> me to really stupid (possible) mistakes ;-)
>
> Thanks and best regards!
>
> Jonathan






More information about the Olsr-dev mailing list