Linking Shared/Static library in Freeradius Module

Resit Sahin resitsahin at gmail.com
Tue Dec 6 15:43:08 CET 2011


Hello,

I am writing a FreeRadius (Version 2) module for version Freeradius 2.1.10
. The module works fine. When i want to link a shared/static library from
the Makefile of the module i get errors.

I link to a static library and i run radius server with the module (
radiusd -X) then i get the error:

/usr/local/etc/raddb/radiusd.conf[665]: Failed to link to module
'rlm_itap': file not found

makefile of the freeradius module :

*VERS = 2.1.10
CFLAGS  =  -DNDEBUG -Wall -I/usr/include \
           -I/usr/ports/net/freeradius2/work/freeradius-server-$(VERS)/src
LIBS    =  -lc -L. icc-wrapper.a
ALL:    rlm_itap.o rlm_itap-$(VERS).so*


rlm_itap is the name of my module. When i remove *icc-wrapper.a ,
everything works fine.


*For the shared library case. Everything works fine until the function from
the shared library is called inside the module. I got the error:

/libexec/ld-elf.so.1: /usr/local/lib/freeradius-2.1.10/rlm_itap.so:
Undefined symbol "sendiccmsg"

in that case. sendiccmsg is the only function i have in my shared library.

The makefile of the freeradius module:

VERS = 2.1.10

CFLAGS  =  -DNDEBUG -Wall -I/usr/include \
           -I/usr/ports/net/freeradius2/work/freeradius-server-$(VERS)/src

LIBS    =  -lc icc-wrapper.so

ALL:    rlm_itap.o rlm_itap-$(VERS).so

rlm_itap.o:    rlm_itap.c
    cc -g -fPIC -DPIC -c $(CFLAGS) rlm_itap.c

rlm_itap-$(VERS).so:    rlm_itap.o
    cc -g -shared -Wl,-soname,rlm_itap-$(VERS).so \
           -o rlm_itap-$(VERS).so rlm_itap.o $(LIBS)

install:        ALL
    install rlm_itap-$(VERS).so /usr/local/lib/freeradius-$(VERS)
    ln -fs rlm_itap-$(VERS).so /usr/local/lib/freeradius-$(VERS)/rlm_itap.so

clean:
    rm rlm_itap*.o rlm_itap*.so



The static/shred library i am using is compiled as a C++ library with
extern "C" in front of function definitions.


Regards
Resit Sahin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20111206/6903dd0b/attachment.html>


More information about the Freeradius-Users mailing list