I’m trying to package an application(ScreenPlay if that’s relavent) that is built with Qt. But in the install phase It throws this error:
CMake Error at /nix/store/cp30fin83aimfljxb5988bkn2micgi04-qtbase-6.9.0/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:139 (file):
file RPATH_SET could not write new RPATH:
$ORIGIN/../../lib64
to the file:
/nix/store/3f845ixbd0rsigy3jr5ilrsdxq4w0jic-screenplay/qml/QtQml/libqmlplugin.so
Error opening file for update.
Call Stack (most recent call first):
/nix/store/k051a6s5x63nln5yif7rkr1rjk1cd1x4-qtdeclarative-6.9.0/lib/cmake/Qt6Qml/Qt6QmlDeploySupport.cmake:314 (_qt_internal_set_rpath)
.qt/deploy_qml_imports/ScreenPlayApp.cmake:10 (_qt_internal_deploy_qml_imports_for_target)
/nix/store/k051a6s5x63nln5yif7rkr1rjk1cd1x4-qtdeclarative-6.9.0/lib/cmake/Qt6Qml/Qt6QmlDeploySupport.cmake:59 (include)
/nix/store/k051a6s5x63nln5yif7rkr1rjk1cd1x4-qtdeclarative-6.9.0/lib/cmake/Qt6Qml/Qt6QmlDeploySupport.cmake:66 (qt6_deploy_qml_imports)
qt_deploy_all.cmake:5 (qt_deploy_qml_imports)
cmake_install.cmake:111 (include)
default.nix file:
{ pkgs ? import <nixpkgs> { }, build_with_godot ? false
, godot_pkg ? pkgs.godot4-mono }:
let
version = "v0.15.1-beta1";
src = pkgs.fetchFromGitLab {
owner = "kelteseth";
repo = "ScreenPlay";
rev = "4c9ab644ecc712a524ce27070a83b4b54294e9b7";
sha256 = "sha256-gat0wSBqlb+OizGA/d09FhNgY7uHEOVj3AJgjD7iYAo=";
};
qqcoro = (import ./qqcoro.nix { inherit pkgs; });
qarchive = (import ./qarchive.nix { inherit pkgs; });
extra-cmake-modules =
(import ./kde-extra-cmake-modules.nix { inherit pkgs; });
layer-shell-qt = (import ./kde-layer-shell-qt.nix { inherit pkgs; });
versionFile = pkgs.writeText "version.cmake" ''
function(get_project_version VERSION_VAR)
set(\$\{VERSION_VAR\} ${version})
endfunction()
'';
thirdPartyCMakeLists = pkgs.writeText "CMakeLists.txt" ''
add_subdirectory(${qarchive.outPath} ThirdParty/QArchive)
add_subdirectory(${qqcoro.outPath} ThirdParty/Qcoro)
add_subdirectory(Steam)
qcoro_enable_coroutines()
if(UNIX AND NOT APPLE)
add_subdirectory(${layer-shell-qt.outPath} layer-shell-qt)
endif()
'';
in pkgs.stdenv.mkDerivation {
inherit version;
name = "screenplay";
src = src;
nativeBuildInputs = with pkgs; [ kdePackages.wrapQtAppsHook ninja lld ];
buildInputs = with pkgs;
[
cmake
wayland
kdePackages.wayland-protocols
wayland-scanner
curl
wget
zip
unzip
gnutar
git
pkg-config
fontconfig.dev
cacert
gnupg
python3
python3Packages.pip
mesa
libxkbcommon
xorg.libX11.dev
xorg.xorgserver.dev
xorg.xorgproto
xorg.libxcb
xorg.libxcb.dev
xorg.xcbutil
xorg.xcbutil.dev
xorg.xcbutilimage
xorg.xcbutilkeysyms
xorg.xcbutilrenderutil
xorg.xcbutilwm
libuuid
libselinux
libsepol
qt6.full
qt6.qtbase
libarchive
fmt
qarchive
qqcoro
extra-cmake-modules
layer-shell-qt
] ++ (if build_with_godot then [ godot_pkg ] else [ ]);
patchPhase = ''
cp ${versionFile} CMake/GetProjectVersion.cmake
# moving to another location since building will generate new files
mkdir -p /tmp/screenplay-build/
mv ThirdParty /tmp/screenplay-build
cp ${thirdPartyCMakeLists} /tmp/screenplay-build/ThirdParty/CMakeLists.txt
cp -r ${extra-cmake-modules.outPath} /tmp/screenplay-build/ThirdParty/extra-cmake-modules
cp -r ${layer-shell-qt.outPath} /tmp/screenplay-build/ThirdParty/layer-shell-qt
cp -r ${qarchive.outPath} /tmp/screenplay-build/ThirdParty/QArchive
cp -r ${qqcoro.outPath} /tmp/screenplay-build/ThirdParty/Qcoro
chmod -R +rw /tmp/screenplay-build/ThirdParty/
ln -s /tmp/screenplay-build/ThirdParty ThirdParty
'';
configurePhase = ''
cmake . \
-GNinja \
-DCMAKE_PREFIX_PATH="${extra-cmake-modules.outPath}/var/empty/local/share/ECM;${layer-shell-qt.outPath}/lib64/cmake" \
-DCMAKE_INSTALL_PREFIX=$out
'';
buildPhase = ''
cmake --build .
'';
installPhase = ''
runHook preInstall
cmake --install . --prefix $out
runHook postInstall
'';
fixupPhase = ''
wrapQtAppsHook
'';
}
qqcoro, qarchive, extra-cmake-modules-layer-shell-qt are files that requires fetch at run time or as dependency on build
The original build guide is here
BTW I’m building this on Arch linux since I manages my dotfiles with nix.