-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Fix Handbrake build on Darwin by turning off GUI support #63643
Conversation
VideoToolbox ? null, | ||
# GTK. This is not available on Darwin, since libappindicator-gtk3 is not | ||
# supported there. | ||
useGtk ? !stdenv.isDarwin, wrapGAppsHook ? null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation in Pull Request message is quite, sends in a different direction, that it is in the code.
Can you explain adding !stdenv.isDarwin
here.
If I understand correctly, code now says if system is Darwin - then !stdenv.isDarwin
equals false
, which disables derivation dependencies:
{
buildInputs = []
++ lib.optionals useGtk [
glib gtk3 libappindicator-gtk3 libnotify
gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus-glib udev
libgudev hicolor-icon-theme
];
}
And disables GTK:
(if useGtk then "--disable-gtk-update-checks" else "--disable-gtk")
during build.
Do you want to make Handbrake on macOS headless (in favour of this shows
(if stdenv.isDarwin then "--disable-xcode" else ""
, which disables GUI build). Or it somehow uses a different GUI toolkit?
You stated that this "Fix handbrake build by adding a dependency on lzma (for all platforms) and adding some Darwin-specific libraries and patches.", it seems quite misleading.
Did you tried to work-around lack of libappindicator-gtk3
and what were the results?
AFAIR libappindicator-gtk3
is a tiny functionality and an optional dependency that I kept in closure, I only work in the Linux space. Are you positive that because of GTK build on macOS is not possible and we required to throw away baby with bathwater (of course I also refer to official build documentation?
Sorry for such a long list of remarks and questions, try to provide closer description to changes.
Also:
# GTK. This is not available on Darwin, since libappindicator-gtk3 is not supported there.
Does it mean that this code block is not available, or GTK is not available?
To sum-up:
- Is
libappindicator-gtk3
is really major required dependency of build on macOS, then we required to make only headless build? - Maybe I missed or do not know some information - then please provide more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I did throw the baby out with the bathwater 🙂 Your concerns are totally fair and I apologize for not including more detail in the pull request.
I did try to make the libappindicator-gtk3 dependency optional, but then I faced the problem that Handbrake still had a transitive dependency on systemd (which is not available on macOS). I’m not sure which of Handbrake’s dependencies introduced this transitive dependency but I did find that completely disabling GTK support on macOS took care of the problem. (It’s not clear to me whether Handbrake supports being built without libappindicator-gtk3.)
I also could not figure out how to build the native macOS GUI. Removing the --disable-xcode
flag let the package build but the only file in the resulting derivation was still HandbrakeCLI
. (In retrospect, I’m not sure what prompted me to add this flag in the first place—the package now seems to build equally well regardless of whether or not it’s specified. But the native GUI is not present in either case.)
My assumption was that most Nix users on macOS would prefer a headless Handbrake, at least compared to the status quo, which was that the package was completely unavailable on macOS. I decided that the best way forward would be to completely disable the GTK portion of the package when building under macOS.
I can think of the following ways to resolve this. (I’m a newer Nix user, though, so it’s completely possible that there’s something I’ve missed or misunderstood!)
- Remove all Handbrake changes from this PR.
- Update the PR so that the only change to Handbrake is to add lzma and the Darwin libraries as dependencies. Users on macOS will need to set
useGtk = false
in config.nix in order to install Handbrake. - Leave the PR as is. Users on macOS will only be able to install headless Handbrake.
- Hold the PR until it offers the native Handbrake GUI on macOS.
- Hold the PR until it offers the GTK GUI on macOS. (Is this possible?)
I’ll leave it to you to decide which resolution would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Anton-Latukha Any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then I faced the problem that Handbrake still had a transitive dependency on systemd (which is not available on macOS). I’m not sure which of Handbrake’s dependencies introduced this transitive dependency
This derivation needs to be found. Consider using nix why-depends
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependency chain seems to be Handbrake → various parts of GTK+3 → libatk → at-spi2 → dbus → systemd.
nix why-depends --all nixpkgs.handbrake nixpkgs.systemd
/nix/store/5kainpmfmb0i12a73i6zn08piqyxvv7m-handbrake-1.2.2
╚═══bin/.ghb-wrapped: …IL_56.LIBAVFORMAT_58./nix/store/hg8r2zrmpkx3al9hsvnkrxvr4rifl54k-gtk+3-3.24.8/lib:/nix/store/164…
=> /nix/store/hg8r2zrmpkx3al9hsvnkrxvr4rifl54k-gtk+3-3.24.8pkx3al9hsvnkrxvr4rifl54k-gtk+3-3.24.8/share/gsettings-sc…
bin/ghb: …xport XDG_DATA_DIRS='/nix/store/hg8r2zrmpkx3al9hsvnkrxvr4rifl54k-gtk+3-3.24.8/share/gsettings-sc…
╚═══bin/gtk-launch: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-am-et.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-cedilla.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-cyrillic-translit.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-inuktitut.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-ipa.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-multipress.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-thai.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-ti-er.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-ti-et.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-viqr.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-wayland.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-waylandgtk.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/immodules/im-xim.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/gtk-3.0/3.0.0/printbackends/libprintbackend-lpr.so: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
=> /nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.08yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
lib/libgtk-3.so.0.2404.4: …w2w23-atk-2.32.0/lib:/nix/store/hp9m8yl53dmgydini31l71x8g3407gmq-at-spi2-atk-2.32.0/lib:/nix/sto…
╚═══lib/libatk-bridge-2.0.so.0.0.0: …j8lg-glib-2.60.3/lib:/nix/store/jlnmaraahxbpnygmhjm1qzsyn8n2b9m8-at-spi2-core-2.32.1/lib:/nix/st…
=> /nix/store/jlnmaraahxbpnygmhjm1qzsyn8n2b9m8-at-spi2-core-2.32.1
╚═══libexec/at-spi-bus-launcher: …a boolean but got %s./nix/store/k02nmqccdqhyk00k4a6hr20kv1f5v6pq-dbus-1.12.16/bin/dbus-daemon...…
=> /nix/store/k02nmqccdqhyk00k4a6hr20kv1f5v6pq-dbus-1.12.16
╚═══etc/systemd/user/dbus.socket: …t/bus.ExecStartPost=-/nix/store/hach8csknszq07jfv8bdgqhgwmj7bcz7-systemd-242/bin/systemctl --use…
=> /nix/store/hach8csknszq07jfv8bdgqhgwmj7bcz7-systemd-242
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, really sorry for the long pause.
Preface: I myself learned quickly that small PRs are way better then complex epic ones. If you can avoid making an epic or complex PR.
- It would be easier for you to merge changes, if you branch-out and separately PR changes to different packages. If your package fixes rely on each-other - you can keep the main develop branch for yourself, and cherry-pick your main develop branch changes into different branches.
Some while back I touched ATK
and at-spi-core2
, since they implement accessibility specification and use dbus
I wonder why they require systemd
.
- I am currently researching the question about dependency on
systemd
, also feel free to pursue yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had picked the ffmpeg and mp4v2 stuff around a week ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Situation of dependency on systemd
is covered in 3 comments here #62421 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdesham Thanks for sharing story of experience.
Since now the source of problem is known - current changes are reasonable. Would fix GUI when upstream issue for it is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that libappindicator-gtk3 is needed by handbrake at all! I can't find it in any build script. Perhaps we can just remove that everywhere.
libgudev & udev are optional dependencies, but can be just added on linux. Otherwise gtk support should just work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cairo has worked on x86_64-darwin for a long time. You shouldn't need to make any changes to this
This involved several pieces: - Always disable GTK GUI support under Darwin. The gtk3 package depends transitively on dbus, which depends transitively on systemd, which is not currently supported on Darwin. (I gather that it may be possible to work around this in the future.) - Also disable the native GUI support under Darwin (using the --disable-xcode flag). Building this GUI would require using the Xcode build system, which I was not able to figure out how to do; for now, all builds on Darwin are command-line-only. - Add the lzma package as a dependency on all platforms. - Add dependencies on the AudioToolbox, Foundation, libobjc, and VideoToolbox packages on Darwin.
c35f9fb
to
765cd8c
Compare
I’ve force-updated the branch so that it’s based on the latest nixpkgs master branch. I removed all of the commits except for the Handbrake one, since @vcunat was kind enough to cherry-pick some of the other commits earlier and, as @matthewbauer points out, the cairo changes don’t actually seem to be necessary. (I’ll open a new PR later to add the video-transcoding scripts that this PR used to include.) I also added some notes to the Handbrake default.nix file and added some commentary to the commit message; I didn’t change any of the code itself. I want to apologize to all of you for this PR turning into such a mess—I should have broken it up into several separate, orthogonal PRs. I will definitely keep that in mind next time 🙂 Thank you everyone for the kind feedback and suggestions on this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now! Ideally gtk backend would work, but it may not be necessary for most users
This is good to be merged, right? Would someone with write access mind doing that? |
@GrahamcOfBorg build handbrake |
@bdesham can you please look into the |
I see
which does not seem related to this PR. It's probably some race in the build system, as on |
@vcunat Is there anything I can do to move this PR along? I don’t have write access and I’m not sure which parallel-building setting you’re referring to. |
I meant: aaf3881. (Easier done than explained.) |
Thanks @vcunat! |
Motivation for this change
nvenc
option is not used.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)cc @codyopel @Fuuzetsu @Anton-Latukha @wmertens