Skip to content

xdg-desktop-portal-phosh: pkgsCross.aarch64-multiplatform.xdg-desktop-portal-phosh fails on x86_64-linux #510098

@yvesf

Description

@yvesf

Nixpkgs version

  • Stable (25.11)

Describe the bug

Cross compilation fails with: nix build .#pkgsCross.aarch64-multiplatform.xdg-desktop-portal-phosh

Steps to reproduce

nix build .#pkgsCross.aarch64-multiplatform.xdg-desktop-portal-phosh

       > subprojects/pfs/data/meson.build:41:17: ERROR: Program 'glib-compile-schemas' not found or not executable

With the workaround of adding glib to nativeBuildInputs for glib-compile-schemas it still fails as:

   Compiling xdg-desktop-portal-phosh v0.1.0 (/build/source)
error: linking with `/nix/store/kilyfvfmh9x9rlaj47ph1916lbc1pnsr-gcc-wrapper-14.3.0/bin/cc` failed: exit status: 1
  |
  = note:  "/nix/store/kilyfvfmh9x9rlaj47ph1916lbc1pnsr-gcc-wrapper-14.3.0/bin/cc" "-m64" "/build/rustci3bkRW/symbols.o" "<126 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build/source/bui>
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: skipping incompatible /nix/store/ynb4jjn454c1ylm1i09kr329ckpkhch2-libadwaita-aarch64-unknown-linux-gnu-1.8.2/lib/libadwaita-1>
          /nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find -ladwaita-1: No such file or directory
          /nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: skipping incompatible /nix/store/ynb4jjn454c1ylm1i09kr329ckpkhch2-libadwaita-aarch64-unknown-linux-gnu-1.8.2/lib/libadwaita-1>
          /nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: skipping incompatible /nix/store/lsl92sd7pxrpwimwpc4gmiqpvrx8dq8r-gtk4-aarch64-unknown-linux-gnu-4.20.3/lib/libgtk-4.so when >
          /nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find -lgtk-4: No such file or directory
...

with one more change (done analog to other rust packages such as pwvucontrol) it passes:

diff
--- a/pkgs/by-name/xd/xdg-desktop-portal-phosh/package.nix
+++ b/pkgs/by-name/xd/xdg-desktop-portal-phosh/package.nix
@@ -1,5 +1,6 @@
 {
   stdenv,
+  glib,
   lib,
   fetchFromGitLab,
   gnome-desktop,
@@ -47,6 +48,7 @@ stdenv.mkDerivation (finalAttrs: {
     pkg-config
     rustc
     desktop-file-utils
+    glib
     cargo
     rustPlatform.cargoSetupHook
     gettext
@@ -60,11 +62,23 @@ stdenv.mkDerivation (finalAttrs: {
 
   strictDeps = true;
 
+  env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
+
   prePatch = ''
     cp -r ${pfs} subprojects/pfs
     chmod +w -R subprojects/pfs # Allow patches for subprojects to work
   '';
 
+  postPatch = ''
+    substituteInPlace src/meson.build --replace-fail \
+      "meson.project_build_root() / 'src' / cargo_target / pmp_exe_name" \
+      "meson.project_build_root() / 'src' / '${stdenv.hostPlatform.rust.cargoShortTarget}' / cargo_target / pmp_exe_name"
+
+    substituteInPlace subprojects/pfs/src/meson.build --replace-fail \
+      "meson.project_build_root() / 'src' / rust_target / 'libpfs.a'" \
+      "meson.project_build_root() / 'src' / '${stdenv.hostPlatform.rust.cargoShortTarget}' / rust_target / 'libpfs.a'"
+  '';
+

Expected behaviour

Clean cross compilation

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.12.80, NixOS, 25.11 (Xantusia), 25.11.20260410.54170c5
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.31.4
  • nixpkgs: /nix/store/m5dr0w2wb9lca77ar3idab31szd6mix7-source

Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Notify maintainers

@ArmelClo

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used on
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions