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_7: fix darwin build #322724

Merged
merged 3 commits into from
Jul 22, 2024
Merged

ffmpeg_7: fix darwin build #322724

merged 3 commits into from
Jul 22, 2024

Conversation

jopejoe1
Copy link
Member

@jopejoe1 jopejoe1 commented Jun 26, 2024

Description of changes

FFmpeg 7 on x86_64-darwin currently fails to compile with AV Foundation enabled, so disabling for x86_64-darwin on ffmpeg 7 or newer.
Also, xeve and xevd fail to compile with non GCC compilers, so disabling them on non gnu cc.

A Test for ffmpef_7-full on Darwin both architectures is currently still failing.

ast 10 log lines:
       > HOSTCC tests/audiogen.o
       > HOSTCC tests/videogen.o
       > COPY   tests/data/filtergraphs/anequalizer
       > COPY   tests/data/filtergraphs/firequalizer
       > COPY   tests/data/filtergraphs/compand
       > GEN    tests/data/hls-list.m3u8
       > make: *** [tests/fate/filter-audio.mak:209: tests/data/hls-list.m3u8] Error 134
       > make: *** Waiting for unfinished jobs....
       > GEN    tests/data/hls-list-append.m3u8
       > make: *** [tests/fate/filter-audio.mak:219: tests/data/hls-list-append.m3u8] Error 134

Full build log https://hydra.nixos.org/build/263289438/nixlog/1

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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (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.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

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

Diff LGTM but I can't test this myself.

If Darwin CI is green though, that'd be good enough for me.

@@ -47,6 +47,6 @@ stdenv.mkDerivation (finalAttrs: {
pkgConfigModules = [ "xevd" ];
maintainers = with lib.maintainers; [ jopejoe1 ];
platforms = lib.platforms.all;
broken = !stdenv.hostPlatform.isx86 || stdenv.hostPlatform.isDarwin;
broken = !stdenv.hostPlatform.isx86 || !stdenv.cc.isGNU;
Copy link
Member

Choose a reason for hiding this comment

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

A comment with the error and/or an upstream reference would be great.

Copy link
Member Author

Choose a reason for hiding this comment

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

mpeg5/xeve#117

and from reading the cmake file

@@ -39,7 +39,7 @@
, withAribcaption ? withFullDeps && lib.versionAtLeast version "6.1" # ARIB STD-B24 Caption Decoder/Renderer
, withAss ? withHeadlessDeps && stdenv.hostPlatform == stdenv.buildPlatform # (Advanced) SubStation Alpha subtitle rendering
, withAudioToolbox ? withHeadlessDeps && stdenv.isDarwin # Apple AudioToolbox
, withAvFoundation ? withHeadlessDeps && stdenv.isDarwin # Apple AVFoundation framework
, withAvFoundation ? withHeadlessDeps && stdenv.isDarwin && !(lib.versionAtLeast version "7" && stdenv.hostPlatform.isx86) # Apple AVFoundation framework
Copy link
Member

Choose a reason for hiding this comment

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

Again, a comment briefly describing the current situation would be great.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

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

Built on aarch64-darwin

@Atemu
Copy link
Member

Atemu commented Jun 27, 2024

@JohnRTitor could you build on x86 via rosetta? That's what's being fixed here. aarch64-darwin was working already.

@DontEatOreo
Copy link
Member

Result of nixpkgs-review pr 322724 run on aarch64-darwin 1

@JohnRTitor
Copy link
Contributor

@DontEatOreo I assume you cross compiled it on x86-darwin?

@DontEatOreo
Copy link
Member

Result of nixpkgs-review pr 322724 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • handbrake
7 packages failed to build:
  • ffmpeg_7-full
  • ffmpeg_7-full.bin
  • ffmpeg_7-full.data
  • ffmpeg_7-full.dev
  • ffmpeg_7-full.doc
  • ffmpeg_7-full.lib
  • ffmpeg_7-full.man
14 packages built:
  • ffmpeg_7
  • ffmpeg_7-headless
  • ffmpeg_7-headless.bin
  • ffmpeg_7-headless.data
  • ffmpeg_7-headless.dev
  • ffmpeg_7-headless.doc
  • ffmpeg_7-headless.lib
  • ffmpeg_7-headless.man
  • ffmpeg_7.bin
  • ffmpeg_7.data
  • ffmpeg_7.dev
  • ffmpeg_7.doc
  • ffmpeg_7.lib
  • ffmpeg_7.man

@Atemu
Copy link
Member

Atemu commented Jun 27, 2024

Huh, full failed? Could you post the log?

@ofborg build ffmpeg_7-full

@DontEatOreo
Copy link
Member

Huh, full failed? Could you post the log?

@ofborg build ffmpeg_7-full

https://termbin.com/tk9f

@Atemu Atemu marked this pull request as draft June 27, 2024 22:00
@jopejoe1
Copy link
Member Author

The issue on ffmpeg_7-full on Darwin has something to do with ffmpeg not finding libquirc.

@Atemu
Copy link
Member

Atemu commented Jul 18, 2024

The paste link is dead.

@emilazy
Copy link
Member

emilazy commented Jul 18, 2024

If nobody figures this out before I finish dealing with FFmpeg 4, I’ll try to take a look at it then.

@jopejoe1
Copy link
Member Author

jopejoe1 commented Jul 18, 2024

Found the issue it seems libquirc was not linked correctly it was found during compile time but wen trying to run the build ffmpeg binary it failed to find it.

For now i disabled it as i do not know why it was linked incorrectly.

@jopejoe1 jopejoe1 marked this pull request as ready for review July 18, 2024 18:44
@jopejoe1 jopejoe1 requested a review from emilazy July 18, 2024 18:45
@JohnRTitor
Copy link
Contributor

@ofborg build ffmpeg_7-full

@emilazy
Copy link
Member

emilazy commented Jul 18, 2024

Building ffmpeg_7-full on native x86_64-darwin.

It seems dodgy that quirc contains a .so on a platform that uses .dylib. I don’t know if that’s the cause or not, but it looks like @toonn, who I know was working on this recently, got that fixed upstream: dlbeer/quirc#144.

Perhaps we could consider including that patch or bumping to that commit and see if it fixes the issue?

@emilazy
Copy link
Member

emilazy commented Jul 18, 2024

It does build!

@DontEatOreo
Copy link
Member

Result of nixpkgs-review pr 322724 run on aarch64-darwin 1

1 package marked as broken and skipped:
  • handbrake
7 packages built:
  • ffmpeg_7-full
  • ffmpeg_7-full.bin
  • ffmpeg_7-full.data
  • ffmpeg_7-full.dev
  • ffmpeg_7-full.doc
  • ffmpeg_7-full.lib
  • ffmpeg_7-full.man

Copy link
Member

@DontEatOreo DontEatOreo left a comment

Choose a reason for hiding this comment

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

LGTM!

@toonn
Copy link
Contributor

toonn commented Jul 19, 2024

My branch fixing ffmpeg_7-full includes avfoundation, quirc and xev{d,e} patches, PR incoming later today.

Re .so on Darwin. It's really just an aesthetic matter TBH, Darwin doesn't actually care about the extension. Though you're right that it hints at no considerations having been made for Darwin.

@toonn
Copy link
Contributor

toonn commented Jul 19, 2024

The combination of #328420, #328422, #328424 and #328428 should fix both ffmpeg_7 and ffmpeg_7-full on Darwin (and as a bonus potentially fix xev{d,e} support on aarch64-linux pending testing).

The changes are mostly simple but #328422 might hold things up a bit due to its complexity.

I don't mind fixing things up if this PR gets merged but it would be nice if #328424 is considered (would imply changes to this PR) so that we never need to disable AVFoundation support.

@emilazy
Copy link
Member

emilazy commented Jul 19, 2024

I personally prefer @toonn’s changes as they avoid regressing functionality and don’t seem too complex to me.

@JohnRTitor JohnRTitor merged commit 93e87ed into NixOS:master Jul 22, 2024
30 checks passed
@emilazy
Copy link
Member

emilazy commented Jul 22, 2024

This PR was already partially incorrect because of @toonn's merged changes :( Hopefully we can get the xev{d,e} changes in soon and revert the unnecessary AVFoundation disabling.

toonn added a commit to toonn/nixpkgs that referenced this pull request Jul 23, 2024
This was disabled in NixOS#322724 after NixOS#328424 provided a patch fixing it.
toonn added a commit to toonn/nixpkgs that referenced this pull request Jul 23, 2024
This was disabled in NixOS#322724 after NixOS#328420 fixed quirc.
@toonn toonn mentioned this pull request Jul 23, 2024
13 tasks
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.

8 participants