nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

Build failure: libreoffice (cross-compilation)

Open nikableh opened this issue 1 year ago • 7 comments

Nixpkgs version

  • Unstable (25.11)

Steps to reproduce

nix-build '<nixpkgs>' -I nixpkgs=channel:nixos-unstable \
--arg crossSystem '{ config = "aarch64-unknown-linux-gnu"; }' \
-A libreoffice

Failing dependencies

  • #419102
  • #419345
  • #419355
  • #419359
  • #419409

Optional failing dependencies

  • #419917 — LibreOffice requires libcmis which in turn requires docbook2x. And docbook2x explicitly states that it does not support cross-compilation. It looks like libcmis is an optional feature which can be avoided.

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.15.1, NixOS, 25.05 (Warbler), 25.05.803579.70c74b02eac4
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.28.3
  • channels(root): "nixos-25.05, nixos-hardware"
  • nixpkgs: /nix/store/gdz4yp5sjq3b1q0g9ad9hicqsx1alvif-nixos-25.05/nixos

LibreOffice maintainer

@7c6f434c

Is this issue important to you?

Add a :+1: reaction to issues you find important.

nikableh avatar Jun 22 '25 20:06 nikableh

This is not, in fact, a Libreoffice build failure. It's one of the deps, and probably not the only one that fails.

7c6f434c avatar Jun 22 '25 21:06 7c6f434c

Btw the same error happens on channel:nixos-24.11 (and channel:nixos-25.05).

builder for '/nix/store/ffxhwspcz8qxi67dxcy3c3qh7fvdpw78-lp_solve-aarch64-unknown-linux-gnu-5.5.2.11.drv' failed with exit code 127;
...
ccc: line 12: cc: command not found

nikableh avatar Jun 22 '25 21:06 nikableh

This is not, in fact, a Libreoffice build failure. It's one of the deps, and probably not the only one that fails.

Do you have any suggestions on how to debug such errors?

I assume its the lp_solve that fails to cross-compile? Do I have to create an issue for that instead?

nikableh avatar Jun 22 '25 21:06 nikableh

Do you have any suggestions on how to debug such errors?

Use nom and/or nix-tree with --derivation to see dependency graphs when building something. Use --keep-going so all failures can happen. With that flag nix will only quit trying when the critical chain fails, not just after a single failure. In this case, the command would become nom-build '<nixpkgs>' -I nixpkgs=channel:nixos-unstable --arg crossSystem '{ config = "aarch64-unknown-linux-gnu"; }' -A libreoffice --keep-going. Do notice that this would entail cross-compiling ~400 or so packages.

Also, I don't know whether or not this is a kind of thing we as nixpkgs actually support, arbitrarily cross-compiling random big software packages...

dtomvan avatar Jun 22 '25 22:06 dtomvan

Also, I don't know whether or not this is a kind of thing we as nixpkgs actually support, arbitrarily cross-compiling random big software packages...

I think I've heard storied about some old Qt version where they didn't build parts of the SDK during cross compilation because they assumed nobody would use aarch64 cross-compiled Qt Creator for an actual development. And then Apple's M1 came out.

Besides some crazy situations like the one I just described and other critical errors like the one I have in this issue, would you agree cross-compiling arbitrary packages should most of the time be smooth? Packages from, say mkDerivation don't need any additional configuration to support cross-compilation, right?

nikableh avatar Jun 22 '25 22:06 nikableh

Packages from, say mkDerivation don't need any additional configuration to support cross-compilation

They work if they work, basically by accident. Platforms differ, supporting multiple platforms is hard, but cross-compiling is a whole different beast. It and its quirks are never really accounted for when nix packages are written.

dtomvan avatar Jun 22 '25 22:06 dtomvan

Packages from, say mkDerivation don't need any additional configuration to support cross-compilation, right?

Such packages do not constitute a meaningful category.

Whatever is done on the Nix side, it is almost always in order to run the upstream build system and to feed it the dependencies. If upstream uses a popular build system and has cross-compilation working anywhere at all, the chances are pretty good. If upstream has a build system with no idea about cross-compilation, Nix does not have enough information to make it work.

And then Apple's M1 came out.

Not the best example: just doing native builds there is not a completely absurd idea.

7c6f434c avatar Jun 22 '25 23:06 7c6f434c