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

stdenv.mkDerivation: check that depsBuildX are executable on the build system #204387

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Artturin
Copy link
Member

@Artturin Artturin commented Dec 4, 2022

nix-repl> :p pkgsCross.aarch64-multiplatform.keybinder.nativeBuildInputs
[ «derivation /nix/store/sxxk0g9gd18w9r28gbfx8wl65sr8liwm-aarch64-unknown-linux-gnu-pkg-config-wrapper-0.29.2.drv» «derivation /nix/store/ldbs4pw57hy3szqfh8ycskrgywpaahqs-autoconf-2.71.drv» trace: warning: automake-aarch64-unknown-linux-gnu-1.11.6 in keybinder nativeBuildInputs not executable on build
«derivation /nix/store/yj8vj3gbd78scrj4xjmdx4rm5p87dyb9-automake-aarch64-unknown-linux-gnu-1.11.6.drv» ]

TODO less duplication and better warning by merging with checkDependencyList/make a function which takes these as args

@Artturin Artturin marked this pull request as draft December 4, 2022 01:23
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Dec 4, 2022
@SuperSandro2000
Copy link
Member

There seems to be a lot of errors around i686-w64-mingw32-stage-final-gcc-wrapper but I like the general idea.

@Artturin
Copy link
Member Author

Artturin commented Dec 4, 2022

nix-repl> o = lib.lists.last wine.nativeBuildInputs

nix-repl> o
«derivation /nix/store/i7ya4lqal0awbgxrabkq70gx56skvax5-i686-w64-mingw32-stage-final-gcc-wrapper-11.3.0.drv»

nix-repl> stdenv.buildPlatform.canExecute o.stdenv.hostPlatform
true

nix-repl> pkgsi686Linux.stdenv.buildPlatform.canExecute o.stdenv.hostPlatform
false

wine64 and wineWowPackages.full eval while wine(wine32) failsto eval

wine32 = pkgsi686Linux.callPackage ./base.nix {

@Artturin
Copy link
Member Author

Artturin commented Dec 4, 2022

this fixes the eval error, i copied it from wineWow

diff --git a/pkgs/applications/emulators/wine/packages.nix b/pkgs/applications/emulators/wine/packages.nix
index 3b5aa19658c..440fd167d98 100644
--- a/pkgs/applications/emulators/wine/packages.nix
+++ b/pkgs/applications/emulators/wine/packages.nix
@@ -11,6 +11,7 @@ in with src; {
   wine32 = pkgsi686Linux.callPackage ./base.nix {
     pname = "wine";
     inherit src version supportFlags patches moltenvk;
+    stdenv = stdenv_32bit;
     pkgArches = [ pkgsi686Linux ];
     vkd3dArches = lib.optionals supportFlags.vkd3dSupport [ vkd3d_i686 ];
     geckos = [ gecko32 ];

but it does change

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu

to

wine> checking build system type... x86_64-pc-linux-gnu
wine> checking host system type... x86_64-pc-linux-gnu
# A stdenv capable of building 32-bit binaries.
# On x86_64-linux, it uses GCC compiled with multilib support; on i686-linux,
# it's just the plain stdenv.
stdenv_32bit = lowPrio (if stdenv.hostPlatform.is32bit then stdenv else multiStdenv);

i don't know if this affects anything negatively but wine builds and the log output is similar but with stuff like gcc -m32 ... and -m32 in other places

Weird things in the log are

checking for cups/cups.h... yes
checking for cups/ppd.h... yes
- checking for -lcups... libcups.so.2
+ checking for -lcups... not found
...
- configure: libcapi20 development files not found, ISDN won't be supported.
+ configure: libcapi20 32-bit development files not found, ISDN won't be supported.
+ configure: libcups 32-bit development files not found, CUPS won't be supported.

no diff in

nix-repl> pkgs = import ./. { system = "i686-linux"; }

nix-repl> pkgs.wine
«derivation /nix/store/lik48akxk5hk3hvbqhaxgsh0827kv3zd-wine-7.0.drv»

@Artturin Artturin force-pushed the checkdepsbuildexecutableonbuild branch 2 times, most recently from c94d3c8 to 2c20464 Compare December 4, 2022 13:45
@ofborg ofborg bot requested a review from steveej December 4, 2022 15:00
@Artturin Artturin force-pushed the checkdepsbuildexecutableonbuild branch 3 times, most recently from ac9207b to aa8cc54 Compare December 5, 2022 00:16
@Artturin Artturin changed the title WIP stdenv.mkDerivation: check that depsBuildX are executable on the … stdenv.mkDerivation: check that depsBuildX are executable on the build system Dec 5, 2022
@Artturin Artturin force-pushed the checkdepsbuildexecutableonbuild branch from aa8cc54 to 823846c Compare December 5, 2022 00:47
@Artturin
Copy link
Member Author

Artturin commented Dec 5, 2022

lots of warnings in perlPackages and pythonPackages
pythonPackages fix in #201734

perlPackages todo for me, will be fixed before this pr is merged or in this pr

version = "5.34.1";
sha256 = "sha256-NXlRpJGwuhzjYRJjki/ux4zNWB3dwkpEawM+JazyQqE=";
};

# Maint version
perl536 = common {
perl = pkgs.perl536;
buildPerl = buildPackages.perl536;
self = __splicedPackages.perl536;
Copy link
Member Author

Choose a reason for hiding this comment

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

preparation for doing splicing like in python

@Artturin Artturin force-pushed the checkdepsbuildexecutableonbuild branch 3 times, most recently from 9b31a18 to cb459fb Compare December 5, 2022 16:50
@Artturin
Copy link
Member Author

Artturin commented Dec 5, 2022

somehow the mini output of perl gets introduced

before

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.perlPackages.perl.mini
error: attribute 'mini' missing

       at «string»:1:1: (source not available)
       Did you mean man?

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.perlPackages.perl
«derivation /nix/store/bjh5sr9f1g48q1by44qnabgkdiayi5h9-perl-5.36.0.drv»

after

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.perlPackages.perl.mini
«derivation /nix/store/x873z4mmfqwynw10a8j5v9xzm8mharsk-perl-aarch64-unknown-linux-gnu-5.36.0.drv»

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.perlPackages.perl
«derivation /nix/store/bjh5sr9f1g48q1by44qnabgkdiayi5h9-perl-5.36.0.drv»

dropping perl: use self == __splicedPackages instead of perl and buildPerl from this PR

EDIT: added it back and used (perl.__spliced.buildHost.mini or perl)

to make sure all things in nativeBuildInputs are executable on
buildPlatform

```
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
```

to

```
wine> checking build system type... x86_64-pc-linux-gnu
wine> checking host system type... x86_64-pc-linux-gnu
```

i don't know if this affects anything negatively but wine builds and the log output is similar but with stuff like `gcc -m32 ...` and `-m32` in other places

Weird things in the log are

```diff
checking for cups/cups.h... yes
checking for cups/ppd.h... yes
- checking for -lcups... libcups.so.2
+ checking for -lcups... not found
...
- configure: libcapi20 development files not found, ISDN won't be supported.
+ configure: libcapi20 32-bit development files not found, ISDN won't be supported.
+ configure: libcups 32-bit development files not found, CUPS won't be supported.
```

no diff in
```
nix-repl> pkgs = import ./. { system = "i686-linux"; }

nix-repl> pkgs.wine
«derivation /nix/store/lik48akxk5hk3hvbqhaxgsh0827kv3zd-wine-7.0.drv»
```
 ["trace: warning: dpkg-1.21.1ubuntu2.1 in mfcl3770cdwdrv-1.0.2-0 nativeBuildInputs not executable on build", "trace: warning: hook in mfcl3770cdwdrv-1.0.2-0 nativeBuildInputs not executable on build", "trace: warning: dpkg-1.21.1ubuntu2.1 in mfcl3770cdwdrv-1.0.2-0 nativeBuildInputs not executable on build", "trace: warning: hook in mfcl3770cdwdrv-1.0.2-0 nativeBuildInputs not executable on build"]

```
nix-repl> o = lib.lists.last wine.nativeBuildInputs

nix-repl> o
«derivation /nix/store/i7ya4lqal0awbgxrabkq70gx56skvax5-i686-w64-mingw32-stage-final-gcc-wrapper-11.3.0.drv»

nix-repl> stdenv.buildPlatform.canExecute o.stdenv.hostPlatform
true

nix-repl> pkgsi686Linux.stdenv.buildPlatform.canExecute o.stdenv.hostPlatform
false
```
allows us to use nixpkgs-fmt when editing this file making the editing
experience much better
…d system

```
nix-repl> pkgsCross.aarch64-multiplatform.keybinder.nativeBuildInputs
[ «derivation /nix/store/sxxk0g9gd18w9r28gbfx8wl65sr8liwm-aarch64-unknown-linux-gnu-pkg-config-wrapper-0.29.2.drv» «derivation /nix/store/ldbs4pw57hy3szqfh8ycskrgywpaahqs-autoconf-2.71.drv» trace: warning: automake-aarch64-unknown-linux-gnu-1.11.6 in keybinder's nativeBuildInputs not executable on build
«derivation /nix/store/yj8vj3gbd78scrj4xjmdx4rm5p87dyb9-automake-aarch64-unknown-linux-gnu-1.11.6.drv» ]
```
@ghost
Copy link

ghost commented Oct 24, 2023

You can ping me for a review when this is ready.

Checking for this kind of stuff is a good idea in general.

@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
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.

None yet

3 participants