termux-user-repository / tur

A place for all types of Termux packages.
Other
438 stars 79 forks source link

[Bug]:GCC's wrong include order causes compilation errors #1255

Open killcerr opened 3 days ago

killcerr commented 3 days ago

Problem description

Some programs use the PATH_MAX macro which usually defines in . On Termux, GCC will use limits.h in /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/14.1.0/include instead of which in /data/data/com.termux/files/usr/include. /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/14.1.0/include/limits.h not define PATH_MAX will cause compilation errors. This issue also happend on other versions of GCC.

What steps will reproduce the bug?

install gcc write a c file like this.

#include <limits.h>
int main()
{
   int path_max=PATH_MAX;
}

use gcc to complie it.

What is the expected behavior?

GCC should include limits.h in /data/data/com.termux/files/usr/include rather than include limits.h in /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/14.1.0/include

System information

termux-info:

Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1+c281d96
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=/data/app/~~iKVm4olgthHYVpB7l_GyLQ==/com.termux-Hljx_rasiLnc-RDbs9vfGQ==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-5
TERMUX_APP__PID=20026
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c65,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c65,c257,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10321
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+062c977
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+062c977
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirrors.medzik.dev/termux/termux-main stable main
# glibc-repo (sources.list.d/glibc.list)
deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# x11-repo (sources.list.d/x11.list)
deb https://mirrors.medzik.dev/termux/termux-x11 x11 main
Updatable packages:
c-ares/stable 1.34.1 aarch64 [upgradable from: 1.33.1]
cmake/stable 3.30.5 aarch64 [upgradable from: 3.30.4]
exiftool/stable 12.98 all [upgradable from: 12.97]
gdb/stable 15.2 aarch64 [upgradable from: 15.1-1]
qt6-qtbase/x11 6.8.0 aarch64 [upgradable from: 6.7.3]
qt6-qtdeclarative/x11 6.8.0-1 aarch64 [upgradable from: 6.7.3]
qt6-qtlanguageserver/x11 6.8.0 aarch64 [upgradable from: 6.7.3]
qt6-qtsvg/x11 6.8.0 aarch64 [upgradable from: 6.7.3]
qt6-qtwayland/x11 6.8.0 aarch64 [upgradable from: 6.7.3]
termux-tools version:
1.43.6
Android version:
14
Kernel build information:
Linux localhost 5.10.198-gki-g5b6f31741c51 #1 SMP PREEMPT Tue Aug 20 08:52:45 UTC 2024 aarch64 Android
Device manufacturer:
vivo
Device model:
V2301A
LD Variables:
LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.window versionCode:15
com.termux.gui versionCode:7
com.termux.api versionCode:51
licy183 commented 3 days ago

Actually in Linux PATH_MAX is defined in linux/limits.h.

This is a bug, but I don't know how to fix it. I'll have a look if I have more time.