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

ffmpeg: fix cross compilation #76915

merged 1 commit into from Jan 4, 2020

Conversation

@danielfullmer
Copy link
Contributor

@danielfullmer danielfullmer commented Jan 4, 2020

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 jtojnar commented Jan 4, 2020

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

@danielfullmer
Copy link
Contributor Author

@danielfullmer danielfullmer commented Jan 4, 2020

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

@Mic92
Copy link
Contributor

@Mic92 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 danielfullmer force-pushed the danielfullmer:ffmpeg-cross branch 2 times, most recently from 9a10fdf to 26400c5 Jan 4, 2020
@danielfullmer
Copy link
Contributor Author

@danielfullmer danielfullmer commented Jan 4, 2020

@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.

@danielfullmer danielfullmer force-pushed the danielfullmer:ffmpeg-cross branch from 26400c5 to f6f8f0b Jan 4, 2020
@Mic92
Copy link
Contributor

@Mic92 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
15 checks passed
15 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
ffmpeg on aarch64-linux Success
Details
ffmpeg on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@Mic92
Copy link
Contributor

@Mic92 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

@nixos-discourse nixos-discourse commented Jan 24, 2020

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)

This comment has been minimized.

@Ericson2314

Ericson2314 Jan 28, 2020
Member

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
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.