Files
termux-packages/x11-packages/godot/set_handle_dlopen.patch
termux-pacman-bot fc7f506d6b bump(x11/godot): 4.5
- Fixes https://github.com/termux/termux-packages/issues/26487

- New dependencies in this release that are added as system dependencies because they do not build within Godot for Termux unless unvendored:
  - `sdl3`
  - `libjpeg-turbo`

- Unvendor all other dependencies that can be unvendored without causing any errors or warnings in the build process:
  - `brotli`
  - `freetype`
  - `libgraphite`
  - `zlib`

- Implement `TERMUX_DEBUG_BUILD=true` support

- Force the use of system `libjpeg-turbo`, since the Godot build system currently seems unable to officially do that without patching

- Drop `libudev.so` patch because its file no longer exists, and also `libudev.so` does not exist in Android or Termux, so if the `dlopen("libudev.so.1")` has been moved somewhere else, it should be allowed to fail as the expected behavior.

> [!IMPORTANT]
> I have discovered that this release of Godot contains **code which is capable of triggering this error on Pointer-tag-checking-enabled devices:**
> ```
> Pointer tag for 0xf was truncated, see 'https://source.android.com/devices/tech/debug/tagged-pointers'.
> ```
> I have managed to debug and successfully disable this code, because in my opinion it appears to be incompatible with Android, so I do not think attempting to fix the pointer tag problem rather than bulk-disable the code would have any benefit.

- https://github.com/godotengine/godot/pull/53666

- 6efa557e9b/modules/camera/camera_linux.cpp (L80)

- The exact line of code that triggers the `Pointer tag for 0xf was truncated, see 'https://source.android.com/devices/tech/debug/tagged-pointers'.` is `free(devices);` in `CameraLinux::_update_devices()` in `camera_linux.cpp`

- Pointer-tag-checking-enabled device used to debug: Samsung Galaxy A70 SM-A705FN with LineageOS 20 Android 13

- licy183's Pointer-tag-truncated debugging guide was very helpful for this https://github.com/termux/termux-packages/pull/22911#issuecomment-2588503676
2025-10-14 16:05:21 +00:00

189 lines
8.4 KiB
Diff

diff --git a/drivers/alsa/asound-so_wrap.c b/drivers/alsa/asound-so_wrap.c
index ffe24d4..503d811 100644
--- a/drivers/alsa/asound-so_wrap.c
+++ b/drivers/alsa/asound-so_wrap.c
@@ -3824,7 +3824,7 @@ long (*snd_midi_event_decode_dylibloader_wrapper_asound)( snd_midi_event_t*, uns
int initialize_asound(int verbose) {
void *handle;
char *error;
- handle = dlopen("libasound.so.2", RTLD_LAZY);
+ handle = dlopen("libasound.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/drivers/pulseaudio/pulse-so_wrap.c b/drivers/pulseaudio/pulse-so_wrap.c
index 8f47774..bd10c21 100644
--- a/drivers/pulseaudio/pulse-so_wrap.c
+++ b/drivers/pulseaudio/pulse-so_wrap.c
@@ -1064,7 +1064,7 @@ pa_usec_t (*pa_rtclock_now_dylibloader_wrapper_pulse)( void);
int initialize_pulse(int verbose) {
void *handle;
char *error;
- handle = dlopen("libpulse.so.0", RTLD_LAZY);
+ handle = dlopen("libpulse.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/dbus-so_wrap.c b/platform/linuxbsd/dbus-so_wrap.c
index 4aec9dc..562afbf 100644
--- a/platform/linuxbsd/dbus-so_wrap.c
+++ b/platform/linuxbsd/dbus-so_wrap.c
@@ -725,7 +725,7 @@ dbus_bool_t (*dbus_threads_init_default_dylibloader_wrapper_dbus)( void);
int initialize_dbus(int verbose) {
void *handle;
char *error;
- handle = dlopen("libdbus-1.so.3", RTLD_LAZY);
+ handle = dlopen("libdbus-1.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/fontconfig-so_wrap.c b/platform/linuxbsd/fontconfig-so_wrap.c
index 86aacbc..2fc009e 100644
--- a/platform/linuxbsd/fontconfig-so_wrap.c
+++ b/platform/linuxbsd/fontconfig-so_wrap.c
@@ -626,7 +626,7 @@ FcBool (*FcConfigParseAndLoadFromMemory_dylibloader_wrapper_fontconfig)( FcConfi
int initialize_fontconfig(int verbose) {
void *handle;
char *error;
- handle = dlopen("libfontconfig.so.1", RTLD_LAZY);
+ handle = dlopen("libfontconfig.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/speechd-so_wrap.c b/platform/linuxbsd/speechd-so_wrap.c
index 1dc5f08..15d878a 100644
--- a/platform/linuxbsd/speechd-so_wrap.c
+++ b/platform/linuxbsd/speechd-so_wrap.c
@@ -236,7 +236,7 @@ char* (*spd_send_data_wo_mutex_dylibloader_wrapper_speechd)( SPDConnection*,cons
int initialize_speechd(int verbose) {
void *handle;
char *error;
- handle = dlopen("libspeechd.so.2", RTLD_LAZY);
+ handle = dlopen("libspeechd.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index dff2f53..15ee872 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -5355,12 +5355,12 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
int xrandr_minor = 0;
int event_base, error_base;
xrandr_ext_ok = XRRQueryExtension(x11_display, &event_base, &error_base);
- xrandr_handle = dlopen("libXrandr.so.2", RTLD_LAZY);
+ xrandr_handle = dlopen("libXrandr.so", RTLD_LAZY);
if (!xrandr_handle) {
err = dlerror();
// For some arcane reason, NetBSD now ships libXrandr.so.3 while the rest of the world has libXrandr.so.2...
// In case this happens for other X11 platforms in the future, let's give it a try too before failing.
- xrandr_handle = dlopen("libXrandr.so.3", RTLD_LAZY);
+ xrandr_handle = dlopen("libXrandr.so", RTLD_LAZY);
if (!xrandr_handle) {
fprintf(stderr, "could not load libXrandr.so.2, Error: %s\n", err);
}
diff --git a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
index bba21b9..58199b2 100644
--- a/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c
@@ -192,7 +192,7 @@ XcursorBool (*XcursorSetThemeCore_dylibloader_wrapper_xcursor)( Display*, Xcurso
int initialize_xcursor(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXcursor.so.1", RTLD_LAZY);
+ handle = dlopen("libXcursor.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
index 4e3349c..e3de106 100644
--- a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c
@@ -54,7 +54,7 @@ XRectangle* (*XShapeGetRectangles_dylibloader_wrapper_xext)( Display*, Window, i
int initialize_xext(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXext.so.6", RTLD_LAZY);
+ handle = dlopen("libXext.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
index 850ed1f..018117d 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
@@ -27,7 +27,7 @@ XineramaScreenInfo* (*XineramaQueryScreens_dylibloader_wrapper_xinerama)( Displa
int initialize_xinerama(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXinerama.so.1", RTLD_LAZY);
+ handle = dlopen("libXinerama.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
index fc08b97..59063d5 100644
--- a/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c
@@ -117,7 +117,7 @@ void (*XIFreeDeviceInfo_dylibloader_wrapper_xinput2)( XIDeviceInfo*);
int initialize_xinput2(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXi.so.6", RTLD_LAZY);
+ handle = dlopen("libXi.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
index d283856..611a334 100644
--- a/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c
@@ -1828,7 +1828,7 @@ void (*XkbUpdateKeyTypeVirtualMods_dylibloader_wrapper_xlib)( XkbDescPtr, XkbKey
int initialize_xlib(int verbose) {
void *handle;
char *error;
- handle = dlopen("libX11.so.6", RTLD_LAZY);
+ handle = dlopen("libX11.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
index 05f98d2..51b4dfa 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c
@@ -225,7 +225,7 @@ void (*XRRFreeMonitors_dylibloader_wrapper_xrandr)( XRRMonitorInfo*);
int initialize_xrandr(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXrandr.so.2", RTLD_LAZY);
+ handle = dlopen("libXrandr.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
index 7421f94..ffbc423 100644
--- a/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
+++ b/platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c
@@ -147,7 +147,7 @@ Picture (*XRenderCreateConicalGradient_dylibloader_wrapper_xrender)( Display*,co
int initialize_xrender(int verbose) {
void *handle;
char *error;
- handle = dlopen("libXrender.so.1", RTLD_LAZY);
+ handle = dlopen("libXrender.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());
diff --git a/platform/linuxbsd/xkbcommon-so_wrap.c b/platform/linuxbsd/xkbcommon-so_wrap.c
index 3382e2e..08e58d5 100644
--- a/platform/linuxbsd/xkbcommon-so_wrap.c
+++ b/platform/linuxbsd/xkbcommon-so_wrap.c
@@ -283,7 +283,7 @@ xkb_keysym_t (*xkb_compose_state_get_one_sym_dylibloader_wrapper_xkbcommon)(stru
int initialize_xkbcommon(int verbose) {
void *handle;
char *error;
- handle = dlopen("libxkbcommon.so.0", RTLD_LAZY);
+ handle = dlopen("libxkbcommon.so", RTLD_LAZY);
if (!handle) {
if (verbose) {
fprintf(stderr, "%s\n", dlerror());