Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Building package glib fails #20070

Open
gouravkhunger opened this issue May 9, 2024 · 3 comments
Open

[Bug]: Building package glib fails #20070

gouravkhunger opened this issue May 9, 2024 · 3 comments
Labels
bug report Something is not working properly. packaging Issue related to building packages, not affecting end users directly.

Comments

@gouravkhunger
Copy link
Contributor

gouravkhunger commented May 9, 2024

Problem description

The build for package glib fails with the error:

...
Installing /home/builder/.termux-build/glib/src/m4macros/gsettings.m4 to /data/data/com.termux/files/usr/opt/glib/cross/share/aclocal
Applying patch: gio-gdbusprivate.c.patch
Applying patch: gio-gkeyfilesettingsbackend.c.patch
Applying patch: gio-gnetworking.h.in.patch
Applying patch: gio-gunixmounts.c.patch
Applying patch: gio-xdgmime-xdgmime.c.patch
Applying patch: glib-gcharset.c.patch
Applying patch: glib-gspawn.c.patch
Applying patch: glib-gthread-posix.c.patch
Applying patch: glib-gthreadprivate.h.patch
Applying patch: glib-gtimezone.patch
Applying patch: glib-gtypes.h.patch
Applying patch: glib-gutils.c.patch
Applying patch: glib-tests-meson.build.patch
Applying patch: meson.build.patch
sed: can't read /data/data/com.termux/files/usr/lib/pkgconfig/gobject-introspection-1.0.pc: No such file or directory
Error: Process completed with exit code 2.

This seems to be introduced since 4ccbae1 in line:

# Workaround: Remove cyclic dependency between gir and glib
sed -i "/Requires:/d" "${TERMUX_PREFIX}/lib/pkgconfig/gobject-introspection-1.0.pc"

On inspection, I found that the build system didn't download gobject-introspection for building even if it is defined in the TERMUX_PKG_BUILD_DEPENDS for glib:

TERMUX_PKG_BUILD_DEPENDS="gobject-introspection"

Thus the file is missing.

What steps will reproduce the bug?

Build the package glib on master with command:

./scripts/run-docker.sh ./clean.sh
./scripts/run-docker.sh ./build-package.sh glib

Because gobject-introspection was not downloaded, I tried building it right before glib. But that resulted in an infinite pause:

./scripts/run-docker.sh ./build-package.sh gobject-introspection glib

But well, gobject-introspection depends on glib so maybe that caused the loop:

TERMUX_PKG_DEPENDS="glib, libffi"

What is the expected behavior?

I am unable to replicate the successful builds as in termux workflow builds.

System information

N/A

@gouravkhunger gouravkhunger added bug report Something is not working properly. untriaged labels May 9, 2024
@Biswa96
Copy link
Contributor

Biswa96 commented May 9, 2024

You have to follow some steps to bootstrap glib and gojbect-introspection (GI). See https://gitlab.gnome.org/GNOME/glib/-/blob/2.80.0/docs/reference/glib/building.md?ref_type=tags

  1. Build glib using -Dintrospection=disabled option.
  2. Build GI using glib from step1.
  3. Build glib with -Dintrospection=enabled using GI from step2.

I can try to add a bootstrap flag in glib or GI build script but I do not know how to check if glib is being bootstrapped. Otherwise, user has to pass the bootstrap flag manually.

@truboxl truboxl added packaging Issue related to building packages, not affecting end users directly. and removed untriaged labels May 10, 2024
@gouravkhunger
Copy link
Contributor Author

@Biswa96 I understand, thank you! I get how termux uses the already built gobject-introspection package from past builds and thus the workflow succeeds.

But it would be really helpful to have these steps automated for cases where dependencies need rebuilding too. How about using TERMUX_FORCE_BUILD_DEPENDENCIES to use the option -Dintrospection=disabled first, and somehow run the logic for step 2. and 3. as you mentioned, right after the build is done.

I have started at PR that achieves the former in #20081. This makes the build pass. But to rebuild glib with -Dintrospection=enabled, I'll need some insight on how to dynamically add more packages to be built with specific parameters after the current one succeeds.

Maybe something could be added in the termux_step_post_make_install or termux_step_post_massage functions.

@Biswa96
Copy link
Contributor

Biswa96 commented May 10, 2024

I am not sure if TERMUX_FORCE_BUILD_DEPENDENCIES variable should be used. It is not documented and not used in any other build script. That variable is true when -F option is passed to build-package.sh. I would follow simple steps from Alpine Linux to replace the cyclic dependency https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/glib/APKBUILD (if feasible). Those steps would increase build time significantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something is not working properly. packaging Issue related to building packages, not affecting end users directly.
Projects
None yet
Development

No branches or pull requests

3 participants