termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

[Bug]: libandroid-glob 0.7 contains corrupted library file (1 byte), breaks ffmpeg and other packages

Open salviz opened this issue 1 month ago • 5 comments

Problem description

The libandroid-glob package version 0.7 contains a corrupted library file. The file /data/data/com.termux/files/usr/lib/libandroid-glob.so is only 1 byte instead of being a proper ELF library or symlink.

This causes link errors for any package that depends on libandroid-glob.so, including ffmpeg7, imagemagick, and potentially others.

Error message

CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/bin/ffmpeg": "/data/data/com.termux/files/usr/lib/libandroid-glob.so" is too small to be an ELF executable: only found 1 bytes

What steps will reproduce the bug?

  1. Update packages to get libandroid-glob 0.7 (built on 2025-11-10)
  2. Install ffmpeg7: pkg install ffmpeg7
  3. Try to run ffmpeg: ffmpeg -version
  4. Observe the link error

Investigation

Checking the package contents shows the file is corrupted:

$ ls -lh /data/data/com.termux/files/usr/lib/libandroid-glob.so
-rw-------. 1 u0_a429 u0_a429 1 Nov 10 00:04 /data/data/com.termux/files/usr/lib/libandroid-glob.so

$ file /data/data/com.termux/files/usr/lib/libandroid-glob.so
/data/data/com.termux/files/usr/lib/libandroid-glob.so: very short file (no magic)

$ apt-get download libandroid-glob && dpkg-deb -c libandroid-glob_0.7_aarch64.deb | grep libandroid-glob.so
-rw------- 0/0               1 2025-11-10 00:04 ./data/data/com.termux/files/usr/lib/libandroid-glob.so

The package itself contains the corrupted 1-byte file.

Workaround

According to the package description, libandroid-glob should be a "Symlink to libc for compatibility". Creating this symlink manually fixes the issue:

rm /data/data/com.termux/files/usr/lib/libandroid-glob.so
ln -s /data/data/com.termux/files/usr/lib/libc++_shared.so /data/data/com.termux/files/usr/lib/libandroid-glob.so

After this workaround, ffmpeg and other affected packages work correctly.

What is the expected behavior?

The libandroid-glob.so file should be a proper symlink to a libc library, not a corrupted 1-byte file.

System information

Termux version: 0.118.1
Android version: 14
Device: Samsung Galaxy S24 Ultra (SM-S918B)
Kernel: Linux 5.15.178-android13-8-31998796-abS918BXXS8EYJ3
Architecture: aarch64

Package information:
libandroid-glob/stable,now 0.7 aarch64 [installed]
ffmpeg7/tur-packages,now 7.1.2 aarch64 [installed]

Related Issues

This might be related to #27185 which reports a similar issue with libandroid-posix-semaphore.so, also from packages built on 2025-11-10.

Suggested Fix

The package build script for libandroid-glob needs to be fixed to properly create the symlink instead of creating a 1-byte file. This likely happened during the build process on 2025-11-10.

salviz avatar Nov 17 '25 04:11 salviz

libandroid-glob.so is a proper shared library file in my setup. Could you try reinstalling the libandroid-glob package?

Biswa96 avatar Nov 17 '25 04:11 Biswa96

Inconsistencies

@salviz unfortunately, there are several inconsistencies with your report, which should be discussed and inspected further to figure out the root cause of your problem.

  1. https://github.com/termux/termux-packages/issues/27185 is related to an accident of the user not using the command pkg upgrade, and is not similar to this
  2. the current correct version of libandroid-glob is 0.6-3, not 0.7. this can be observed in these two locations:
  • official download location: https://packages.termux.dev/apt/termux-main/pool/main/liba/libandroid-glob/libandroid-glob_0.6-3_aarch64.deb

  • official source code location:

https://github.com/termux/termux-packages/blob/1283860ad460dbd9684ac56ef7a2d7ae637caab9/packages/libandroid-glob/build.sh#L5-L6

  1. the official description of libandroid-glob is not "Symlink to libc for compatibility". It is "Shared library for the glob(3) system function". this can be observed in this location:

https://github.com/termux/termux-packages/blob/1283860ad460dbd9684ac56ef7a2d7ae637caab9/packages/libandroid-glob/build.sh#L2

  1. libandroid-glob was not last built on 2025-11-10. It was last built on 2025-08-24. this can be observed by checking the commit date of the most recent update to libandroid-glob: https://github.com/termux/termux-packages/commit/ee7f26236ab58b99836da32ab0a6ff06e4fd9eab

  2. Your suggestion to replace libandroid-glob with a symbolic link to libc++_shared.so does not work correctly on devices that are running normal Termux on Android 7, such as Samsung Galaxy S III SPH-L710:

~ $ getprop ro.build.version.sdk
25
~ $ ffmpeg -version | head -n1
ffmpeg version 8.0 Copyright (c) 2000-2025 the FFmpeg developers
~ $ rm $PREFIX/lib/libandroid-glob.so
~ $ ln -s $PREFIX/lib/libc++_shared.so $PREFIX/lib/libandroid-glob.so
~ $ ffmpeg -version | head -n1
CANNOT LINK EXECUTABLE "ffmpeg": cannot locate symbol "glob" referenced by "/data/data/com.termux/files/usr/lib/libavformat.so.62.3.100"...
~ $ apt reinstall libandroid-glob
CANNOT LINK EXECUTABLE "apt": cannot locate symbol "glob" referenced by "/data/data/com.termux/files/usr/lib/libapt-pkg.so"...
Aborted                    apt reinstall libandroid-glob
~ $ 

(in fact, it is quite dangerous to try your suggestion, because, as you can see, I corrupted my Termux installation in order to demonstrate this, but don't worry that is what I am here to do and I am sure I can figure out some way to recover it, like manually downloading and extracting https://packages.termux.dev/apt/termux-main/pool/main/liba/libandroid-glob/libandroid-glob_0.6-3_arm.deb)

  1. ffmpeg7 is a TUR package, not an official Termux package, and should ideally be discussed in https://github.com/termux-user-repository/tur/issues , not https://github.com/termux/termux-packages/issues. To discuss FFmpeg in official Termux, the package ffmpeg (currently version 8) should be discussed.

@robertkirkman's hypothesis of the problem: Google Play Termux bootstrap/backup installed in F-Droid Termux APK:

Google Play Termux has several properties that curiously line up with some, but not all, of the details of your report:

  1. Google Play Termux contains its own different libandroid-glob which does contain a symbolic link (to libc.so). this can be observed here: https://github.com/termux-play-store/termux-packages/blob/56301b3c167b112d185dae5b81de728371f7ea66/packages/libandroid-glob/build.sh#L10
  2. Google Play Termux's libandroid-glob does have a description matching "Symlink to libc for compatibility". this can be observed here: https://github.com/termux-play-store/termux-packages/blob/56301b3c167b112d185dae5b81de728371f7ea66/packages/libandroid-glob/build.sh#L2
  3. Google Play Termux is not compatible with Android 7 or Android 8, which means that it cannot, under normal circumstances, be affected by the error CANNOT LINK EXECUTABLE "ffmpeg": cannot locate symbol "glob" that can affect Android 7 and Android 8, which justifies the safe replacement of libandroid-glob.so with a symbolic link in Google Play Termux.

However, Google Play Termux does not report itself as version "0.118.1" . The presence of a package derived from Google Play Termux inside an app reporting itself as version "0.118.1" implies that you might have reached this configuration by backing up and transferring files from a Google Play Termux installation to an F-Droid Termux installation.

Unfortunately, backing up the content of Google Play Termux and transferring it to F-Droid Termux is not a supported configuration, and should be avoided to preserve the correct functioning of Termux.

If my hypothesis is correct, you should uninstall your current Termux installation completely, and instead clean install F-Droid Termux from here, in order to resolve the problem:

https://f-droid.org/en/packages/com.termux/

If my hypothesis is not correct, then we will need to continue investigating what happened and collecting additional information.

robertkirkman avatar Nov 17 '25 14:11 robertkirkman

ffmpeg7 will not provide $PREFIX/bin/ffmpeg. It will provide $PREFIX/bin/ffmpeg7.

licy183 avatar Nov 17 '25 14:11 licy183

ffmpeg7 will not provide $PREFIX/bin/ffmpeg. It will provide $PREFIX/bin/ffmpeg7.

Correct, it is good to mention that inconsistency as well - ffmpeg7 is mentioned in the report, but ffmpeg is invoked in the report, which does not match up either.

robertkirkman avatar Nov 17 '25 14:11 robertkirkman

@robertkirkman, you never fail to amaze me! Your in-depth analysis of the issues is incredible. Thanks for your time!

MohammadKHC avatar Nov 18 '25 17:11 MohammadKHC