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

ffmpeg: fix cross compilation #76915

Merged
merged 1 commit into from Jan 4, 2020
Merged

Conversation

danielfullmer
Copy link
Contributor

Motivation for this change

Fix for cross compilation.

Built on x86_64 and tested on raspberry pi 1 with pkgsCross.raspberryPi.ffmpeg.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • 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.
Notify maintainers

cc @codyopel

@jtojnar
Copy link
Contributor

jtojnar commented Jan 4, 2020

Would autoreconfHook work or some other way to regenerate configure work?

@danielfullmer
Copy link
Contributor Author

@jtojnar Their configure script is a custom bash script. It's not auto-generated as far as I can tell.

@Mic92
Copy link
Member

Mic92 commented Jan 4, 2020

@jtojnar Their configure script is a custom bash script. It's not auto-generated as far as I can tell.

Can you send this patch also upstream?

@danielfullmer
Copy link
Contributor Author

@Mic92

I've replaced the patch step for ./configure with something a little nicer--just setting --pkg-config=pkg-config.

It appears at least that debian and ubuntu use these prefixed pkg-configs. Notice aarch64-unknown-linux-gnu-pkg-config in https://packages.debian.org/sid/arm64/pkg-config/filelist

It's unclear to me what the "right" way to do this is. Is ffmpeg in the wrong here, and if so is there some document we could point to that says so? Maybe ffmpeg could do a conditional check for the prefixed version, and then fall back to just pkg-config? In the absense of some more official standard, maybe they just assume distros would set the --pkg-config flag themselves.

@Mic92
Copy link
Member

Mic92 commented Jan 4, 2020

That workaround looks good enough for me right now.
cc @Ericson2314 for further discussions.

@Mic92 Mic92 merged commit 83be64c into NixOS:master Jan 4, 2020
@Mic92
Copy link
Member

Mic92 commented Jan 4, 2020

This should have gone to staging... I merged it by accident and than reverted it in order to cherry-pick it to staging.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/arm-cross-compiling-libopus-not-found-by-pkg-config/5621/3

@@ -163,8 +163,10 @@ stdenv.mkDerivation rec {
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile"
"--pkg-config=pkg-config" # Override ffmpeg's ./configure assumption that pkg-config is prefixed by the architecture. (e.g. aarch64-unknown-linux-gnu-pkg-config)
Copy link
Member

Choose a reason for hiding this comment

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

We should eventually prefix it, though. Fine for now.

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.

None yet

5 participants