ke, 2021-02-24 kello 13:24 -0300, Vitor Dall'Acqua kirjoitti:
> Hey just wanted to bring this back up again to check if you guys have
> any advice on this.I have compiled the aarch32 version of that
> OpenJDK but I'm facing 2 problems:
> 
> One is that I can't build a server version of libjvm.so, so I'm using
> the client one. 
> I have reported it here:
> https://github.com/PojavLauncherTeam/PojavLauncher/issues/949
> but so far no solution was found.

Those build scripts seem to select client JVM for aarch32.
Client JVM should be OK for BD-J.

> The other problem is that while using it libbluray always ends with
> this error:
> ERROR: loadN() failed: java.lang.UnsatisfiedLinkError:
> java.awt.Component.initIDs()V
> java.awt.Component.initIDs(Native Method)
> java.awt.Component.<clinit>(Component.java:596)
> org.videolan.BDJLoader.loadN(BDJLoader.java:228)
> org.videolan.BDJLoader.access$200(BDJLoader.java:46)
> org.videolan.BDJLoader$BDJLoaderAction.doAction(BDJLoader.java:363)
> org.videolan.BDJAction.process(BDJAction.java:59)
> org.videolan.BDJActionQueue.run(BDJActionQueue.java:86)
> java.lang.Thread.run(Thread.java:748)
> 
> I have compiled the lib as debug and I'm using 0x22804 as debug mask
> for libbluray but no other information is available. 
> Any idea what this might be?

I had the same issue while testing it in Ubuntu. AWT libraries are
missing native functions. Maybe preloading could fix this. I fixed it
by adding those functions to few more places...

You could try if the attached patch helps. Probably all changes are not
needed and some are "duplicate". I didn't test those much, as my only
intent was to see if it can run BD-J Xlets.

Ex. change in jdk/make/lib/Awt2dLibraries.gmk is basically wrong, and
may cause build issues. You probably should try first without it.

Also note that it is against aarch64 tree (I don't know if it applies
to aarch32 tree as-is).


diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index eff6253e..6379e315 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -2452,8 +2452,8 @@ void os::jvm_path(char *buf, jint buflen) {
                 dli_fname, sizeof(dli_fname), NULL);
   assert(ret, "cannot locate libjvm");
 #ifdef __ANDROID__
-  char* java_home_var = ::getenv("JAVA_HOME");
-  if (java_home_var == NULL || dli_fname[0] == '\0') {
+  //char* java_home_var = ::getenv("JAVA_HOME");
+  if (/*java_home_var == NULL ||*/ dli_fname[0] == '\0') {
     return;
   }
   snprintf(buf, buflen, /* "%s/lib/%s/server/%s", java_home_var, cpu_arch, */ dli_fname);
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 22c94cf3..ce64caa2 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -443,7 +443,7 @@ void* os::native_java_library() {
       vm_exit_during_initialization("Unable to load native library", ebuf);
     }
 
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || defined(__ANDROID__)
     // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so
     // ignore errors
     if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 347f30e6..f0384054 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -808,6 +808,7 @@ ifeq ($(BUILD_HEADLESS), true)
 #        awt_UNIXToolkit.c
 
     LIBAWT_HEADLESS_FILES := \
+        XToolkit.c \
         awt_AWTEvent.c \
         awt_Event.c \
         awt_Font.c \
diff --git a/jdk/src/share/native/common/xlocale.h b/jdk/src/share/native/common/xlocale.h
index 5a489751..022dbf4a 100644
--- a/jdk/src/share/native/common/xlocale.h
+++ b/jdk/src/share/native/common/xlocale.h
@@ -29,6 +29,8 @@
 #define _XLOCALE_H_
 #include <sys/cdefs.h>
 /* If we just use void* here, GCC exposes that in error messages. */
+#ifndef _BITS_TYPES_LOCALE_T_H
 struct __locale_t;
 typedef struct __locale_t* locale_t;
+#endif
 #endif /* _XLOCALE_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/HeadlessToolkit.c b/jdk/src/solaris/native/sun/awt/HeadlessToolkit.c
index fd17f3b8..c621e865 100644
--- a/jdk/src/solaris/native/sun/awt/HeadlessToolkit.c
+++ b/jdk/src/solaris/native/sun/awt/HeadlessToolkit.c
@@ -41,4 +41,34 @@ JNIEXPORT jboolean JNICALL AWTIsHeadless() {
     return JNI_TRUE;
 }
 
+JNIEXPORT void JNICALL
+Java_java_awt_Component_initIDs
+  (JNIEnv *env, jclass cls)
+{
+
+}
+
+
+JNIEXPORT void JNICALL
+Java_java_awt_Container_initIDs
+  (JNIEnv *env, jclass cls)
+{
+
+}
+
+
+JNIEXPORT void JNICALL
+Java_java_awt_Window_initIDs
+  (JNIEnv *env, jclass cls)
+{
+
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Frame_initIDs
+  (JNIEnv *env, jclass cls)
+{
+
+}
+
 #endif
diff --git a/jdk/src/solaris/native/sun/awt/VDrawingArea.c b/jdk/src/solaris/native/sun/awt/VDrawingArea.c
index 712d0840..b5bbb26e 100644
--- a/jdk/src/solaris/native/sun/awt/VDrawingArea.c
+++ b/jdk/src/solaris/native/sun/awt/VDrawingArea.c
@@ -35,7 +35,7 @@
 
 #ifdef __linux__
 /* XXX: Shouldn't be necessary. */
-#include "awt_p.h"
+//#include "awt_p.h"
 #endif /* __linux__ */
 
 
diff --git a/jdk/src/solaris/native/sun/awt/X11Color.c b/jdk/src/solaris/native/sun/awt/X11Color.c
index e7bf05b7..22abbeb1 100644
--- a/jdk/src/solaris/native/sun/awt/X11Color.c
+++ b/jdk/src/solaris/native/sun/awt/X11Color.c
@@ -37,8 +37,8 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
-#endif /* !HEADLESS */
 #include "awt_p.h"
+#endif /* !HEADLESS */
 #include "java_awt_Color.h"
 #include "java_awt_SystemColor.h"
 #include "java_awt_color_ColorSpace.h"
diff --git a/jdk/src/solaris/native/sun/awt/awt_Robot.c b/jdk/src/solaris/native/sun/awt/awt_Robot.c
index b4ff620e..dec3ac5f 100644
--- a/jdk/src/solaris/native/sun/awt/awt_Robot.c
+++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c
@@ -32,7 +32,7 @@
 #include "jvm_md.h"
 #include <dlfcn.h>
 
-#include "awt_p.h"
+//#include "awt_p.h"
 #include "awt_GraphicsEnv.h"
 #define XK_MISCELLANY
 #include <X11/keysymdef.h>
diff --git a/jdk/src/solaris/native/sun/awt/awt_p.h b/jdk/src/solaris/native/sun/awt/awt_p.h
index df62cf13..00002f8a 100644
--- a/jdk/src/solaris/native/sun/awt/awt_p.h
+++ b/jdk/src/solaris/native/sun/awt/awt_p.h
@@ -74,7 +74,7 @@
 
 typedef XRenderPictFormat *
 XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
-
+#include "color.h"
 typedef struct _AwtGraphicsConfigData  {
     int         awt_depth;
     Colormap    awt_cmap;
diff --git a/jdk/src/solaris/native/sun/awt/color.h b/jdk/src/solaris/native/sun/awt/color.h
index f7fb4ad1..0a791b3c 100644
--- a/jdk/src/solaris/native/sun/awt/color.h
+++ b/jdk/src/solaris/native/sun/awt/color.h
@@ -35,6 +35,8 @@ typedef struct {
     ImgColorData clrdata;
     ImgConvertFcn *convert[NUM_IMGCV];
 } awtImageData;
+#else
+typedef struct {int d;} awtImageData; 
 #endif /* __ANDROID__ || (!HEADLESS && !MACOSX) */
 
 #endif           /* _COLOR_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/initIDs.c b/jdk/src/solaris/native/sun/awt/initIDs.c
index f2efa328..b39c1413 100644
--- a/jdk/src/solaris/native/sun/awt/initIDs.c
+++ b/jdk/src/solaris/native/sun/awt/initIDs.c
@@ -35,6 +35,38 @@
 
 #include "jni_util.h"
 
+/* ??? */
+JNIEXPORT void JNICALL
+Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls)
+{
+}
+JNIEXPORT void JNICALL
+Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
+{
+}
+JNIEXPORT void JNICALL
+Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
+{
+}
+JNIEXPORT void JNICALL
+Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
+{
+}
+JNIEXPORT void JNICALL
+Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
+{
+}
+JNIEXPORT void JNICALL
+Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
+                                       jobject newSource)
+{
+}
+JNIEXPORT void JNICALL
+Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
+{
+}
+//#error why these are not included in makefile ... ?
+
 /*
  * This file contains stubs for JNI field and method id initializers
  * which are used in the win32 awt.
@@ -42,6 +74,96 @@
 
 jfieldID colorValueID;
 
+JNIEXPORT void JNICALL
+Java_java_awt_KeyboardFocusManager_initIDs
+    (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Component_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Container_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+
+JNIEXPORT void JNICALL
+Java_java_awt_Button_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Scrollbar_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Window_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Frame_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_MenuComponent_initIDs(JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Cursor_initIDs(JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL Java_java_awt_MenuItem_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL Java_java_awt_Menu_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_TextArea_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_Checkbox_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL
+Java_java_awt_TextField_initIDs
+  (JNIEnv *env, jclass cls)
+{
+}
+
+JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls)
+{
+}
+
 JNIEXPORT void JNICALL
 Java_java_awt_Color_initIDs
   (JNIEnv *env, jclass clazz)
diff --git a/jdk/src/solaris/native/sun/awt/jawt.c b/jdk/src/solaris/native/sun/awt/jawt.c
index 2c65790d..70c977ae 100644
--- a/jdk/src/solaris/native/sun/awt/jawt.c
+++ b/jdk/src/solaris/native/sun/awt/jawt.c
@@ -33,7 +33,7 @@
  */
 JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
 {
-#if (defined(__ANDROID__) || defined(JAVASE_EMBEDDED)) && defined(HEADLESS)
+#if (defined(__linux__) || defined(__ANDROID__) || defined(JAVASE_EMBEDDED)) && defined(HEADLESS)
     /* there are no AWT libs available at all */
     return JNI_FALSE;
 #else
_______________________________________________
libbluray-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libbluray-devel

Reply via email to