Skip to content

Comments

opencv: fix cross compliation by patching protobuf#415591

Closed
phanirithvij wants to merge 2 commits intoNixOS:stagingfrom
phanirithvij:opencv-cross-protoc
Closed

opencv: fix cross compliation by patching protobuf#415591
phanirithvij wants to merge 2 commits intoNixOS:stagingfrom
phanirithvij:opencv-cross-protoc

Conversation

@phanirithvij
Copy link
Member

@phanirithvij phanirithvij commented Jun 10, 2025

  • patch protobuf_21-28 to allow using cmake specified protoc_exe
  • patch opencv dnn cmakelists.txt to pass correct protoc_exe which allows cross compilation (upstreamed patch)

#370155 introduced protobuf_29 which doesn't require the custom patch to protobuf. but it was reverted in c312f6f.

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 10, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Jun 10, 2025
@nix-owners nix-owners bot requested a review from basvandijk June 10, 2025 14:26
@SuperSandro2000
Copy link
Member

Shouldn't we patch protobuf 21 directly?

@phanirithvij
Copy link
Member Author

phanirithvij commented Jun 14, 2025

should I add this patch for all protobuf versions < 29?

I thought that will be hard to do/test so I only overrode it for opencv (which was the package I intended to fix)

EDIT: added it to all versions 21 - 28

- patch opencv dnn cmakelists.txt to pass correct protoc_exe which
allows cross compilation (upstream merged patch)

Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
@phanirithvij phanirithvij force-pushed the opencv-cross-protoc branch from 17ad805 to 8543e19 Compare June 14, 2025 17:48
@nix-owners nix-owners bot requested a review from GaetanLepage June 14, 2025 17:53
@github-actions github-actions bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. and removed 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. labels Jun 14, 2025
@SuperSandro2000
Copy link
Member

If it is a general problem, then ofc we should try to patch all effected versions if it is reasonable possibly. :)

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 26, 2025
@phanirithvij
Copy link
Member Author

#419335

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

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin 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-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants