-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Problem description
This is a behavior difference I have noticed between 32-bit ARM Termux and all other kinds of Termux that is difficult to explain and understand,
so I am posting a minimal reproducible example of the difference, and hopefully this example can help us work together to figure out what the best solution is. I have confirmed that this is something that, while already subtly different during the use of NDK r27c, only started resulting in an error occurring for some architectures but not others after the update to NDK r28c, so the correct outcome should be for all other Termux architectures to behave as 32-bit ARM Termux currently does, like they did previously.
What steps will reproduce the bug?
These commands have different behavior on 32-bit ARM Termux from other kinds of Termux.
clang --version
$PREFIX/bin/*-clang --version
cat <<-EOF > test.c
#include <stdio.h>
int main(void)
{
FILE *stream;
stream = fopen("file", "w");
printf("File number is %d\n", fileno_unlocked(stream));
fclose(stream);
return 0;
}
EOF
clang test.c
$PREFIX/bin/*-clang test.cOutput on 32-bit ARM Termux:
clang version 20.1.8
Target: armv7a-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
clang version 20.1.8
Target: armv7a-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
Output on 64-bit ARM Termux:
clang version 20.1.8
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
clang version 20.1.8
Target: aarch64-unknown-linux-android
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
test.c:7:35: error: call to undeclared function 'fileno_unlocked'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
7 | printf("File number is %d\n", fileno_unlocked(stream));
| ^
test.c:7:35: note: did you mean 'getc_unlocked'?
/data/data/com.termux/files/usr/bin/../../usr/include/stdio.h:317:17: note: 'getc_unlocked' declared here
317 | __nodiscard int getc_unlocked(FILE* _Nonnull __fp);
| ^
1 error generated.
I have now confirmed that this is an NDK-r28c-related issue.
Output on a 64-bit x86 Termux that has not been updated since before the update to NDK r28c:
ndk-sysroot:
Installed: 27c
Candidate: 27c
Version table:
*** 27c 500
500 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 Packages
100 /data/data/com.termux/files/usr/var/lib/dpkg/status
clang version 20.1.6
Target: x86_64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
clang version 20.1.6
Target: x86_64-unknown-linux-android
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
Output on that same Termux shown above, but after updating, today:
ndk-sysroot:
Installed: 28c
Candidate: 28c
Version table:
*** 28c 500
500 https://packages-cf.termux.dev/apt/termux-main stable/main x86_64 Packages
100 /data/data/com.termux/files/usr/var/lib/dpkg/status
clang version 20.1.8
Target: x86_64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
clang version 20.1.8
Target: x86_64-unknown-linux-android
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
test.c:7:35: error: call to undeclared function 'fileno_unlocked'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
7 | printf("File number is %d\n", fileno_unlocked(stream));
| ^
test.c:7:35: note: did you mean 'getc_unlocked'?
/data/data/com.termux/files/usr/bin/../../usr/include/stdio.h:317:17: note: 'getc_unlocked' declared here
317 | __nodiscard int getc_unlocked(FILE* _Nonnull __fp);
| ^
1 error generated.
What is the expected behavior?
I expected that no error should occur, so maybe, this should be fixed by applying the same exact "wrapper" that 32-bit ARM Termux uses which results in the behavior difference, from:
to all other Termux architectures as well? I'm not sure currently.
System information
Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__APK_FILE=/data/app/~~gVwKanLEt3onhDQBKcUZQA==/com.termux-Jepd-I809CuxEnnuONZ6_Q==/base.apk
TERMUX_APP__APK_RELEASE=F_DROID
TERMUX_APP__APP_VERSION_CODE=1020
TERMUX_APP__APP_VERSION_NAME=0.119.0-beta.1
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=false
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=12106
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-beta.1
TERMUX__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c237,c256,c512,c768
TERMUX__SE_INFO=default:targetSdkVersion=28:complete
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c237,c256,c512,c768
TERMUX__UID=10237
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# apt(sources.list) [legacy]
deb https://packages.termux.dev/apt/termux-main stable main
# glibc-repo(sources.list.d/glibc.list) [legacy]
# The glibc termux repository, with cloudflare cache
deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable
# The glibc termux repository, without cloudflare cache
# deb https://packages.termux.dev/apt/termux-glibc/ glibc stable
# root-repo(sources.list.d/root.list) [legacy]
deb https://packages.termux.dev/apt/termux-root root stable
# sources.list.d/termux-adb.list [legacy]
deb https://nohajc.github.io termux extras
# x11-repo(sources.list.d/x11.list) [legacy]
deb https://packages.termux.dev/apt/termux-x11 x11 main
Updatable packages:
audacity-ffmpeg/x11 3.7.5 aarch64 [upgradable from: 3.7.4-1]
audacity/x11 3.7.5 aarch64 [upgradable from: 3.7.4-1]
chezmoi/stable 2.64.0 aarch64 [upgradable from: 2.63.1]
cmake-curses-gui/stable 4.1.0 aarch64 [upgradable from: 4.0.3]
cmake/stable 4.1.0 aarch64 [upgradable from: 4.0.3]
dpkg-perl/stable 1.22.6-4 all [upgradable from: 1.22.6-3]
dpkg-scanpackages/stable 1.22.6-4 all [upgradable from: 1.22.6-3]
dpkg/stable 1.22.6-4 aarch64 [upgradable from: 1.22.6-3]
ed/stable 1.22.1 aarch64 [upgradable from: 1.22]
firefox/x11 141.0.2 aarch64 [upgradable from: 141.0]
flameshot/x11 13.0.1 aarch64 [upgradable from: 13.0.0]
frida-dev/root 17.2.14-1 aarch64 [upgradable from: 17.2.14]
frida-python/root 17.2.14-1 aarch64 [upgradable from: 17.2.14]
frida/root 17.2.14-1 aarch64 [upgradable from: 17.2.14]
gtk-update-icon-cache/x11 3.24.50 aarch64 [upgradable from: 3.24.49-3]
gtk3/x11 3.24.50 aarch64 [upgradable from: 3.24.49-3]
krb5/stable 1.22 aarch64 [upgradable from: 1.21.3]
libapt-pkg-perl/stable 0.1.40-11 aarch64 [upgradable from: 0.1.40-10]
libheif-progs/stable 1.20.2 aarch64 [upgradable from: 1.20.1]
libheif/stable 1.20.2 aarch64 [upgradable from: 1.20.1]
libjasper-utils/stable 4.2.8 aarch64 [upgradable from: 4.2.7]
libjasper/stable 4.2.8 aarch64 [upgradable from: 4.2.7]
libraqm/stable 0.10.3 aarch64 [upgradable from: 0.10.2]
libregexp-assemble-perl/stable 0.38-7 all [upgradable from: 0.38-6]
libxmlb/stable 0.3.23 aarch64 [upgradable from: 0.3.22]
luanti-common/x11 1:5.13.0-1 all [upgradable from: 1:5.13.0]
luanti-server/x11 1:5.13.0-1 aarch64 [upgradable from: 1:5.13.0]
lux-cli/stable 0.13.1 aarch64 [upgradable from: 0.13.0]
oh-my-posh/stable 26.18.0 aarch64 [upgradable from: 26.17.3]
ollama/stable 0.11.3 aarch64 [upgradable from: 0.10.1]
oxc-language-server/stable 1.11.0 aarch64 [upgradable from: 1.9.0]
oxlint/stable 1.11.0 aarch64 [upgradable from: 1.9.0]
perl/stable 5.40.3 aarch64 [upgradable from: 5.40.3]
python-cryptography/stable 45.0.6 aarch64 [upgradable from: 45.0.5]
strace/stable 6.16 aarch64 [upgradable from: 6.15]
subversion-perl-static/stable 1.14.5-1 aarch64 [upgradable from: 1.14.5]
subversion-perl/stable 1.14.5-1 aarch64 [upgradable from: 1.14.5]
subversion/stable 1.14.5-1 aarch64 [upgradable from: 1.14.5]
w3m-img/stable 0.5.4 aarch64 [upgradable from: 0.5.3.20230121-3]
w3m/stable 0.5.4 aarch64 [upgradable from: 0.5.3.20230121-3]
yosys/stable 0.56 aarch64 [upgradable from: 0.55-1]
termux-tools version:
1.46.0
Android version:
13
Kernel build information:
Linux localhost 4.14.190-lineage-gef0cb31b13 #4 SMP PREEMPT Fri Jun 23 13:11:47 CEST 2023 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A705FN
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.x11 versionCode:15