Ticket #338 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

fso-framework only works with glibc

Reported by: mirko Owned by: jluebbe
Priority: major Milestone:
Component: framework/general Version:
Keywords: HasPatch Cc:

Description

The filename <libc.so.6> is hardcoded. E.g. uclibc is named <libc.so.0> so python is claiming not finding the libc. Changing that (e.g. using a regExp-pattern) is enough to get the fso-framework running on a system using uclibc.

Attachments

uclibc.patch Download (564 bytes) - added by stefan 3 years ago.
Updated uclibc patch

Change History

comment:1 Changed 3 years ago by jluebbe

  • Owner changed from mickey to jluebbe
  • Status changed from new to accepted
  • Milestone set to milestone5.5

comment:2 Changed 3 years ago by jluebbe

  • Milestone milestone5.5 deleted

comment:3 Changed 3 years ago by daniel

Sounds like an easy fix, could you provide a patch?

comment:4 Changed 3 years ago by mirko

shame on me for this dirty patch - but it workarounds the issue for now:

diff -ruN fso-20090103.orig/framework/cxnet/common.py fso-20090103/framework/cxnet/common.py
--- fso-20090103.orig/framework/cxnet/common.py	2009-01-05 10:09:43.000000000 +0100
+++ fso-20090103/framework/cxnet/common.py	2009-01-07 11:10:52.000000000 +0100
@@ -38,7 +38,14 @@
 else:
 	cx_int = c_uint64
 
-libc = CDLL("libc.so.6")
+from os import listdir
+from re import compile
+re = compile('^libc.so.[0-9]$')
+libs = listdir('/lib')
+for lib in libs:
+	if re.match(lib):
+		libc = CDLL(lib)
+		break
 
 def hdump(name,msg,size=0):
 	"""
diff -ruN fso-20090103.orig/framework/patterns/kobject.py fso-20090103/framework/patterns/kobject.py
--- fso-20090103.orig/framework/patterns/kobject.py	2009-01-05 10:09:43.000000000 +0100
+++ fso-20090103/framework/patterns/kobject.py	2009-01-07 13:37:58.000000000 +0100
@@ -88,7 +88,13 @@
             self._watchR = gobject.io_add_watch( self._socketR.fileno(), gobject.IO_IN, self._onActivityR )
 
         # for rtnetlink assistance
-        self._libc = ctypes.CDLL( "libc.so.6" )
+        from re import compile
+        re = compile('^libc.so.[0-9]$')
+        libs = os.listdir('/lib')
+        for lib in libs:
+            if re.match(lib):
+                self._libc = ctypes.CDLL(lib)
+                break
         self._parser = RtNetlinkParser()
 
     def __del__( self ):
Binary files fso-20090103.orig/framework/patterns/.kobject.py.swp and fso-20090103/framework/patterns/.kobject.py.swp differ
diff -ruN fso-20090103.orig/framework/subsystems/odeviced/pyglet/linux.py fso-20090103/framework/subsystems/odeviced/pyglet/linux.py
--- fso-20090103.orig/framework/subsystems/odeviced/pyglet/linux.py	2009-01-05 10:09:43.000000000 +0100
+++ fso-20090103/framework/subsystems/odeviced/pyglet/linux.py	2009-01-07 12:15:13.000000000 +0100
@@ -15,7 +15,13 @@
 import struct
 import sys
 
-c = ctypes.cdll.LoadLibrary('libc.so.6')
+from re import compile
+re = compile('^libc.so.[0-9]$')
+libs = os.listdir('/lib')
+for lib in libs:
+    if re.match(lib):
+        c = ctypes.cdll.LoadLibrary(lib)
+        break
 
 _IOC_NRBITS = 8
 _IOC_TYPEBITS = 8

comment:5 Changed 3 years ago by stefan

  • Keywords HasPatch added

Sorry for taking so long.

The hunks in kobject.py and common.py are no longer needed. I updated your patch to only fix linux.py. Patch is attched. Mirko, can you test if that works for you on uclibc?

Jan, Daniel, Mickey any problems with this patch? To be applied after success report from Mirko.

Changed 3 years ago by stefan

Updated uclibc patch

comment:6 Changed 3 years ago by mirko

Hmm, I hoped that kind of patch will not be necessary anymore in the future. I wonder why you're calling functions within the libc in general - all functionality should be also available within python (or it's libraries) itself I think. Am I wrong? Is that because of performance enhancements?

comment:7 Changed 2 years ago by mickey

  • Status changed from accepted to closed
  • Resolution set to fixed

Commited this as 8402f6c2d758a1eaef7844a690b907f54037f38c, thanks a lot. Stuff like this will no longer necessary in FSO2, said component is already implemented in a libc-independent way. The necessity to use it in Python is due to some more complex Linux-specific lowlevel ioctls for which Python has no support.

Note: See TracTickets for help on using tickets.