From 11a78f76702ce0066f1807173bf237b2c0fd340a Mon Sep 17 00:00:00 2001 From: lat9nq Date: Wed, 25 May 2022 21:00:44 -0400 Subject: [PATCH 1/2] checkrt: Sort symbols Some systems have out-of-order symbols in libstdc++, which fools the old logic into thinking the installed libstdc++ library is older than the included version. This causes problems with host libraries that need a newer libstdc++ library. Sort the symbols found in the library and use the last one. checkrt: Fix symbol sorting --- checkrt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkrt.c b/checkrt.c index 7607d61..35d2d5a 100644 --- a/checkrt.c +++ b/checkrt.c @@ -61,7 +61,7 @@ void checkrt(char *usr_in_appdir) char *stdcxx_bundle_lib = "./" CXXDIR "/libstdc++.so.6"; char *gcc_bundle_lib = "./" GCCDIR "/libgcc_s.so.1"; - const char *format = "tr '\\0' '\\n' < '%s' | grep -e '%s' | tail -n1"; + const char *format = "tr '\\0' '\\n' < '%s' | grep -e '%s' | sort -V | tail -n1"; if (access(stdcxx_bundle_lib, F_OK) == 0) { f = popen("PATH=\"/sbin:$PATH\" ldconfig -p | grep 'libstdc++.so.6 (" LIBC6_ARCH ")' | awk 'NR==1{print $NF}'", "r"); From 8def3dfb0a9705228a261401c7876842589dc1b9 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Wed, 25 May 2022 18:50:43 -0400 Subject: [PATCH 2/2] AppRun.sh: Sort GLIBCXX versions AppRun.sh: Fix symbol sorting Uses sort with its own version sorting. --- AppRun.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AppRun.sh b/AppRun.sh index 52e922c..74f9e02 100755 --- a/AppRun.sh +++ b/AppRun.sh @@ -19,8 +19,8 @@ cd "usr" if [ -e "./optional/libstdc++/libstdc++.so.6" ]; then lib="$(PATH="/sbin:$PATH" ldconfig -p | grep "libstdc++\.so\.6 ($libc6arch)" | awk 'NR==1{print $NF}')" - sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GLIBCXX_3\.4' | tail -n1) - sym_app=$(tr '\0' '\n' < "./optional/libstdc++/libstdc++.so.6" | grep -e '^GLIBCXX_3\.4' | tail -n1) + sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GLIBCXX_3\.4' | sort -V | tail -n1) + sym_app=$(tr '\0' '\n' < "./optional/libstdc++/libstdc++.so.6" | grep -e '^GLIBCXX_3\.4' | sort -V | tail -n1) if [ "$(printf "${sym_sys}\n${sym_app}"| sort -V | tail -1)" != "$sym_sys" ]; then cxxpath="./optional/libstdc++:" fi @@ -28,8 +28,8 @@ fi if [ -e "./optional/libgcc/libgcc_s.so.1" ]; then lib="$(PATH="/sbin:$PATH" ldconfig -p | grep "libgcc_s\.so\.1 ($libc6arch)" | awk 'NR==1{print $NF}')" - sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GCC_[0-9]\\.[0-9]' | tail -n1) - sym_app=$(tr '\0' '\n' < "./optional/libgcc/libgcc_s.so.1" | grep -e '^GCC_[0-9]\\.[0-9]' | tail -n1) + sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GCC_[0-9]\\.[0-9]' | sort -V | tail -n1) + sym_app=$(tr '\0' '\n' < "./optional/libgcc/libgcc_s.so.1" | grep -e '^GCC_[0-9]\\.[0-9]' | sort -V | tail -n1) if [ "$(printf "${sym_sys}\n${sym_app}"| sort -V | tail -1)" != "$sym_sys" ]; then gccpath="./optional/libgcc:" fi