Skip to content

qt-5/hooks/fix-qt-builtin-paths.sh: do not hardcode output paths#220311

Merged
vcunat merged 1 commit intostagingfrom
unknown repository
Mar 25, 2023
Merged

qt-5/hooks/fix-qt-builtin-paths.sh: do not hardcode output paths#220311
vcunat merged 1 commit intostagingfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Mar 9, 2023

Description of changes

The fix-qt-builtin-paths.sh script replaces several strings in .pr files with output names; for example

$$[QT_HOST_BINS]    is replaced by    $dev

This causes problems when cross-compiling: the mkspecs/qconfig.pri in the $dev output of qtbase will have output names of qtbase hardwired into it. Since qmake is part of the qtbase package, it will pick up these hardcoded paths when compiling the other modules.

As a result, the installPhase of qtdeclarative (and other modules) will attempt to copy their results into the already-registered store path for qtbase. This will fail, because Nix prevents writes to a storepath after it has been registered.

Fortunately the .pri files understand environment variable substitution: you can write $$NIX_OUTPUT_DEV to tell qmake that it should use the value of the NIX_OUTPUT_DEV environment variable at qmake-run-time (rather than at qmake-build-time).

@ghost ghost requested a review from ttuegel as a code owner March 9, 2023 09:44
@github-actions github-actions bot added the 6.topic: qt/kde Object-oriented framework for GUI creation label Mar 9, 2023
@ghost ghost mentioned this pull request Mar 9, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. labels Mar 9, 2023
The fix-qt-builtin-paths.sh script replaces several strings in *.pr*
files with output names; for example

```
$$[QT_HOST_BINS]    is replaced by    $dev
```

This causes problems when cross-compiling: the `mkspecs/qconfig.pri`
in the `$dev` output of `qtbase` will have output names *of qtbase*
hardwired into it.  Since `qmake` is part of the `qtbase` package,
it will pick up these hardcoded paths when compiling the other
modules.

As a result, the `installPhase` of `qtdeclarative` (and other
modules) will attempt to copy their results into the
already-registered store path for `qtbase`.  This will fail, because
Nix prevents writes to a storepath after it has been registered.

Fortunately the `.pri` files understand environment variable
substitution: you can write `$$NIX_OUTPUT_DEV` to tell `qmake` that
it should use the value of the `NIX_OUTPUT_DEV` environment variable
*at `qmake`-run-time* (rather than at `qmake`-build-time).
@ghost ghost marked this pull request as draft March 9, 2023 11:42
@ghost ghost changed the base branch from master to staging March 9, 2023 11:42
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: python Python is a high-level, general-purpose programming language. 8.has: module (update) This PR changes an existing module in `nixos/` and removed 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. labels Mar 9, 2023
@ghost ghost marked this pull request as ready for review March 9, 2023 11:44
@vcunat vcunat added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Mar 16, 2023
@SuperSandro2000
Copy link
Copy Markdown
Member

@ofborg build qt5.qtdeclarative
@ofborg build pkgsCross.aarch64-multiplatform.qt5.qtdeclarative

@vcunat vcunat merged commit 3ffdc0b into NixOS:staging Mar 25, 2023
@ghost ghost deleted the pr/qt5/cross/dont-hardcode-paths branch March 28, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: qt/kde Object-oriented framework for GUI creation 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants