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

harfbuzz: fix cross compilation #112695

Closed
wants to merge 1 commit into from

Conversation

kira-bruneau
Copy link
Contributor

@kira-bruneau kira-bruneau commented Feb 10, 2021

Motivation for this change

This change indirectly fixes cross compilation for Emacs

Fixes build errors:

  • src/meson.build:639:4: ERROR: Problem encountered: Introspection support is requested but it isn't available in cross builds
  • Program glib-mkenums mkenums found: NO
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS (for armv7l-linux)
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@edolstra

@jtojnar
Copy link
Member

jtojnar commented Feb 11, 2021

Looks like it actually fails on CI due to missing gobject-introspection.

Also I merged #111259, which fixes the introspection error. Though it probably still will not work without #88222.

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Feb 11, 2021

Oh oops, I only tried a cross build but didn't test the native build. gobject-introspection is also needed in buildInputs now that strictDeps is enabled.

Tomorrow I'll try to see if it can build with gobject-introspection using the latest version. Thanks! 😄

@kira-bruneau
Copy link
Contributor Author

Yeah, it won't work without #88222. I'll just close this for now then.

@jtojnar
Copy link
Member

jtojnar commented Feb 11, 2021

Would building without gi, on cross and adding it to buildInputs work? Or not using strictDeps for now?

This change indirectly fixes cross compilation for Emacs

Fixes build errors:
- src/meson.build:639:4: ERROR: Problem encountered: Introspection support is requested but it isn't available in cross builds
- Program glib-mkenums mkenums found: NO
@kira-bruneau
Copy link
Contributor Author

Would building without gi, on cross and adding it to buildInputs work?

Yep, it works. I closed this because I was kind of reluctant to keep inputs conditional on cross compilation after you mentioned that they removed the error for cross builds, but I can re-open this and submit the fix.

Then hopefully after #88222 is complete we can remove the isCross conditional.

@Mindavi
Copy link
Contributor

Mindavi commented Mar 16, 2021

On staging bed8668

Your branch is up to date with 'upstream/staging' (bed86681367c1f57324249db181d142e2efc1f0b).
rick@nixos-asus:~/nixpkgs$ nix build .#pkgsCross.aarch64-multiplatform.harfbuzz
error: builder for '/nix/store/9svk1903cj7llwhzm0jwlxcfq7rkiirk-gtk-doc-1.33.2-aarch64-unknown-linux-gnu.drv' failed with exit code 2;
       last 10 log lines:
       >     p, stdout, stderr = mesonlib.Popen_safe(cmd)
       >   File "/nix/store/pb8yg45560clhm1xqgvrsivfax1p70mq-meson-0.57.1/lib/python3.8/site-packages/mesonbuild/mesonlib/universal.py", line 1320, in Popen_safe
       >     p = subprocess.Popen(args, universal_newlines=True, close_fds=False,
       >   File "/nix/store/sjifaa6ykigz6jxdmgvdnyp36yq7zkbr-python3-3.8.8/lib/python3.8/subprocess.py", line 858, in __init__
       >     self._execute_child(args, executable, preexec_fn, close_fds,
       >   File "/nix/store/sjifaa6ykigz6jxdmgvdnyp36yq7zkbr-python3-3.8.8/lib/python3.8/subprocess.py", line 1596, in _execute_child
       >     self._posix_spawn(args, executable, env, restore_signals,
       >   File "/nix/store/sjifaa6ykigz6jxdmgvdnyp36yq7zkbr-python3-3.8.8/lib/python3.8/subprocess.py", line 1547, in _posix_spawn
       >     self.pid = os.posix_spawn(executable, args, env, **kwargs)
       > OSError: [Errno 8] Exec format error: '/nix/store/h0ic6bhzhnd0ngcskz7739fkh3p392a5-python3-3.8.8-aarch64-unknown-linux-gnu/bin/python3'
       For full logs, run 'nix log /nix/store/9svk1903cj7llwhzm0jwlxcfq7rkiirk-gtk-doc-1.33.2-aarch64-unknown-linux-gnu.drv'.
error: 1 dependencies of derivation '/nix/store/hh2pfkdvfcy7sjj45kxx24j0r46jmmry-glib-2.66.4-aarch64-unknown-linux-gnu.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pyf3dlwz7lv57af158aw5dgbxzya0czb-harfbuzz-2.7.4-aarch64-unknown-linux-gnu.drv' failed to build

Something broken in gtk-doc on staging, I think @SuperSandro2000 saw the same on a PR I made. Or maybe meson itself broken?

I pulled this in for my own tree, and there it builds (possibly something newer on staging broke it). Or my own patches to asciidoc make the difference, that's also possible. So this patch probably works as intended.

This is the patch for asciidoc, maybe it helps? Probably unrelated though.
diff --git a/pkgs/tools/typesetting/asciidoc/default.nix b/pkgs/tools/typesetting/asciidoc/default.nix
index 849da7e606c..95e9f0c7280 100644
--- a/pkgs/tools/typesetting/asciidoc/default.nix
+++ b/pkgs/tools/typesetting/asciidoc/default.nix
@@ -21,6 +21,7 @@
 #, epubcheck ? null
 , gnused ? null
 , coreutils ? null
+, buildPackages
 
 # if true, enable all the below filters and backends
 , enableExtraPlugins ? false
@@ -257,8 +258,8 @@ stdenv.mkDerivation rec {
         -i a2x.py
   '' else ''
     sed -e "s|^ENV =.*|ENV = dict(XML_CATALOG_FILES='${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml ${docbook_xsl_ns}/xml/xsl/docbook/catalog.xml ${docbook_xsl}/xml/xsl/docbook/catalog.xml')|" \
-        -e "s|^XSLTPROC =.*|XSLTPROC = '${libxslt.bin}/bin/xsltproc'|" \
-        -e "s|^XMLLINT =.*|XMLLINT = '${libxml2.bin}/bin/xmllint'|" \
+        -e "s|^XSLTPROC =.*|XSLTPROC = '${buildPackages.libxslt.bin}/bin/xsltproc'|" \
+        -e "s|^XMLLINT =.*|XMLLINT = '${buildPackages.libxml2.bin}/bin/xmllint'|" \
         -i a2x.py
   '') + ''
     patchShebangs .

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Mar 19, 2021

Something broken in gtk-doc on staging

It executes the python for the target platform on the build platform.

Or my own patches to asciidoc make the difference, that's also possible.

That shouldn't make any difference because the error is in gtk-doc.

I think we need to tell gtk-doc to use the python of the build platform with some flag but I am unsure how and which. @jtojnar can you help?

@austinbutler austinbutler mentioned this pull request May 29, 2021
9 tasks
@sternenseemann
Copy link
Member

Done in #123712.

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

Successfully merging this pull request may close these issues.

5 participants