-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
musescore: 4.0.2 -> 4.1.0 #243298
musescore: 4.0.2 -> 4.1.0 #243298
Conversation
cfaf838
to
e48d2c2
Compare
e48d2c2
to
c5c5ebe
Compare
c5c5ebe
to
47919de
Compare
It's working for me. |
The usage of libsForQt5's mkDerivation is deprecated.
42577fc
to
5514d0c
Compare
@ofborg build musescore |
1f4dd1b
to
edadd2d
Compare
Aish! Syntax errors in |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
I'll wait a few days for help from Darwin users, and if none will come, I'll do merge the previous dmg based expression by @yurrriq into |
I’m replying here as well to document (from https://discourse.nixos.org/t/need-help-from-darwin-users-syntax-errors-in-library-frameworks-foundation-framework-headers/30467/2). The issue is portaudio is propagating frameworks from the 10.12 SDK. Mixing frameworks from different SDK versions doesn’t work. It results in errors because the headers aren’t compatible. You need to override portaudio to use the 11.0 SDK. let
# portaudio propagates Darwin frameworks. Rebuild it using the 11.0 stdenv from Qt and the 11.0 SDK frameworks.
portaudio' = if !stdenv.isDarwin
then portaudio
else portaudio.override {
inherit stdenv;
inherit (darwin.apple_sdk_11_0.frameworks) AudioUnit AudioToolbox CoreAudio CoreServices Carbon;
};
in I also want to note this derivation doesn’t build with sandbox enabled. This is a Qt issue. qtbase should be propagating its sandbox profile, but it doesn’t actually seem to work. This is the current workaround I’ve used in a couple of other packages:
|
@ofborg build musescore Thanks for the detailed answer @reckenrode ! Hopefully this will work now. I wonder why the default darwin frameworks are not 11_0 throughout all Nixpkgs... Perhaps, |
Still very similar syntax errors... |
The x86_64-darwin SDK hasn’t been bumped in a while. @toonn is working on a bump to 10.13. As for why, I think there is a desire to use a source-based SDK when possible as well as one to support as many users as possible. I don’t see needing to support multiple SDKs changing. Some software requires a newer one or should be built with a newer one (e.g., Blender) then back deployed (e.g., MoltenVK). Some could be built with a newer one and work okay, but presumably a lot of software does static feature detection instead of dynamic, so we have to build with as old as possible to maximize support. There are definitely some ergonomic and composability issues with the current approach (SDK-specific |
portmidi doesn’t propagate its build inputs, so you don’t have to rebuild it. It also appears I was wrong about the stdenv. I thought Qt would provide an 11.0 SDK one, but it’s apparently still the default 10.12 SDK stdenv. Using the 11.0 SDK stdenv directly allows it to build for me. I apologize for not doing more testing (aside from confirming the expression for portaudio). Here’s a diff with the changes I made to get it to build for x86_64-darwin. diff --git a/pkgs/applications/audio/musescore/default.nix b/pkgs/applications/audio/musescore/default.nix
index 07a9e36a0ab..da0c8110a66 100644
--- a/pkgs/applications/audio/musescore/default.nix
+++ b/pkgs/applications/audio/musescore/default.nix
@@ -31,10 +31,11 @@
}:
let
+ stdenv' = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
# portaudio and portmidi propagate Darwin frameworks. Rebuild them using the
# 11.0 stdenv from Qt and the 11.0 SDK frameworks.
portaudio' = if stdenv.isDarwin then portaudio.override {
- inherit stdenv;
+ stdenv = stdenv';
inherit (darwin.apple_sdk_11_0.frameworks)
AudioUnit
AudioToolbox
@@ -43,17 +44,7 @@ let
Carbon
;
} else portaudio;
- portmidi' = if stdenv.isDarwin then portmidi.override {
- inherit stdenv;
- inherit (darwin.apple_sdk_11_0.frameworks)
- Carbon
- CoreAudio
- CoreFoundation
- CoreMIDI
- CoreServices
- ;
- } else portmidi;
-in stdenv.mkDerivation rec {
+in stdenv'.mkDerivation rec {
pname = "musescore";
version = "4.1.0";
@@ -101,7 +92,7 @@ in stdenv.mkDerivation rec {
libsndfile
libvorbis
portaudio'
- portmidi'
+ portmidi
flac
qtbase
qtdeclarative Unfortunately, it fails during install phase. At least it’s not SDK related …. CMake Error at src/app/cmake_install.cmake:87 (file):
file INSTALL cannot find
"/private/tmp/nix-build-qtbase-5.15.9.drv-0/qtbase-a196623/$(out)/$(qtQmlPrefix)":
No such file or directory.
Call Stack (most recent call first):
src/cmake_install.cmake:42 (include)
cmake_install.cmake:57 (include)
FAILED: CMakeFiles/install.util
cd /tmp/nix-build-musescore-4.1.0.drv-0/source/build && /nix/store/q6cc8rhv9v8ji23xw3d8rp2ns0cclzc1-cmake-3.26.4/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed. |
@@ -54,6 +54,9 @@ in stdenv'.mkDerivation rec { | |||
rev = "v${version}"; | |||
sha256 = "sha256-CqW1f0VsF2lW79L3FY2ev+6FoHLbYOJ9LWHeBlWegeU="; | |||
}; | |||
patches = [ | |||
./darwin-fix-install.patch |
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.
Can you please add a comment on why this patch is required?
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.
Can you please add a comment on why this patch is required?
I will, once I see that it works.
I was able to get it to build, but I ran into a few issues.
The following diff resolves these issues (except the last one). Testing was confirming it launched and that I could place notes on things in a document. diff --git a/pkgs/applications/audio/musescore/default.nix b/pkgs/applications/audio/musescore/default.nix
index 56185fccf0d..4b344516c11 100644
--- a/pkgs/applications/audio/musescore/default.nix
+++ b/pkgs/applications/audio/musescore/default.nix
@@ -20,6 +20,7 @@
, qtdeclarative
, qtgraphicaleffects
, flac
+, qtquickcontrols
, qtquickcontrols2
, qtscript
, qtsvg
@@ -70,7 +71,8 @@ in stdenv'.mkDerivation rec {
qtWrapperArgs = [
# MuseScore JACK backend loads libjack at runtime.
- "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}"
+ "--prefix ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjack2 ]}"
+ ] ++ lib.optionals (!stdenv.isDarwin) [
# There are some issues with using the wayland backend, see:
# https://musescore.org/en/node/321936
"--set-default QT_QPA_PLATFORM xcb"
@@ -100,6 +102,7 @@ in stdenv'.mkDerivation rec {
qtbase
qtdeclarative
qtgraphicaleffects
+ qtquickcontrols
qtquickcontrols2
qtscript
qtsvg
@@ -110,6 +113,16 @@ in stdenv'.mkDerivation rec {
alsa-lib
];
+ postPatch = lib.optionalString stdenv.isDarwin ''
+ substituteInPlace build/cmake/SetupBuildEnvironment.cmake \
+ --replace 'set(CMAKE_OSX_ARCHITECTURES x86_64)' 'set(CMAKE_OSX_ARCHITECTURES ${stdenv.hostPlatform.darwinArch})'
+ '';
+
+ postInstall = lib.optionalString stdenv.isDarwin ''
+ mkdir -p "$out/Applications"
+ mv "$out/mscore.app" "$out/Applications/mscore.app"
+ '';
+
passthru.tests = nixosTests.musescore;
meta = with lib; { |
I did a search for a file I could open. Playback works too (though it crashes if you quit during playback). |
Thanks again for the help @reckenrode . Regarding the Also, regarding the |
Oh and BTW I was wondering what kind of error do you get when |
5fcf3e3
to
bc14b92
Compare
# Upstream assumes the user has x86_64, and not aarch64 | ||
postPatch = lib.optionalString stdenv.isDarwin '' | ||
substituteInPlace build/cmake/SetupBuildEnvironment.cmake \ | ||
--replace 'set(CMAKE_OSX_ARCHITECTURES x86_64)' 'set(CMAKE_OSX_ARCHITECTURES ${stdenv.hostPlatform.darwinArch})' |
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 wonder whether this can be set with a cmakeFlag
(question for @reckenrode ).
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.
There is BUILD_MACOS_APPLE_SILICON
, which can be set to ON
. It works by clearing out CMAKE_OSX_ARCHITECTURES
, which (as I understand it) means to build for the native host only. That should also work normally, but I’m not sure what it would do in a cross build.
I tried cross-building musescore (because x86_64-darwin to aarch64-darwin should work), but it appears waf needs an emulator for an aarch64-darwin cross-build, and there isn’t one available.
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.
There is
BUILD_MACOS_APPLE_SILICON
, which can be set toON
. It works by clearing outCMAKE_OSX_ARCHITECTURES
, which (as I understand it) means to build for the native host only. That should also work normally, but I’m not sure what it would do in a cross build.
Cross compilation is a very high ideal for this package IMO. I removed that substituteInPlace
in favor of the mentioned cmake flag which I think will survive updates better, especially if upstream will rewrite/rename their cmake files.
I tested on an M1 Max MBP.
I assume such a patch would need to make copying the QML files conditional (e.g., on
There’s no I also wanted to note there are the following things in
|
One of the Qt applications using during the build process will crash during when the sandbox is enabled. See #234122 for details. In theory, the profile should be propagated to anything using qtbase. It doesn’t seem to work though (see #237458). |
bc14b92
to
12b4ed6
Compare
12b4ed6
to
c9db298
Compare
Defninitly, these are not darwin specific. I removed them.
OK good, I created that symlink.
Yes I agree. I opened an issue there: musescore/MuseScore#18665 . Other then that, I squashed all the darwin related changes to 1 commit, and I'm pretty sure it should work. Thanks once more @reckenrode for all the help. |
c9db298
to
f0a79ec
Compare
Co-authored-by: Randy Eckenrode <randy@largeandhighquality.com>
f0a79ec
to
8895d55
Compare
CI is fully green right now. I think this is ready to go. Any other objections / comments? |
There's one missing test and it's ready to merge after that. Nice team work in this PR ! |
Ok enough waiting. |
@doronbehar et al. thanks for this PR! Six years ago 😮 I just did a naive port of the Homebrew... recipe? to get a quick and dirty (and binary) expression for darwin. I'm glad to see this finally getting fixed. |
Diff: musescore/MuseScore@v4.0.2...v4.1.0
Description of changes
Close #243109 .
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)