<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
I will try to explain what i am trying to achive.<br>
<br>
I am developing a freeradius module called rlm_itap. This module
uses a shared library called print.so (a library i use for test
purposes.). There is only one procedure in the library and it is
called : myprint() . I am able to run freeradius server with my own
module :<br>
<br>
$ radiusd -X<br>
<br>
I send a test message with <br>
<br>
$ radtest testuser "pass" localhost 0 testing123<br>
<br>
<br>
If i do not use myprint() function in my own module everything works
fine and i am able to receive the incomming message:<br>
<br>
+- entering group authorize {...}<br>
++[preprocess] returns ok<br>
ITAP: Received auth message =><b> My own debug
msg</b><br>
<br>
But when i use the method myprint() from the library print.so , i
get the error when i run the server and send a message with radtest
:<br>
<br>
<i># Executing section authorize from file
/usr/local/etc/raddb/sites-enabled/default<br>
+- entering group authorize {...}<br>
++[preprocess] returns ok<br>
ITAP: Received auth message<br>
/libexec/ld-elf.so.1:
/usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.so: <b>Undefined
symbol "myprint"</b></i><br>
<br>
<br>
<br>
So this is the problem i am having. After your email i started to
use autoconf and it is easier than writing my own makefile. But i am
still not able to resolve this problem. As far as i understand
freeradius is not able to see find print.so library. I have to find
a way to show the server this library.... <br>
<br>
I prepare my module as :<br>
<br>
$ autoconf<br>
$ ./configure<br>
$ gmake clean<br>
$ gmake <br>
$ gmake install<br>
<br>
<br>
Here is some more information and my makefiles:<br>
<br>
<br>
<b>$ gmake </b><br>
<br>
[root@vm1
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap]#
gmake<br>
for x in .libs/* rlm_itap.la; do \<br>
rm -rf
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/lib/$x;
\<br>
ln -s
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap/$x
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/lib/$x;
\<br>
done<br>
[root@vm1
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap]#
gmake clean<br>
[root@vm1
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap]#
gmake<br>
/usr/local/bin/libtool --mode=compile cc -O2 -pipe
-I/usr/local/include -L/usr/local/lib -DHAVE_LT_DLADVISE_INIT
-DHAVE_LT_DLADVISE_INIT -fno-strict-aliasing -pthread -Wall
-D_GNU_SOURCE -DNDEBUG
-I/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src
-I/usr/include -I/home/resit/radius/include/ -c rlm_itap.c<br>
libtool: compile: cc -O2 -pipe -I/usr/local/include
-L/usr/local/lib -DHAVE_LT_DLADVISE_INIT -DHAVE_LT_DLADVISE_INIT
-fno-strict-aliasing -pthread -Wall -D_GNU_SOURCE -DNDEBUG
-I/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src
-I/usr/include -I/home/resit/radius/include/ -c rlm_itap.c -fPIC
-DPIC -o .libs/rlm_itap.o<br>
libtool: compile: cc -O2 -pipe -I/usr/local/include
-L/usr/local/lib -DHAVE_LT_DLADVISE_INIT -DHAVE_LT_DLADVISE_INIT
-fno-strict-aliasing -pthread -Wall -D_GNU_SOURCE -DNDEBUG
-I/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src
-I/usr/include -I/home/resit/radius/include/ -c rlm_itap.c -o
rlm_itap.o >/dev/null 2>&1<br>
/usr/local/bin/libtool --mode=link cc -release 2.1.10 \<br>
-module -export-dynamic -rpath=/usr/lib:/usr/local/lib -o
rlm_itap.la \<br>
-rpath /usr/local/lib/freeradius-2.1.10 rlm_itap.lo rlm_itap.c
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/lib/libfreeradius-radius.la
-lc -L/home/resit/radius/lib/ /home/resit/radius/lib/print.so <br>
libtool: link: cc -shared .libs/rlm_itap.o -Wl,-rpath
-Wl,/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/lib/.libs
-Wl,-rpath -Wl,/usr/local/lib/freeradius-2.1.10
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/lib/.libs/libfreeradius-radius.so
-L/usr/local/lib -pthread -L/home/resit/radius/lib/ -pthread
-pthread -Wl,-soname -Wl,rlm_itap-2.1.10.so -o
.libs/rlm_itap-2.1.10.so<br>
libtool: link: (cd ".libs" && rm -f "rlm_itap.so" &&
ln -s "rlm_itap-2.1.10.so" "rlm_itap.so")<br>
libtool: link: ar cru .libs/rlm_itap.a rlm_itap.o<br>
libtool: link: ranlib .libs/rlm_itap.a<br>
libtool: link: ( cd ".libs" && rm -f "rlm_itap.la"
&& ln -s "../rlm_itap.la" "rlm_itap.la" )<br>
for x in .libs/* rlm_itap.la; do \<br>
rm -rf
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/lib/$x;
\<br>
ln -s
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap/$x
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/lib/$x;
\<br>
done<br>
<br>
<br>
<br>
<br>
<br>
<br>
<b>$ gmake install :<br>
<br>
</b>[root@vm1
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap]#
gmake install<br>
gmake[1]: Entering directory
`/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap'<br>
touch .<br>
gmake[1]: Leaving directory
`/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap'<br>
if [ "xrlm_itap" != "x" ]; then \<br>
/usr/local/bin/libtool --mode=install
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/install-sh
-c -c \<br>
rlm_itap.la /usr/local/lib/freeradius-2.1.10/rlm_itap.la ||
exit $?; \<br>
rm -f /usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.la; \<br>
ln -s rlm_itap.la
/usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.la || exit $?; \<br>
fi<br>
libtool: install: warning: relinking `rlm_itap.la'<br>
libtool: install: (cd
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/modules/rlm_itap;
/bin/sh /usr/local/bin/libtool --mode=relink cc -release 2.1.10
-module -export-dynamic -rpath=/usr/lib:/usr/local/lib -o
rlm_itap.la -rpath /usr/local/lib/freeradius-2.1.10 rlm_itap.lo
rlm_itap.c
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/src/lib/libfreeradius-radius.la
-lc -L/home/resit/radius/lib/ /home/resit/radius/lib/print.so )<br>
libtool: relink: cc -shared .libs/rlm_itap.o -Wl,-rpath
-Wl,/usr/local/lib/freeradius-2.1.10
-L/usr/local/lib/freeradius-2.1.10 -lfreeradius-radius
-L/usr/local/lib -pthread -L/home/resit/radius/lib/ -pthread
-pthread -Wl,-soname -Wl,rlm_itap-2.1.10.so -o
.libs/rlm_itap-2.1.10.so<br>
libtool: install:
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/install-sh
-c -c .libs/rlm_itap-2.1.10.soT
/usr/local/lib/freeradius-2.1.10/rlm_itap-2.1.10.so<br>
libtool: install: (cd /usr/local/lib/freeradius-2.1.10 && {
ln -s -f rlm_itap-2.1.10.so rlm_itap.so || { rm -f rlm_itap.so
&& ln -s rlm_itap-2.1.10.so rlm_itap.so; }; })<br>
libtool: install:
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/install-sh
-c -c .libs/rlm_itap.lai
/usr/local/lib/freeradius-2.1.10/rlm_itap.la<br>
libtool: install:
/usr/ports/net/freeradius2/work/freeradius-server-2.1.10/install-sh
-c -c .libs/rlm_itap.a /usr/local/lib/freeradius-2.1.10/rlm_itap.a<br>
libtool: install: chmod 644
/usr/local/lib/freeradius-2.1.10/rlm_itap.a<br>
libtool: install: ranlib /usr/local/lib/freeradius-2.1.10/rlm_itap.a<br>
----------------------------------------------------------------------<br>
Libraries have been installed in:<br>
/usr/local/lib/freeradius-2.1.10<br>
<br>
If you ever happen to want to link against installed libraries<br>
in a given directory, LIBDIR, you must either use libtool, and<br>
specify the full pathname of the library, or use the `-LLIBDIR'<br>
flag during linking and do at least one of the following:<br>
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable<br>
during execution<br>
- add LIBDIR to the `LD_RUN_PATH' environment variable<br>
during linking<br>
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag<br>
<br>
See any operating system documentation about shared libraries for<br>
more information, such as the ld(1) and ld.so(8) manual pages.<br>
----------------------------------------------------------------------<br>
<br>
<br>
<br>
<br>
<br>
[root@vm1 /usr/local/lib/freeradius-2.1.10]# <b>nm
rlm_itap-2.1.10.so</b><br>
00000000001011c0 A _DYNAMIC<br>
00000000001013a8 A _GLOBAL_OFFSET_TABLE_<br>
w _Jv_RegisterClasses<br>
0000000000101388 d __CTOR_END__<br>
0000000000101380 d __CTOR_LIST__<br>
0000000000101398 d __DTOR_END__<br>
0000000000101390 d __DTOR_LIST__<br>
00000000001011b8 r __FRAME_END__<br>
00000000001013a0 d __JCR_END__<br>
00000000001013a0 d __JCR_LIST__<br>
0000000000101408 A __bss_start<br>
w __cxa_finalize@@FBSD_1.0<br>
0000000000000b80 t __do_global_ctors_aux<br>
0000000000000a00 t __do_global_dtors_aux<br>
0000000000101000 d __dso_handle<br>
0000000000101408 A _edata<br>
0000000000101410 A _end<br>
0000000000000bb8 T _fini<br>
0000000000000970 T _init<br>
U cf_section_parse<br>
0000000000101408 b completed.5133<br>
U debug_flag<br>
0000000000000a50 t frame_dummy<br>
U <a class="moz-txt-link-abbreviated" href="mailto:free@@FBSD_1.0">free@@FBSD_1.0</a><br>
0000000000000aa0 t itap_accounting<br>
0000000000000a80 t itap_authenticate<br>
0000000000000ac0 t itap_authorize<br>
0000000000000ab0 t itap_checksimul<br>
0000000000000af0 t itap_detach<br>
0000000000000b00 t itap_instantiate<br>
0000000000000a90 t itap_preacct<br>
U log_debug<br>
00000000001010a0 d module_config<br>
U myprint<br>
0000000000101008 d p.5131<br>
U rad_malloc<br>
0000000000000c7f r rcsid<br>
0000000000000c57 r rcsid_conffile_h<br>
0000000000000c52 r rcsid_event_h<br>
0000000000000c66 r rcsid_hash_h<br>
0000000000000c75 r rcsid_libradius_h<br>
0000000000000c61 r rcsid_md4_h<br>
0000000000000c70 r rcsid_missing_h<br>
0000000000000c43 r rcsid_modules_h<br>
0000000000000c5c r rcsid_packet_h<br>
0000000000000c7a r rcsid_radiusd_h<br>
0000000000000c48 r rcsid_realms_h<br>
0000000000000c4d r rcsid_stats_h<br>
0000000000000c6b r rcsid_token_h<br>
0000000000101020 D rlm_itap<br>
<br>
<br>
<br>
[root@vm1 /usr/local/lib/freeradius-2.1.10]# <b>ldd
rlm_itap-2.1.10.so</b><br>
rlm_itap-2.1.10.so:<br>
libfreeradius-radius-2.1.10.so =>
/usr/local/lib/freeradius-2.1.10/libfreeradius-radius-2.1.10.so
(0x800c00000)<br>
libthr.so.3 => /lib/libthr.so.3 (0x800d21000)<br>
libc.so.7 => /lib/libc.so.7 (0x800647000)<br>
<br>
<br>
[root@vm1 /usr/local/lib/freeradius-2.1.10]#<b> ldd
libfreeradius-radius-2.1.10.so </b><br>
libfreeradius-radius-2.1.10.so:<br>
libthr.so.3 => /lib/libthr.so.3 (0x800c00000)<br>
libc.so.7 => /lib/libc.so.7 (0x800647000)<br>
<br>
<br>
<br>
<b>My makefile.in file</b><br>
<br>
#######################################################################<br>
TARGET = @targetname@<br>
SRCS = rlm_itap.c<br>
HEADERS = icc-wrapper.h print.h<br>
RLM_CFLAGS = @itap_cflags@ -I/home/resit/radius/include/<br>
RLM_LIBS = @itap_ldflags@ -L/home/resit/radius/lib/
/home/resit/radius/lib/print.so<br>
RLM_INSTALL = install-itap<br>
<br>
## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make
TARGET.<br>
include ../rules.mak<br>
<br>
$(LT_OBJS): $(HEADERS)<br>
<br>
## the rule that RLM_INSTALL tells the parent rules.mak to use.<br>
install-itap:<br>
touch .<br>
<br>
<br>
<b>my makefile :</b><br>
<br>
#######################################################################<br>
TARGET = rlm_itap<br>
SRCS = rlm_itap.c<br>
HEADERS = icc-wrapper.h print.h<br>
RLM_CFLAGS = -I/usr/include -I/home/resit/radius/include/<br>
RLM_LIBS = -lc -L/home/resit/radius/lib/
/home/resit/radius/lib/print.so<br>
RLM_INSTALL = install-itap<br>
<br>
## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make
TARGET.<br>
include ../rules.mak<br>
<br>
$(LT_OBJS): $(HEADERS)<br>
<br>
## the rule that RLM_INSTALL tells the parent rules.mak to use.<br>
install-itap:<br>
touch .<br>
<br>
<br>
<b>my configure.in file:<br>
</b><br>
<br>
AC_PREREQ([2.53])<br>
AC_INIT(rlm_itap.c) # change 'itap'<br>
AC_REVISION($Revision$)<br>
AC_DEFUN(modname,[rlm_itap]) # change 'itap'<br>
<br>
if test x$with_[]modname != xno; then<br>
<br>
AC_PROG_CC<br>
AC_PROG_CPP<br>
<br>
dnl put configuration checks here.<br>
dnl set $fail to what's missing, on fatal errors.<br>
dnl use AC_MSG_WARN() on important messages.<br>
AC_CHECK_LIB(c, printf,<br>
[ itap_ldflags="$itap_ldflags -lc" ],<br>
[ fail=$fail" printf" ]<br>
)<br>
<br>
AC_CHECK_HEADER(stdio.h,<br>
[ itap_cflags="$itap_cflags -I/usr/include" ],<br>
[ fail=$fail" stdio.h" ]<br>
)<br>
<br>
AC_CHECK_HEADERS(stdio.h stdlib.h) # for the config.h defs<br>
AC_CHECK_FUNCS(printf) # for the config.h defs<br>
<br>
targetname=modname # keep this! Don't change!<br>
else<br>
targetname= # keep this! Don't change!<br>
echo \*\*\* module modname is disabled. # keep this! Don't
change!<br>
fi<br>
<br>
dnl Don't change this section.<br>
if test x"$fail" != x""; then<br>
if test x"${enable_strict_dependencies}" = x"yes"; then<br>
AC_MSG_ERROR([set --without-]modname[ to disable it
explicitly.])<br>
else<br>
AC_MSG_WARN([silently not building ]modname[.])<br>
AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);<br>
targetname=""<br>
fi<br>
fi<br>
<br>
<br>
AC_SUBST(itap_cflags) # change 'itap'<br>
AC_SUBST(itap_ldflags) # change 'itap'<br>
<br>
AC_CONFIG_HEADER(config.h) # delete if you don't want a config.h
file.<br>
<br>
AC_SUBST(targetname) # keep this! Don't change!<br>
AC_OUTPUT(Makefile) # keep this! Don't change!<br>
<br>
<br>
<br>
On 12/07/2011 04:55 PM, Alan DeKok wrote:
<blockquote cite="mid:4EDF7E7F.7000100@deployingradius.com"
type="cite">
<pre wrap="">Mustafa Reşit Şahin wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Which file mentioned with "These definitions are also # echoed into
another file in ../lib," ?
</pre>
</blockquote>
<pre wrap="">
Files automatically produced by the builds.
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap="">
No. You just add them in the RLM_LIBS line.
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap="">
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 <a class="moz-txt-link-freetext" href="http://www.freeradius.org/list/users.html">http://www.freeradius.org/list/users.html</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Mustafa Reşit Şahin
Endersys İş Tel: 0216 470 94 23 Dahili:306
Cep Tel:0507 707 68 12</pre>
</body>
</html>