Skip to content

Conversation

@TomJo2000
Copy link
Member

@TomJo2000 TomJo2000 commented Apr 8, 2025

Currently fails with:

FAILED: apt-pkg/CMakeFiles/apt-pkg.dir/edsp.cc.o 
/home/builder/.termux-build/_cache/android-r27c-api-24-v1/bin/clang++ --target=aarch64-none-linux-android --gcc-toolchain=/home/builder/.termux-build/_cache/android-r27c-api-24-v1 --sysroot=/home/builder/.termux-build/_cache/android-r27c-api-24-v1/sysroot -D_WITH_GETLINE=1 -Dapt_pkg_EXPORTS -I/home/builder/.termux-build/apt/build/include -I/home/builder/.termux-build/apt/build/include/apt-pkg -fstack-protector-strong -Oz -Wno-c++11-narrowing --target=aarch64-linux-android24  -isystem/data/data/com.termux/files/usr/include/c++/v1 -isystem/data/data/com.termux/files/usr/include -O3 -DNDEBUG -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wcast-align -Wredundant-decls -Wmissing-declarations -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wmissing-include-dirs -Wsign-promo -Wundef -Wdouble-promotion -Wsuggest-override -Werror=suggest-override -Werror=return-type -Wp,-D_GLIBCXX_ASSERTIONS -MD -MT apt-pkg/CMakeFiles/apt-pkg.dir/edsp.cc.o -MF apt-pkg/CMakeFiles/apt-pkg.dir/edsp.cc.o.d -o apt-pkg/CMakeFiles/apt-pkg.dir/edsp.cc.o -c /home/builder/.termux-build/apt/src/apt-pkg/edsp.cc
In file included from /home/builder/.termux-build/apt/src/apt-pkg/edsp.cc:10:
In file included from /home/builder/.termux-build/apt/build/include/apt-pkg/algorithms.h:32:
In file included from /home/builder/.termux-build/apt/build/include/apt-pkg/cachefilter.h:9:
/home/builder/.termux-build/apt/build/include/apt-pkg/pkgcache.h:638:39: warning: unknown attribute 'unavailable' ignored [-Wunknown-attributes]
  638 |    map_pointer<Version> VersionList [[gnu::unavailable("not yet available")]];
      |                                       ^~~~~~~~~~~~~~~~
/home/builder/.termux-build/apt/build/include/apt-pkg/pkgcache.h:639:51: warning: unknown attribute 'unavailable' ignored [-Wunknown-attributes]
  639 |    map_pointer<SourceVersion> NextSourceVersion [[gnu::unavailable("not yet available")]];
      |                                                   ^~~~~~~~~~~~~~~~

@TomJo2000 TomJo2000 requested a review from Grimler91 as a code owner April 8, 2025 23:31
@TomJo2000
Copy link
Member Author

TomJo2000 commented Apr 8, 2025

That part of apt-pkg/pkgcache.h does seem to have changed between 2.8.1 (which we ship now) and 3.0.0, here's the hunk:

@@ -611,8 +619,27 @@ struct pkgCache::DescFile
    map_pointer<DescFile> NextFile;
    /** \brief position in the file */
    map_filesize_t Offset;         // File offset
-   /** @TODO document pkgCache::DescFile::Size */
-   map_filesize_t Size;
+};
+									/*}}}*/
+// SourceVersion structure					 	/*{{{*/
+/** \brief information for a single version of a source package
+
+    The version list is always sorted from highest version to lowest
+    version by the generator. Equal version numbers are either merged
+    or handled as separate versions based on the Hash value. */
+struct pkgCache::SourceVersion
+{
+   /** \brief unique sequel ID */
+   map_id_t ID;
+   /** \brief Group the source package belongs too */
+   map_pointer<pkgCache::Group> Group;
+   /** \brief complete version string */
+   map_stringitem_t VerStr;
+   map_pointer<Version> VersionList [[gnu::unavailable("not yet available")]];
+   map_pointer<SourceVersion> NextSourceVersion [[gnu::unavailable("not yet available")]];
+
+   /** \brief Private pointer */
+   map_pointer<void> d;
https://salsa.debian.org/apt-team/apt/-/blob/3.0.0/apt-pkg/pkgcache.h?ref_type=tags#L638

@TomJo2000 TomJo2000 marked this pull request as draft April 8, 2025 23:42
@TomJo2000
Copy link
Member Author

Thanks for the help @licy183, I just saw this now.

@TomJo2000
Copy link
Member Author

TomJo2000 commented Apr 12, 2025

I'm doing on-device testing with the DEBs from this PR now.

I have already encountered one issue.

Warning: Could not execute pager - PagerSetup (2: No such file or directory)

Edit: Okay this is "newly" introduced in 2.9.181, and defaults to pager, which we don't ship.
Should be as simple as passing a build option.
Making it default to less seems sensible.

Footnotes

  1. https://salsa.debian.org/apt-team/apt/-/blob/3.0.0/debian/changelog?ref_type=tags#L392-404

@TomJo2000
Copy link
Member Author

TomJo2000 commented Apr 23, 2025

Okay, that fixed apt-file but now I'm getting the following two things.

~$ pkg up                                                                                                                                                          
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main: ok
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable
Error: Method https has died unexpectedly!
Error: Sub-process https returned an error code (1)
Error: Method /data/data/com.termux/files/usr/lib/apt/methods/https did not start correctly
Error: Method https has died unexpectedly!
Error: Sub-process https returned an error code (1)
Error: Method /data/data/com.termux/files/usr/lib/apt/methods/https did not start correctly
Error: Method https has died unexpectedly!
Error: Sub-process https returned an error code (1)
Error: Method /data/data/com.termux/files/usr/lib/apt/methods/https did not start correctly
Error: Method https has died unexpectedly!
Error: Sub-process https returned an error code (1)
Error: Method /data/data/com.termux/files/usr/lib/apt/methods/https did not start correctly
Error: Failed to fetch https://packages-cf.termux.dev/apt/termux-main/dists/stable/InRelease  
Error: Failed to fetch https://packages-cf.termux.dev/apt/termux-root/dists/root/InRelease  
Error: Failed to fetch https://tur.kcubeterm.com/dists/tur-packages/InRelease  
Error: Failed to fetch https://packages-cf.termux.dev/apt/termux-x11/dists/x11/InRelease  
Error: Some index files failed to download. They have been ignored, or old ones used instead.
Notice: Some sources can be modernized. Run 'apt modernize-sources' to do so.

Edit: looks like a missing dependency.

~$ apt modernize-sources 
The following files need modernizing:
  - /data/data/com.termux/files/usr/etc/apt/sources.list
  - /data/data/com.termux/files/usr/etc/apt/sources.list.d/root.list
  - /data/data/com.termux/files/usr/etc/apt/sources.list.d/tur.list
  - /data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list

Modernizing will replace .list files with the new .sources format,
add Signed-By values where they can be determined automatically,
and save the old files into .list.bak files.

This command supports the 'signed-by' and 'trusted' options. If you
have specified other options inside [] brackets, please transfer them
manually to the output files; see sources.list(5) for a mapping.

For a simulation, respond N in the following prompt.
Rewrite 4 sources? [Y/n] N
Simulating only...
Modernizing /data/data/com.termux/files/usr/etc/apt/sources.list...

# Would write to: /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources
# Modernized from /data/data/com.termux/files/usr/etc/apt/sources.list
Types: deb
URIs: https://packages-cf.termux.dev/apt/termux-main/
Suites: stable
Components: main 
Signed-By: 
Warning: Could not determine Signed-By for URIs: https://packages-cf.termux.dev/apt/termux-main/, Suites: stable

Modernizing /data/data/com.termux/files/usr/etc/apt/sources.list.d/root.list...

# Would write to: /data/data/com.termux/files/usr/etc/apt/sources.list.d/root.sources
Types: deb
URIs: https://packages-cf.termux.dev/apt/termux-root/
Suites: root
Components: stable 
Signed-By: 
Warning: Could not determine Signed-By for URIs: https://packages-cf.termux.dev/apt/termux-root/, Suites: root

Modernizing /data/data/com.termux/files/usr/etc/apt/sources.list.d/tur.list...

# Would write to: /data/data/com.termux/files/usr/etc/apt/sources.list.d/tur.sources
Types: deb
URIs: https://tur.kcubeterm.com/
Suites: tur-packages
Components: tur  tur-on-device tur-continuous
Signed-By: /data/data/com.termux/files/usr/etc/apt/trusted.gpg.d/tur.gpg

Modernizing /data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list...

# Would write to: /data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.sources
Types: deb
URIs: https://packages-cf.termux.dev/apt/termux-x11/
Suites: x11
Components: main 
Signed-By: 
Warning: Could not determine Signed-By for URIs: https://packages-cf.termux.dev/apt/termux-x11/, Suites: x11

Edit: gonna have to look into that, we'll probably wanna migrate the repo files.

@Biswa96
Copy link
Member

Biswa96 commented Apr 23, 2025

CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable

Probably, seccomp need to be removed from cmake https://salsa.debian.org/apt-team/apt/-/blob/3.0.0/CMakeLists.txt?ref_type=tags#L137

@TomJo2000
Copy link
Member Author

TomJo2000 commented Apr 23, 2025

CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libseccomp.so" not found: needed by main executable

Probably, seccomp need to be removed from cmake https://salsa.debian.org/apt-team/apt/-/blob/3.0.0/CMakeLists.txt?ref_type=tags#L137

It was missing as a dependency.
Works after I manually installed it.

@Biswa96
Copy link
Member

Biswa96 commented Apr 23, 2025

It was missing as a dependency.

libseccomp is still downloaded in CI and cmake picks it up.

@TomJo2000
Copy link
Member Author

TomJo2000 commented Apr 23, 2025

It was missing as a dependency.

libseccomp is still downloaded in CI and cmake picks it up.

Yes. I force pushed the branch to fix that.
https://github.com/termux/termux-packages/compare/52fdcd8e0051a4dc1272a58828fb8c89116bc542..8bd692dd9f45492681947d39f4938553113fab7a

@TomJo2000
Copy link
Member Author

I'm having some trouble wrapping my head around the new deb822 format for package sources (e.g. repos).
https://repolib.readthedocs.io/en/latest/deb822-format.html#deb822-style-format

If I run apt modernize-sources it converts all the $repo.list files into $repo.sources files
But there is still a $TERMUX__PREFIX/etc/apt/sources.list file (and it places a termux-main-stable.sources into sources.list.d).

# ~$ tree $TERMUX__PREFIX/etc/apt
/data/data/com.termux/files/usr/etc/apt
├── apt.conf.d
│   └── 50apt-file.conf
├── preferences.d
├── sources.list
├── sources.list.bak
├── sources.list.d
│   ├── root.list.bak
│   ├── root.sources
│   ├── termux-main-stable.sources
│   ├── tur.list.bak
│   ├── tur.sources
│   ├── x11.list.bak
│   └── x11.sources
├── sources.list.dpkg-old
├── trusted.gpg
└── trusted.gpg.d
    ├── 2096779623.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/2096779623.gpg
    ├── agnostic-apollo.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/agnostic-apollo.gpg
    ├── grimler.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/grimler.gpg
    ├── kcubeterm.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/kcubeterm.gpg
    ├── landfillbaby.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/landfillbaby.gpg
    ├── mradityaalok.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/mradityaalok.gpg
    ├── termux-autobuilds.gpg -> /data/data/com.termux/files/usr/share/termux-keyring/termux-autobuilds.gpg
    └── tur.gpg

5 directories, 20 files

And it's complaining about duplicates and missing Signed-By entries.

Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main: ok
Hit:1 https://turdl.kcubeterm.com tur-packages InRelease                     
Hit:2 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Hit:3 https://packages-cf.termux.dev/apt/termux-root root InRelease
Hit:4 https://packages-cf.termux.dev/apt/termux-x11 x11 InRelease
All packages are up to date.    
Warning: Target Packages (main/binary-aarch64/Packages) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Packages (main/binary-all/Packages) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Contents-deb (main/Contents-aarch64) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Contents-deb (main/Contents-all) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Packages (main/binary-aarch64/Packages) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Packages (main/binary-all/Packages) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Contents-deb (main/Contents-aarch64) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Warning: Target Contents-deb (main/Contents-all) is configured multiple times in /data/data/com.termux/files/usr/etc/apt/sources.list:1 and /data/data/com.termux/files/usr/etc/apt/sources.list.d/termux-main-stable.sources:1
Notice: Missing Signed-By in the sources.list(5) entry for 'https://packages-cf.termux.dev/apt/termux-main'
Notice: Missing Signed-By in the sources.list(5) entry for 'https://packages-cf.termux.dev/apt/termux-root'
Notice: Missing Signed-By in the sources.list(5) entry for 'https://packages-cf.termux.dev/apt/termux-x11'
Summary:                        
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0

@TomJo2000
Copy link
Member Author

We'll probably need to change the apt sources handling in:

I'll prep a PR for termux-tools.

@TomJo2000
Copy link
Member Author

That's the repos moved over to deb822.

@TomJo2000
Copy link
Member Author

Also updated dpkg as part of this PR now.

@TomJo2000
Copy link
Member Author

dpkg and libapt-pkg-perl are now being built from tarballs provided from Debian's upstream GitLab instance.
This should help avoid build failures due to versions having been removed from http://ftp.debian.org/debian/pool/main/

@TomJo2000 TomJo2000 added the help wanted Help is wanted in order to solve the issue label May 4, 2025
@robertkirkman robertkirkman linked an issue Dec 7, 2025 that may be closed by this pull request
@robertkirkman robertkirkman linked an issue Dec 14, 2025 that may be closed by this pull request
fornwall added a commit to termux-play-store/termux-packages that referenced this pull request Jan 3, 2026
See termux#24212

Fixes x86-64 issues
fornwall added a commit that referenced this pull request Feb 10, 2026
Historically there was a license incompatibility problem, but that was
fixed by the openssl 3.0 relicensing:

- FFmpeg/FFmpeg@1d23e12

The apt package has also switched from gnutls to openssl:

- https://salsa.debian.org/apt-team/apt/-/merge_requests/412
  - Coming in #24212

So it probably makes sense to align on openssl as much as possible, to
decrease duplication and behaviour spread.
fornwall added a commit that referenced this pull request Feb 10, 2026
Historically there was a license incompatibility problem, but that was
fixed by the openssl 3.0 relicensing:

- FFmpeg/FFmpeg@1d23e12

The apt package has also switched from gnutls to openssl:

- https://salsa.debian.org/apt-team/apt/-/merge_requests/412
  - Coming in #24212

So it probably makes sense to align on openssl as much as possible, to
decrease duplication and behaviour spread.
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this pull request Feb 10, 2026
Historically there was a license incompatibility problem, but that was
fixed by the openssl 3.0 relicensing:

- FFmpeg/FFmpeg@1d23e12

The apt package has also switched from gnutls to openssl:

- https://salsa.debian.org/apt-team/apt/-/merge_requests/412
  - Coming in termux/termux-packages#24212

So it probably makes sense to align on openssl as much as possible, to
decrease duplication and behaviour spread.
@TomJo2000
Copy link
Member Author

1 eternity later (or about 3 months standard earth time) I finally have the time and energy to get back to the Apt 3 bump.

Not a great sign that I had to regenerate most the dpkg patches and a couple apt ones.
But, one of the previous apt patches is no longer needed.
So I'll call that a win.

This PR is now up to date with cc5c3c1,
which among other improvements from the last 3 months gives us access to termux_download_ubuntu_packages.

I tried applying the method used by lux-cli to sequoia-sq, but was unsuccessful.

termux_download_ubuntu_packages "${ubuntu_packages[@]}"
PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages/usr/lib/x86_64-linux-gnu/pkgconfig"
RUSTFLAGS="-L${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages/usr/lib/x86_64-linux-gnu"
export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu RUSTFLAGS

If we can convert it to termux_download_ubuntu_packages though we can drop nettle-dev from scripts/setup-ubuntu.sh.
Which I believe would be preferable.
Maybe @robertkirkman has some idea what I missed, I reverted out my experimentation with it for now to focus on regenerating patches for the newest apt and dpkg versions.

@robertkirkman
Copy link
Member

@TomJo2000 Sorry for delay, I was doing a lot of things. Here are sequoia-sqv, sequoia-sq converted to termux_download_ubuntu_packages for you:

sequoia-sq

TERMUX_PKG_HOSTBUILD=true

termux_step_host_build() {
	termux_download_ubuntu_packages nettle-dev
	find "${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages" -type f -name '*.pc' | \
		xargs -n 1 sed -i -e "s|/usr|${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages/usr|g"
}

termux_step_pre_configure() {
	termux_setup_rust
	termux_setup_capnp

	# The `openssl-sys` crate fails to compile if we don't set this.
	HOST_TRIPLET="$(gcc -dumpmachine)"
	PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="$(grep 'DefaultSearchPaths:' "/usr/share/pkgconfig/personality.d/${HOST_TRIPLET}.personality" | cut -d ' ' -f 2)"
	export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu # Declare and export separately, see http://shellcheck.net/wiki/SC2155

	# The `nettle-sys` crate fails to compile if we don't set this.
	export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="$TERMUX_PKG_HOSTBUILD_DIR/ubuntu_packages/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH_x86_64_unknown_linux_gnu"

	# error: function-like macro '__GLIBC_USE' is not defined
	export BINDGEN_EXTRA_CLANG_ARGS_${CARGO_TARGET_NAME//-/_}="--sysroot ${TERMUX_STANDALONE_TOOLCHAIN}/sysroot --target=${CARGO_TARGET_NAME}"

	# clashes with rust host build
	unset CFLAGS

... rest of code in build.sh the same.

sequoia-sqv

TERMUX_PKG_HOSTBUILD=true

termux_step_host_build() {
	termux_download_ubuntu_packages nettle-dev
	find "${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages" -type f -name '*.pc' | \
		xargs -n 1 sed -i -e "s|/usr|${TERMUX_PKG_HOSTBUILD_DIR}/ubuntu_packages/usr|g"
}

termux_step_pre_configure() {
	termux_setup_rust

	# The `nettle-sys` crate fails to compile if we don't set this.
	export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="$TERMUX_PKG_HOSTBUILD_DIR/ubuntu_packages/usr/lib/x86_64-linux-gnu/pkgconfig"

	# error: function-like macro '__GLIBC_USE' is not defined
	export BINDGEN_EXTRA_CLANG_ARGS_${CARGO_TARGET_NAME//-/_}="--sysroot ${TERMUX_STANDALONE_TOOLCHAIN}/sysroot --target=${CARGO_TARGET_NAME}"

	# clashes with rust host build
	unset CFLAGS

... rest of code in build.sh the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Help is wanted in order to solve the issue tracker

Projects

None yet

9 participants