harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] libXmu-dev and libxtst-dev
Date Fri, 26 Jan 2007 22:15:46 GMT
Geir Magnusson Jr. wrote:
> On Jan 25, 2007, at 10:33 AM, Mark Hindess wrote:
>> The awt code attempts to load the unversioned, libXmu.so, rather than
>> the versioned, libXmu.so.6 (for X11R6).  Debian-based distributions
>> don't include these unversioned files in their non-dev packages.
>>
>> I think we decided that we should attempt to load the known-good
>> versioned .so files first and if that fails try to load the unversioned
>> .so.
> 
> Meaning "we have a plan, but not implemented"?  If so, can you point me
> where to fix this?

Take a look in .../modules/awt/src/main/native/x11wrapper/unix/


For this particular case the file
   org_apache_harmony_awt_nativebridge_linux_X11.cpp
has got a function
   Java_org_apache_harmony_awt_nativebridge_linux_X11_init(...)
that uses the LOADLIB macro.

Depending upon which 'known-good' versions you want to try loading the
(untested) fix would be something like this in numerous places that load
the libraries:

Index: modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
===================================================================
--- modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
(revision 499041)
+++ modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
(working copy)
@@ -30,6 +30,7 @@


 #define LOAD_LIB(res, name) res = dlopen(mkstr(lib##name.so), RTLD_LAZY)
+#define LOAD_LIB(res, name, ver) res = dlopen(mkstr(lib##name.so##ver),
RTLD_LAZY)

 #define FindFunction(lib, name) (void *)dlsym(lib, name)

Index:
modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp
===================================================================
---
modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp
(revision 499041)
+++
modules/awt/src/main/native/x11wrapper/unix/org_apache_harmony_awt_nativebridge_linux_X11.cpp
(working copy)
@@ -28,8 +28,11 @@
 static libHandler libXmu;
 static libHandler libXtst;
 JNIEXPORT void JNICALL
Java_org_apache_harmony_awt_nativebridge_linux_X11_init (JNIEnv * env,
jclass cls) {
-    LOAD_LIB(libX11, X11);
+    LOAD_LIB(libX11, X11, 6);
     if (libX11 == NULL) {
+        LOAD_LIB(libX11, X11);
+	}
+	if (libX11 == NULL) {
         throwNewExceptionByName(env, LINK_EXCEPTION, "Cannot load
libX11.so library");
         return;
     }


Mime
View raw message