From 9f63fa712fec1ec4756dc7a63ac427c27090394e Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 12 Mar 2022 22:52:58 -0500 Subject: [PATCH] Fix ARM32 Support --- dependencies/zenity/src | 2 +- launcher/src/ldconfig.cpp | 12 +++++++++--- media-layer/stubs/CMakeLists.txt | 14 ++++---------- media-layer/stubs/redirect/CMakeLists.txt | 18 ++++++++++++++++++ media-layer/stubs/{ => redirect}/src/nop.c | 0 scripts/generate-appimage-builder-yaml.js | 5 +++-- scripts/install-dependencies.sh | 1 + 7 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 media-layer/stubs/redirect/CMakeLists.txt rename media-layer/stubs/{ => redirect}/src/nop.c (100%) diff --git a/dependencies/zenity/src b/dependencies/zenity/src index 4663a8656..b01f0001e 160000 --- a/dependencies/zenity/src +++ b/dependencies/zenity/src @@ -1 +1 @@ -Subproject commit 4663a8656d8c12be00286ee10aae2ff55ff589af +Subproject commit b01f0001eae0b01f9de2bba3d1b93c386b298c0d diff --git a/launcher/src/ldconfig.cpp b/launcher/src/ldconfig.cpp index aa4dfb22a..58f22e0bf 100644 --- a/launcher/src/ldconfig.cpp +++ b/launcher/src/ldconfig.cpp @@ -25,7 +25,11 @@ char *get_full_library_search_path() { } // Interpret if (str.size() >= 2 && str[0] != '\t' && str[str.size() - 1] == ':') { - output.append(str); + // Blacklist RPI Legacy GL Drivers +#define RPI_LEGACY_GL_PATH "/opt/vc" + if (str.rfind(RPI_LEGACY_GL_PATH ":", 0) != 0 && str.rfind(RPI_LEGACY_GL_PATH "/", 0) != 0) { + output.append(str); + } } } else { running = 0; @@ -37,8 +41,10 @@ char *get_full_library_search_path() { output.pop_back(); } // Close Process - int ret = WEXITSTATUS(pclose(file)); - if (ret != 0) { + int ret = pclose(file); + if (ret == -1) { + ERR("ldconfig Failed: %s", strerror(errno)); + } else if (ret != 0) { ERR("ldconfig Failed: Exit Code: %i", ret); } // Return diff --git a/media-layer/stubs/CMakeLists.txt b/media-layer/stubs/CMakeLists.txt index fda90d5d5..ca0347a26 100644 --- a/media-layer/stubs/CMakeLists.txt +++ b/media-layer/stubs/CMakeLists.txt @@ -1,6 +1,6 @@ project(media-layer-stubs) -# Add GLES Stubs For Linking +# Add GLES1 Stubs For Linking add_library(GLESv1_CM SHARED src/GLESv1_CM.c) target_link_libraries(GLESv1_CM media-layer-headers) set_target_properties(GLESv1_CM PROPERTIES SOVERSION "1") @@ -27,17 +27,11 @@ if(BUILD_ARM_COMPONENTS) install(TARGETS EGL X11 DESTINATION "${MCPI_FALLBACK_LIB_DIR}") # Place At The End Of LD_LIBRARY_PATH endif() - # Install GLESv1_CM Stubs In Server Mode + # Install Fake GLESv1_CM Stubs In Server Mode if(MCPI_HEADLESS_MODE) install(TARGETS GLESv1_CM DESTINATION "${MCPI_LIB_DIR}") endif() - # MCPI Depends On GLESv2, But Uses GLESv1_CM - install_symlink("libGLESv1_CM.so.1" "${MCPI_LIB_DIR}/libGLESv2.so") - # Prevent MCPI From Linking To The Legacy GL Driver When Directly Linking To GL (RPI-Specific) - if(NOT MCPI_HEADLESS_MODE AND NOT MCPI_USE_MEDIA_LAYER_PROXY) - # Symlinks - install_symlink("/usr/lib/arm-linux-gnueabihf/libEGL.so.1" "${MCPI_LIB_DIR}/libEGL.so") - install_symlink("/usr/lib/arm-linux-gnueabihf/libGLESv1_CM.so.1" "${MCPI_LIB_DIR}/libGLESv1_CM.so.1") - endif() + # Redirect MCPI To Correct Libraries + add_subdirectory(redirect) endif() diff --git a/media-layer/stubs/redirect/CMakeLists.txt b/media-layer/stubs/redirect/CMakeLists.txt new file mode 100644 index 000000000..f793c643e --- /dev/null +++ b/media-layer/stubs/redirect/CMakeLists.txt @@ -0,0 +1,18 @@ +project(media-layer-stubs-redirect) + +# MCPI Depends On GLESv2, But Uses GLESv1_CM +add_library(GLESv2_redirect SHARED src/nop.c) +target_link_libraries(GLESv2_redirect GLESv1_CM) +target_link_options(GLESv2_redirect PRIVATE "-Wl,--no-as-needed") +set_target_properties(GLESv2_redirect PROPERTIES OUTPUT_NAME "GLESv2") +install(TARGETS GLESv2_redirect DESTINATION "${MCPI_LIB_DIR}") + +# MCPI links to libEGL.so instead of libEGL.so.1, this creates a fake libEGL.so which redirects it to the correct libEGL.so.1. +# This is only needed on configurations that don't generate their own libEGL.so. +if(NOT MCPI_HEADLESS_MODE AND NOT MCPI_USE_MEDIA_LAYER_PROXY) + add_library(EGL_redirect SHARED src/nop.c) + target_link_libraries(EGL_redirect EGL) + target_link_options(EGL_redirect PRIVATE "-Wl,--no-as-needed") + set_target_properties(EGL_redirect PROPERTIES OUTPUT_NAME "EGL") + install(TARGETS EGL_redirect DESTINATION "${MCPI_LIB_DIR}") +endif() diff --git a/media-layer/stubs/src/nop.c b/media-layer/stubs/redirect/src/nop.c similarity index 100% rename from media-layer/stubs/src/nop.c rename to media-layer/stubs/redirect/src/nop.c diff --git a/scripts/generate-appimage-builder-yaml.js b/scripts/generate-appimage-builder-yaml.js index 23136f71e..168d29c54 100755 --- a/scripts/generate-appimage-builder-yaml.js +++ b/scripts/generate-appimage-builder-yaml.js @@ -23,7 +23,6 @@ const version = fs.readFileSync('VERSION', 'utf8').trim(); // Packages/Dependencies const packages = [ 'libc6', - 'libc-bin', 'libstdc++6' ]; if (mode === 'client') { @@ -132,7 +131,9 @@ const runtime = { `usr/lib/${name}/minecraft-pi`, `usr/lib/${name}/**/*.so`, 'usr/arm-linux-gnueabihf/lib' - ] : undefined + ] : undefined, + // libapprun_hooks.so Is Buggy And Unneeded + no_hooks: true }; // AppDir diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 3b7145496..29f43ff7f 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -88,6 +88,7 @@ fi queue_pkg \ python3-pip \ python3-setuptools \ + python3-wheel \ patchelf \ desktop-file-utils \ libgdk-pixbuf2.0-dev \