termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.15k stars 3.02k forks source link

[Bug]: termux-elf-cleaner: Section header for 'usr/lib/x86_64-linux-android/27/libGLESv3.so' would end at 94808 but file size only 57344 #11847

Closed diyism closed 2 years ago

diyism commented 2 years ago

Problem description

I'm trying build-bootstraps.sh in docker, but it failed with error: termux-elf-cleaner: Section header for 'usr/lib/x86_64-linux-android/27/libGLESv3.so' would end at 94808 but file size only 57344

I can't figure out what's wrong, any hint?

What steps will reproduce the bug?

$ git clone --depth 1 https://github.com/termux/termux-packages.git
$ cd termux-packages/scripts
$ ./update-docker.sh
Using default tag: latest
latest: Pulling from termux/package-builder
Digest: sha256:770243427bca3a361ba0de85aceaefbea2a3c1e1575a988584aa31fc7b0f0da3
Status: Image is up to date for ghcr.io/termux/package-builder:latest
ghcr.io/termux/package-builder:latest
Image 'ghcr.io/termux/package-builder' used in the container 'termux-package-builder' is already up to date

$ ./run-docker.sh
$ cd scripts
$ ./setup-android-sdk.sh
INFO: Using sdkmanager ... /home/builder/lib/android-sdk-8512546/cmdline-tools/bin/sdkmanager
INFO: Using NDK ... /home/builder/lib/android-ndk-r25
All SDK package licenses accepted.======] 100% Computing updates...             
[=======================================] 100% Computing updates...

$ ./build-bootstraps.sh -a aarch64
[*] Building 'apt'...
termux - building apt for arch aarch64...
Building dependency libandroid-support if necessary...
termux - building libandroid-support for arch aarch64...
Applying ndk-patch: bits-struct_file.h.patch
Applying ndk-patch: dirent.h.patch
Applying ndk-patch: grp.h.patch
Applying ndk-patch: langinfo.h.patch
Applying ndk-patch: linux-fcntl.h.patch
Applying ndk-patch: paths.h.patch
Applying ndk-patch: pwd.h.patch
Applying ndk-patch: redefine-TCSAFLUSH.patch
Applying ndk-patch: semaphore.h.patch
Applying ndk-patch: stdio.h.patch
Applying ndk-patch: stdlib.h.patch
Applying ndk-patch: sys-cdefs.h.patch
Applying ndk-patch: syslog.patch
Applying ndk-patch: unistd.h.patch
Applying ndk-patch: utmp.h.patch
termux-elf-cleaner: Section header for 'usr/lib/x86_64-linux-android/27/libGLESv3.so' would end at 94808 but file size only 57344
[*] Building 'apt' exited with exit code 1
Failed to build package 'apt' for arch 'aarch64'

What is the expected behavior?

No response

System information

$ uname -a
Linux kali 5.9.0-kali1-amd64 #1 SMP Debian 5.9.1-1kali2 (2020-10-29) x86_64 GNU/Linux
Grimler91 commented 2 years ago

Sounds like ~/lib/android-ndk might be corrupted or only half-extracted. Try

rm -rf ~/lib/android-ndk
./scripts/setup-android-sdk.sh
sylirre commented 2 years ago

./setup-android-sdk.sh is not needed if using Docker image.

diyism commented 2 years ago

My fault, my docker container's default dev mapper size is too small (10GB), the build-bootstraps.sh need about 30GB, I have used

$ sudo dmsetup table "docker-0:27-6459859-4861929f8aab3624f45133b94ccf47654be7fbe9074be0cf729c54d00a90a324"
0 20971520 thin 254:1 44
$ echo 0 41943040 thin 254:1 44 | sudo dmsetup load "docker-0:27-6459859-4861929f8aab3624f45133b94ccf47654be7fbe9074be0cf729c54d00a90a324"
$ sudo dmsetup resume "docker-0:27-6459859-4861929f8aab3624f45133b94ccf47654be7fbe9074be0cf729c54d00a90a324"
$ sudo resize2fs "/dev/mapper/docker-0:27-6459859-4861929f8aab3624f45133b94ccf47654be7fbe9074be0cf729c54d00a90a324"

and expanded my docker container size,

then executed "export NDK=/home/builder/lib/android-ndk-r25/"

now the "./build-bootstraps.sh -a aarch64" can continue in my docker container,

but after about 2 hours compilation without an error, a new error happened:

[*] Building 'apt'...
apt@2.5.2-3 built - skipping (rm /data/data/.built-packages/apt to force rebuild)
[*] Building 'apt' exited with exit code 0

[*] Building 'bash'...
bash@5.1.16-1 built - skipping (rm /data/data/.built-packages/bash to force rebuild)
[*] Building 'bash' exited with exit code 0

[*] Building 'bzip2'...
ERROR: No package bzip2 found in any of the enabled repositories. Are you trying to set up a custom repository?
[*] Building 'bzip2' exited with exit code 1
Failed to build package 'bzip2' for arch 'aarch64'

$ ls -dl /home/builder/termux-packages/packages/libbz2
drwxr-xr-x 2 root root 4096 Sep 10 21:12 /home/builder/termux-packages/packages/libbz2

$ ls  /home/builder/termux-packages/packages/libbz2
build.sh  bzdiff.patch  bzip2.subpackage.sh  cross_compile.patch  shared_library.patch

I can't figure out what's wrong, any hint?

truboxl commented 2 years ago

https://github.com/termux/termux-packages/issues/10462