freeradius2 python undefined symbol modules issues (socket or MySQLdb)
Michael da Silva Pereira
michael at tradepage.co.za
Thu Nov 5 18:20:59 CET 2009
Hi All,
I have emailed the list about this issue before, but I think I have
found something which is causing the issue. (Until now I have still had
the issues).
The problem: When using the Python module to handle auth/acct etc.. if
you 'import' certain modules radiusd quits with an error from python.
I have had this problem on some boxes and not others (even with the same
OS and different), it seems to work if I follow a certain procedure in
installing / setting up my servers (However I haven't been able to
reproduce the same order yet).
Example of Errors (using 'import socket'):
rlm_python:python_load_function: module 'radiusd_test' is not found
rlm_python:EXCEPT:<type
'exceptions.ImportError'>: /usr/local/lib/python2.6/lib-dynload/_socket.so: Undefined symbol "PyObject_GenericGetAttr"
rlm_python:python_load_function: failed to import python function
'radiusd_test.instantiate'
Example of errors (using 'import MySQLdb'):
Thu Nov 5 19:11:05 2009 : Error: rlm_python:python_load_function:
module 'radiusd_test' is not found
Thu Nov 5 19:11:05 2009 : Error: rlm_python:EXCEPT:<type
'exceptions.ImportError'>: /usr/local/lib/python2.6/site-packages/_mysql.so: Undefined symbol "_Py_NoneStruct"
Thu Nov 5 19:11:05 2009 : Error: rlm_python:python_load_function:
failed to import python function 'radiusd_test.instantiate'
As you can see its python complaining about the import, However reading
about python a bit online it seems to do something called 'cross
compiling' (I'm not that big in development, please excuse me). There
are people out there that say there are certain arguments that you need
to pass to gcc during compile, telling the compiler that the libaries
for python are externally linked.
Apparently there is a method in python to return which parameters to
pass to gcc:
[root at aaa /usr/local/etc/raddb/python_script]# python
Python 2.6.2 (r262:71600, Nov 4 2009, 13:40:57)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.sysconfig
>>> distutils.sysconfig.get_config_var("LINKFORSHARED")
'-Wl,--export-dynamic'
I have had this python module issue with FreeBSD 7.2, Ubuntu 9.x & 8.x.
I'm not sure on how to compile the python module (rlm_python) with these
arguments, but if somebody guides me through it I can perhaps help close
the door on this issue?
I eventually gave up on the problems and recoded my python auth module
to use sockets to connect to another daemon to handle the SQL queries, I
did that but then had this issue with 'import socket'. Currently on
FreeBSD 7.2, I have another server which runs the original python module
perfectly (using import 'MySQLdb').
Thanks,
Mike
More information about the Freeradius-Users
mailing list