box64 icon indicating copy to clipboard operation
box64 copied to clipboard

falied to build a statically linked box64 in termux

Open moonsoul38 opened this issue 7 months ago • 5 comments

My English are bad,sorry

Environment Device: Redmi k70 pro soc: Snapdragon 8Gen3 Android Version: 14 box64 version:0.3.5 termux-info Screenshot_2025-05-26-21-36-26-395_com.termux.jpg

Build command cmake .. -DSTATICBUILD=ON -DARM_DYNAREC=ON -DTERMUX=1 -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo

Error log

[ 96%] Building C object CMakeFiles/mainobj.dir/src/wrapped/wrappedldlinux.c.o [ 96%] Building C object CMakeFiles/mainobj.dir/src/wrapped/wrappedlibc.c.o [ 97%] Building C object CMakeFiles/mainobj.dir/src/wrapped/wrappedlibcmusl.c.o [ 97%] Building C object CMakeFiles/mainobj.dir/src/wrapped/wrappedlibdl.c.o In file included from /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibc.c:3886: /data/data/com.termux/files/home/box64/src/libtools/static_libc.h:4:10: fatal error: 'aliases.h' file not found 4 | #include <aliases.h> | ^~~~~~~~~~~ [ 97%] Building C object CMakeFiles/mainobj.dir/src/wrapped/wrappedlibm.c.o 1 error generated. make[2]: *** [CMakeFiles/mainobj.dir/build.make:865: CMakeFiles/mainobj.dir/src/wrapped/wrappedlibc.c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibdl.c:20: /data/data/com.termux/files/home/box64/src/elfs/elfloader_private.h:155:9: warning: 'R_X86_64_JUMP_SLOT' macro redefined [-Wmacro-redefined] 155 | #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ | ^ /data/data/com.termux/files/usr/include/elf.h:293:9: note: previous definition is here 293 | #define R_X86_64_JUMP_SLOT R_X86_64_JMP_SLOT | ^ In file included from /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm.c:222: In file included from /data/data/com.termux/files/home/box64/src/wrapped/wrappedlib_init.h:68: /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:78:5: error: call to undeclared library function 'clog' with type '_Complex double (_Complex double)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 78 | GOW(clog, XFX) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:78:5: note: include the header <complex.h> or explicitly provide a declaration for 'clog' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:85:5: error: call to undeclared library function 'clogf' with type '_Complex float (_Complex float)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 85 | GOW(clogf, xFx) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:85:5: note: include the header <complex.h> or explicitly provide a declaration for 'clogf' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:101:5: error: call to undeclared library function 'cpow' with type '_Complex double (_Complex double, _Complex double)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 101 | GOW(cpow, XFXX) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:101:5: note: include the header <complex.h> or explicitly provide a declaration for 'cpow' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:102:5: error: call to undeclared library function 'cpowf' with type '_Complex float (_Complex float, _Complex float)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 102 | GOW(cpowf, xFxx) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:102:5: note: include the header <complex.h> or explicitly provide a declaration for 'cpowf' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:136:5: error: use of undeclared identifier 'exp10' 136 | GOW(exp10, dFd) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:137:5: error: use of undeclared identifier 'exp10f' 137 | GOW(exp10f, fFf) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:176:4: error: call to undeclared library function '__finitef' with type 'int (float)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 176 | GO(__finitef, iFf) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:176:4: note: include the header <math.h> or explicitly provide a declaration for '__finitef' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:196:4: error: use of undeclared identifier '__fpclassify' 196 | GO(__fpclassify, iFd) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:197:4: error: use of undeclared identifier '__fpclassifyf' 197 | GO(__fpclassifyf, iFf) | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:320:4: error: call to undeclared library function 'roundeven' with type 'double (double)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 320 | GO(roundeven, dFd) //since C23 | ^ /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:320:4: note: include the header <math.h> or explicitly provide a declaration for 'roundeven' /data/data/com.termux/files/home/box64/src/wrapped/wrappedlibm_private.h:321:4: error: call to undeclared library function 'roundevenf' with type 'float (float)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 321 | GO(roundevenf, fFf)

moonsoul38 avatar May 26 '25 13:05 moonsoul38

Why do you want a Static build in termux? are you using docker in termux?

ptitSeb avatar May 26 '25 14:05 ptitSeb

Why do you want a Static build in termux? are you using docker in termux?

Because I want to use it inside proot

moonsoul38 avatar May 27 '25 14:05 moonsoul38

Why do you want a Static build in termux? are you using docker in termux?

I have tried to build it in proot arm64 with command:

cmake .. -D ARM_DYNAREC=ON -D ARM64=1 -DCMAKE_C_COMPILER=gcc -DBAD_SIGNAL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTATICBUILD=on

But proot can't run it: ~ $ proot -r ux86 /bin/box64 /bin/sh proot warning: can't chdir("/data/data/com.termux/files/home/./.") in the guest rootfs: No such file or directory proot info: default working directory is now "/" proot error: execve("/usr/bin/box64"): Function not implemented proot info: possible causes:

  • the program is a script but its interpreter (eg. /bin/sh) was not found;
  • the program is an ELF but its interpreter (eg. ld-linux.so) was not found;
  • the program is a foreign binary but qemu was not specified;
  • qemu does not work correctly (if specified);
  • the loader was not found or doesn't work. fatal error: see proot --help. So I try
cmake .. -DSTATICBUILD=on -D ARM_DYNAREC=ON -D TERMUX=1 -DCMAKE_C_COMPILER=clang -D CMAKE_BUILD_TYPE=RelWithDebInfo

An error also occurred during construction, but it seems different from what happened within termux Screenshot_2025-05-27-22-23-59-891_com.termux.jpg

moonsoul38 avatar May 27 '25 14:05 moonsoul38

STATICBUILD does not support graphics apps. IS that what you want?

ptitSeb avatar May 27 '25 14:05 ptitSeb

STATICBUILD does not support graphics apps. IS that what you want?

I tried running box64 glibc in termux in proot instead of the staticbuilt version, and it successfully started bash, but it seems that all programs except bash cannot run: Screenshot_2025-05-31-21-02-36-137_com.termux.jpg

This is the startup script

proot --bind=/data/data/com.termux/files/usr/tmp:/tmp --bind=/data/data/com.termux/files/usr --bind=/vendor --bind=/system_ext --bind=/system --bind=/product --bind=/odm --bind=/apex --bind=/data/data/com.termux/files/home --bind=/data/data/com.termux/cache --bind=/data/misc/apexdata/com.android.art/dalvik-cache --bind=/data/dalvik-cache --bind=/data/app --bind=/data/data/com.termux/files/home/ux86/tmp:/dev/shm --bind=/data/data/com.termux/files/home/ux86/proc/.sysctl_inotify_max_user_watches:/proc/sys/fs/inotify/max_user_watches --bind=/data/data/com.termux/files/home/ux86/proc/.sysctl_entry_cap_last_cap:/proc/sys/kernel/cap_last_cap --bind=/data/data/com.termux/files/home/ux86/proc/.vmstat:/proc/vmstat --bind=/data/data/com.termux/files/home/ux86/proc/.version:/proc/version --bind=/data/data/com.termux/files/home/ux86/proc/.uptime:/proc/uptime --bind=/data/data/com.termux/files/home/ux86/proc/.stat:/proc/stat --bind=/data/data/com.termux/files/home/ux86/proc/.loadavg:/proc/loadavg --bind=/data/data/com.termux/files/home/ux86/sys/.empty:/sys/fs/selinux --bind=/sys --bind=/proc/self/fd/2:/dev/stderr --bind=/proc/self/fd/1:/dev/stdout --bind=/proc/self/fd/0:/dev/stdin --bind=/proc/self/fd:/dev/fd --bind=/proc --bind=/dev/urandom:/dev/random --bind=/dev -L --kernel-release=6.2.1-PRoot-Distro --sysvipc --link2symlink --kill-on-exit --cwd=/root --change-id=0:0 --rootfs=/data/data/com.termux/files/home/ux86 /data/data/com.termux/files/usr/glibc/bin/env -i BOX64_LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/lib:/lin64 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games EXTERNAL_STORAGE=/sdcard PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin COLORTERM=truecolor EXTERNAL_STORAGE=/sdcard LANG=en_US.UTF-8 PULSE_SERVER=127.0.0.1 TERM=xterm-256color TMPDIR=/tmp HOME=/root USER=root TERM=xterm-256color LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/lib:/lin64 /data/data/com.termux/files/usr/glibc/bin/box64 /bin/bash

moonsoul38 avatar May 31 '25 13:05 moonsoul38