Skip to content

Commit

Permalink
fix(main/swi-prolog): continue even if ABI check fails
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkirkman committed Jan 3, 2025
1 parent f5adac3 commit aab7991
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/swi-prolog/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Most popular and complete prolog implementation"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="9.3.17"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.swi-prolog.org/download/devel/src/swipl-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=0c091d56ea8c941e3af760af24134f60e1e06b1379af8dcd42492c82f5b3ac46
TERMUX_PKG_DEPENDS="libandroid-execinfo, libarchive, libcrypt, libgmp, libyaml, ncurses, openssl, ossp-uuid, readline, zlib, pcre2"
Expand Down
30 changes: 30 additions & 0 deletions packages/swi-prolog/continue-on-abi-check-failure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
swi-prolog cannot currently continue in Termux on 32-bit ARM architecture without this patch.
https://github.com/termux/termux-packages/issues/22737
--- a/src/pl-init.c
+++ b/src/pl-init.c
@@ -256,11 +256,21 @@ check_home(const char *dir)
Ssnprintf(abi_file_name, sizeof(abi_file_name),
"%s/ABI", dir);
if ( (fd = Sopen_file(abi_file_name, "r")) )
- { char *abi_string = Sfgets(abi_buf, sizeof(abi_buf), fd);
+ { char *build_time_abi_string = Sfgets(abi_buf, sizeof(abi_buf), fd);
Sclose(fd);
- if ( abi_string )
- { remove_trailing_whitespace(abi_string);
- return match_abi_version(abi_version(), abi_string);
+ if ( build_time_abi_string )
+ { remove_trailing_whitespace(build_time_abi_string);
+ char *run_time_abi_string = abi_version();
+ if (match_abi_version(run_time_abi_string, build_time_abi_string) == 1)
+ { return true;
+ } else
+ { printf("WARNING: ABI mismatch!\n");
+ printf("build time ABI found in %s: %s\n", abi_file_name, build_time_abi_string);
+ printf("run time ABI returned by abi_version(): %s\n", run_time_abi_string);
+ printf("attempting to continue for workaround purposes...\n");
+ // returning true to force the error into a warning
+ return true;
+ }
} else
{ return BAD_HOME_BAD_ABI;
}

0 comments on commit aab7991

Please sign in to comment.