Re: Linking Shared/Static library in Freeradius Module
Well, yes it seems to be problem. But there is one more thing. The libprint.so should reside in : /usr/lib or /usr/local/lib/ Considering my experience with writing a module for freeradius i think wiki page for module creation can be updated with following info: 1) Mentioning autoconf procedure. autoconf.in makefile.in files. running autoconf running ./configure building: gmake clean && gmake && gmake install Regards On 12/08/2011 04:58 PM, Fajar A. Nugraha wrote: 2011/12/8 Mustafa Reşit Şahin: My makefile.in file RLM_LIBS= @itap_ldflags@ -L/home/resit/radius/lib/ /home/resit/radius/lib/print.so shouldn't it be "-lprint" instead of "/home/resit/radius/lib/print.so"? -- Mustafa Reşit Şahin Endersys İş Tel: 0216 470 94 23 Dahili:306 Cep Tel:0507 707 68 12 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: Linking Shared/Static library in Freeradius Module
/usr/local/lib/freeradius-2.1.10]#*ldd libfreeradius-radius-2.1.10.so * libfreeradius-radius-2.1.10.so: libthr.so.3 => /lib/libthr.so.3 (0x800c0) libc.so.7 => /lib/libc.so.7 (0x800647000) *My makefile.in file* ### TARGET = @targetname@ SRCS= rlm_itap.c HEADERS = icc-wrapper.h print.h RLM_CFLAGS = @itap_cflags@ -I/home/resit/radius/include/ RLM_LIBS= @itap_ldflags@ -L/home/resit/radius/lib/ /home/resit/radius/lib/print.so RLM_INSTALL = install-itap ## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make TARGET. include ../rules.mak $(LT_OBJS): $(HEADERS) ## the rule that RLM_INSTALL tells the parent rules.mak to use. install-itap: touch . *my makefile :* ### TARGET = rlm_itap SRCS= rlm_itap.c HEADERS = icc-wrapper.h print.h RLM_CFLAGS = -I/usr/include -I/home/resit/radius/include/ RLM_LIBS= -lc -L/home/resit/radius/lib/ /home/resit/radius/lib/print.so RLM_INSTALL = install-itap ## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make TARGET. include ../rules.mak $(LT_OBJS): $(HEADERS) ## the rule that RLM_INSTALL tells the parent rules.mak to use. install-itap: touch . *my configure.in file: * AC_PREREQ([2.53]) AC_INIT(rlm_itap.c) # change 'itap' AC_REVISION($Revision$) AC_DEFUN(modname,[rlm_itap]) # change 'itap' if test x$with_[]modname != xno; then AC_PROG_CC AC_PROG_CPP dnl put configuration checks here. dnl set $fail to what's missing, on fatal errors. dnl use AC_MSG_WARN() on important messages. AC_CHECK_LIB(c, printf, [ itap_ldflags="$itap_ldflags -lc" ], [ fail=$fail" printf" ] ) AC_CHECK_HEADER(stdio.h, [ itap_cflags="$itap_cflags -I/usr/include" ], [ fail=$fail" stdio.h" ] ) AC_CHECK_HEADERS(stdio.h stdlib.h) # for the config.h defs AC_CHECK_FUNCS(printf) # for the config.h defs targetname=modname # keep this! Don't change! else targetname=# keep this! Don't change! echo \*\*\* module modname is disabled. # keep this! Don't change! fi dnl Don't change this section. if test x"$fail" != x""; then if test x"${enable_strict_dependencies}" = x"yes"; then AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.]) else AC_MSG_WARN([silently not building ]modname[.]) AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); targetname="" fi fi AC_SUBST(itap_cflags) # change 'itap' AC_SUBST(itap_ldflags) # change 'itap' AC_CONFIG_HEADER(config.h) # delete if you don't want a config.h file. AC_SUBST(targetname) # keep this! Don't change! AC_OUTPUT(Makefile) # keep this! Don't change! On 12/07/2011 04:55 PM, Alan DeKok wrote: Mustafa Reşit Şahin wrote: Which file mentioned with "These definitions are also # echoed into another file in ../lib," ? Files automatically produced by the builds. I could not find this file. As far as i understand, i have to add shared/static libraries ( which i link from my new module ) into this file . So freeradius can find them. No. You just add them in the RLM_LIBS line. I consider this because i get the error : /libexec/ld-elf.so.1: /usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.so: Undefined symbol "sendiccmsg" when i run radiusserver and send an autorization message to server. You probably need to re-build radiusd, too. Or... *show* what you did. This isn't hard. The current build process *can* link to static libraries, and *does* link to static libraries, and *works* when modules are linked to static libraries. If you follow the examples, it *should* work. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html -- Mustafa Reşit Şahin Endersys İş Tel: 0216 470 94 23 Dahili:306 Cep Tel:0507 707 68 12 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: Linking Shared/Static library in Freeradius Module
I am trying to use src/modules/rlm_example/Makefile using configure files. In this makefile stated : # The RLM_LIBS definition should list ALL required libraries. # These libraries really should be pulled from the 'config.mak' # definitions, if at all possible. These definitions are also # echoed into another file in ../lib, where they're picked up by # ../main/Makefile for building the version of the server with # statically linked modules. Get it from autoconf. # Which file mentioned with "These definitions are also # echoed into another file in ../lib," ? I could not find this file. As far as i understand, i have to add shared/static libraries ( which i link from my new module ) into this file . So freeradius can find them. I consider this because i get the error : /libexec/ld-elf.so.1: /usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.so: Undefined symbol "sendiccmsg" when i run radiusserver and send an autorization message to server. On 12/06/2011 06:00 PM, Alan DeKok wrote: Mustafa Reşit Şahin wrote: I have followed the steps here : http://wiki.freeradius.org/Modules2#Testing Well, it's wrong. I'm not sure it was ever correct. I've deleted that example from the Wiki. Look at src/modules/rlm_example/Makefile. It works, and is correct. Edit it to build your module. It's a *lot* simpler. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html -- Mustafa Reşit Şahin Endersys İş Tel: 0216 470 94 23 Dahili:306 Cep Tel:0507 707 68 12 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Re: Linking Shared/Static library in Freeradius Module
I have followed the steps here : http://wiki.freeradius.org/Modules2#Testing The makefile is "almost" the same with the makefile there. It is recommended to use your own make file in the wiki entry My module works fine without linking libraries. The problems arise when i try to link external libraries. Resit On 12/06/2011 05:36 PM, Alan DeKok wrote: Resit Sahin wrote: 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. You didn't follow the FreeRADIUS build process. 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/ Uh... *why* did you do this? The server ships with *many* examples of building modules. The build system for the server takes care of all of the necessary magic to make it Just Work. By creating your own Makefile you've done more work than necessary, and ensured that the resulting module won't work with FreeRADIUS. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html -- Mustafa Reşit Şahin Endersys İş Tel: 0216 470 94 23 Dahili:306 Cep Tel:0507 707 68 12 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html