Skip to content

XML::SAX: fix cross-compilation#419834

Merged
uninsane merged 1 commit intoNixOS:stagingfrom
synalice-forks:xmlsax-fix-cross-comp
Jun 29, 2025
Merged

XML::SAX: fix cross-compilation#419834
uninsane merged 1 commit intoNixOS:stagingfrom
synalice-forks:xmlsax-fix-cross-comp

Conversation

@synalice
Copy link
Contributor

Closes #419409.

perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"

This line is already being executed in upstream Makefile.PL, but it directly calls a Perl binary and thus has to be substituted with a cross version.

Moreover, we now have to use the emulator, but maybe this can be done more efficiently without it?

Tested:

nix-build -A perl540Packages.XMLSAX
nix-build -A perl540Packages.XMLSAX --arg crossSystem '{ config = "aarch64-unknown-linux-gnu"; }'
nix-build -A perl540Packages.XMLSAX --arg crossSystem '{ config = "riscv64-linux"; }'

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jun 25, 2025
@nix-owners nix-owners bot requested review from marcusramberg, stigtsp and zakame June 25, 2025 10:29
@nixpkgs-ci nixpkgs-ci bot added 2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jun 25, 2025
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 25, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--replace-fail "\$(PERL)" "${lib.getExe buildPackages.perl}" avoids the emulator and also fixes the build for me. Does it fully work for your use case (e.g. at runtime)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it fully work for your use case (e.g. at runtime)?

Unfortunately I don't know how to use or test it. I actually have zero experience with Perl. The only reason I am fixing cross-compilation here is because I am trying to cross-compile LibreOffice and it depends on XML::SAX.

Copy link
Contributor

@uninsane uninsane Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

building the package as you have here, and the version SFrijters suggests, they look to be pretty much identical. you can use diff -Naur /nix/store/$hash1-perl5.40.0-XML-SAX-1.02-aarch64-unknown-linux-gnu /nix/store/$hash2-perl5.40.0-XML-SAX-1.02-aarch64-unknown-linux-gnu to get a sense of how minor or major the differences are.

I'd suggest applying SFrijters' change, but either should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@SFrijters
Copy link
Member

Also, you probably need to retarget to staging, going by the large number of rebuilds.

@synalice synalice changed the base branch from master to staging June 25, 2025 12:06
@nixpkgs-ci nixpkgs-ci bot closed this Jun 25, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Jun 25, 2025
Copy link
Contributor

@uninsane uninsane Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

building the package as you have here, and the version SFrijters suggests, they look to be pretty much identical. you can use diff -Naur /nix/store/$hash1-perl5.40.0-XML-SAX-1.02-aarch64-unknown-linux-gnu /nix/store/$hash2-perl5.40.0-XML-SAX-1.02-aarch64-unknown-linux-gnu to get a sense of how minor or major the differences are.

I'd suggest applying SFrijters' change, but either should work.

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 27, 2025
@synalice
Copy link
Contributor Author

I'd suggest applying SFrijters' change, but either should work.

Sure! I'll apply the suggestions as soon as I have some time to do that.

@synalice synalice force-pushed the xmlsax-fix-cross-comp branch from bf807dd to fd6db38 Compare June 28, 2025 12:05
@synalice
Copy link
Contributor Author

synalice commented Jun 28, 2025

Oh no... I forgot I was targeting staging instead of master. Sorry.

@nix-owners
Copy link

nix-owners bot commented Jun 28, 2025

The PR's base branch is set to staging, but 55 commits from the master branch are included. Make sure you know the right base branch for your changes, then:

  • If the changes should go to the master branch, change the base branch to master
  • If the changes should go to the staging branch, rebase your PR onto the merge base with the staging branch:
    # git rebase --onto $(git merge-base upstream/staging HEAD) $(git merge-base upstream/master HEAD)
    git rebase --onto d0aef5b0a2049479dc5fd4a1a0334ee6a2a1e9b9 b4c72fac350626b4d9b237df57f05f3a4768b269
    git push --force-with-lease

```
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"
```

This line is already being executed in Makefile.PL, but it directly
calls Perl binary [1] and thus has to be substituted with a cross
version. Moreover, we now have to use the emulator.

[1] https://metacpan.org/release/GRANTM/XML-SAX-1.02/source/Makefile.PL#L56
@synalice synalice force-pushed the xmlsax-fix-cross-comp branch from fd6db38 to e850369 Compare June 28, 2025 12:08
@uninsane uninsane merged commit c1f7c95 into NixOS:staging Jun 29, 2025
26 of 27 checks passed
@synalice synalice deleted the xmlsax-fix-cross-comp branch July 23, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: perl540Packages.XMLSAX (cross-compilation)

3 participants