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

Fix Mobile NixOS regressions after the pkg-config changes in Nixpkgs #177

Merged
merged 2 commits into from Jul 3, 2020

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Jul 3, 2020

The way Nixpkgs handles pkg-config during cross is by now using a prefixed binary name.

Many tools are not ready for such a thing, here I am fixing the Mobile NixOS specific issues.

Tested against Nixpkgs b3251e04ee470c20f81e75d5a6080ba92dc7ed3f, which currently fail.

Note that this breaks compatibility with Nixpkgs before that pkg-config change.

Fixes #176

@ingenieroariel, can you confirm that, at least on b3251e04ee470c20f81e75d5a6080ba92dc7ed3f, things work, and also that the changes look okay? Thanks!

This will be fixed more appropriately once work on integrating the
upcoming build-system changes for 2.2 is done. With an upstream patch.
This update knows about $PKG_CONFIG
@ingenieroariel
Copy link
Member

I tried it on

        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "0a146054bdf6f70f66de4426f84c9358521be31e",
        "type": "github"

and got

  CC      drivers/tty/serial/sh-sci.o
  CC [M]  drivers/staging/greybus/bootrom.o
substituteStream(): WARNING: pattern 'ata_id' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern 'scsi_id' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern 'cdrom_id' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
  CC      drivers/tty/serial/imx.o
substituteStream(): WARNING: pattern '/nix/store/1dq1r9gbhj9hfa3abrg59byy74r3zk6s-coreutils-8.31-aarch64-unknown-linux-gnu/bin/basename' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern '/nix/store/adpq7yb1l9ms76pn57jcllzjp3pi7ibj-util-linux-2.35.1-aarch64-unknown-linux-gnu-bin/bin/blkid' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern '/nix/store/4b5j5d6yhhk608kj7y7j03idiajiyr7c-mdadm-4.1-aarch64-unknown-linux-gnu/sbin' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern '/nix/store/mf0vrd7500yxv2m3hj98hxh5kgzfqk4w-bash-4.4-p23-aarch64-unknown-linux-gnu/bin/sh' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
substituteStream(): WARNING: pattern '/nix/store/sr7kbzy1ag68xzzmln853ijc8m2ri6md-systemd-245.6-aarch64-unknown-linux-gnu/bin/udevadm' doesn't match anything in file '/nix/store/y2bdx6kkmyasrxm87nkkvxnxhlzw3169-udev-rules/95-dm-notify.rules'
  CC [M]  drivers/staging/gasket/gasket_page_table.o
  CC [M]  drivers/staging/greybus/fw-core.o
  CC [M]  drivers/video/backlight/pcf50633-backlight.o
  CC [M]  drivers/net/ethernet/intel/ice/ice_sriov.o
  CC [M]  drivers/net/ethernet/intel/ixgbevf/ipsec.o
error: path '/nix/store/m589jc4y7cw46bnj4f3pj8dl4wf0xf65-firmware/lib/firmware' is not in the Nix store

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 3, 2020

nix-build examples/hello --argstr device oneplus-oneplus3 -A build.default
trace: ***************************************
trace: * Evaluating device: oneplus-oneplus3 *
trace: ***************************************
trace: Building with crossSystem?: aarch64-linux != x86_64-linux → we are.
trace:     crossSystem: config: aarch64-unknown-linux-gnu
trace: Building with crossSystem?: aarch64-linux != x86_64-linux → we are.
trace:     crossSystem: config: aarch64-unknown-linux-gnu
these derivations will be built:
  /nix/store/8kpbdjlv7msg8ilb9rf12l49gg1v7c97-opensc-0.20.0-aarch64-unknown-linux-gnu.drv
  /nix/store/l52pinffi2p712zqf05rgcfnfxi8s4r8-rng-tools-6.9-aarch64-unknown-linux-gnu.drv
  /nix/store/55bxg5sq8sm04yyb84ix8vik6kz7vikc-unit-rngd.service.drv
  /nix/store/jc7sqh18vf5ym5kx8hmf4q53yrl6ih1j-system-units.drv
  /nix/store/6fzs8fmwz5pnmjjfvzmkhiq7sjcc9940-linux-5.4.49-aarch64-unknown-linux-gnu.drv
  /nix/store/agj23y9ax45iw739cxc1dwmd305ixfyv-firmware.drv
  /nix/store/kmg34k3wj7hv85m8dmydrds8klwz3mpy-etc-nixos.conf.drv
  /nix/store/3khcxh879ws482wq85mf6bc9pcmzann1-etc.drv
  /nix/store/mfn2xrf0x75wla4rhg7wdk60ji6v5vkn-initrd-oneplus-oneplus3.drv
  /nix/store/dfdlf19x0xfcarbx8xnpaazjicrgw6wc-mobile-nixos_oneplus-oneplus3_boot.img.drv
  /nix/store/gxrq87pk5wyn0mks27ca251i2kk31znp-initrd-oneplus-oneplus3.drv
  /nix/store/gk1r4jjqbzkdiz74fiqj95bvrzsvj1jv-mobile-nixos_oneplus-oneplus3_recovery.img.drv
  /nix/store/imckjry044sy24sbnhszgyq2qlxwgrvj-kernel-modules.drv
  /nix/store/zmb6p0sings2yqmrblsj7x34wq1i6s5s-nixos-system-nixos-20.09pre232722.b3251e04ee4.drv
  /nix/store/qb38sr961v5s2z1ymp2k4lndyd6742ll-closure-info.drv
  /nix/store/mc3z6bghchqkk804cmdz8l3h7hzf8rl6-partition-MOBILE_HELLO.drv
  /nix/store/q66sagnqzk94my8dci12hqg2ziag4jik-android-device-oneplus-oneplus3.drv
error: path '/nix/store/m589jc4y7cw46bnj4f3pj8dl4wf0xf65-firmware/lib/firmware' is not in the Nix store 

/c/mobile-nixos (fix/pkg-config-regressions) [1]>

using

/c/mobile-nixos (fix/pkg-config-regressions)> git log
commit ab53f09061764f33a717d492e7c90d9d85e034d6 (HEAD -> fix/pkg-config-regressions, samueldr-wip/fix/pkg-config-regressions)
Author: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date:   Thu Jul 2 19:28:54 2020 -0400

    mruby-lvgui: 2020-02-05 -> 2020-07-02

    This update knows about $PKG_CONFIG

@ingenieroariel
Copy link
Member

Not really sure what is going on, qemu does not build either so it is likely there is a problem with my set up instead of this branch.

nix-build examples/hello --argstr device qemu-x86_64 -A build.default
trace: **********************************
trace: * Evaluating device: qemu-x86_64 *
trace: **********************************
trace: Building with crossSystem?: x86_64-linux != x86_64-linux → we're not.
these derivations will be built:
  /nix/store/ams2sinzffn2z670fvfbzwqhkyrvf5qq-initrd-qemu-x86_64.drv
  /nix/store/2vrg3bg9cyhx7dkq9i10g6f0qa0hrmg8-mobile-nixos_qemu-x86_64-qemu-startscript.drv
  /nix/store/wma96r8nb0wncbbhg560g7y76v17ayxy-partition-MOBILE_HELLO.drv
  /nix/store/qja96hyja3vgqsmcqak8cz7mrjkkbpbw-run-vm-qemu-x86_64.drv
building '/nix/store/wma96r8nb0wncbbhg560g7y76v17ayxy-partition-MOBILE_HELLO.drv'...
error: path '/nix/store/zq11im47l74r0dczg32vvg597dnaqrs4-linux-5.4.49-shrunk/lib/modules' is not in the Nix store

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 3, 2020

Same thing with:

b3251e04ee470c20f81e75d5a6080ba92dc7ed3f
/c/m/mobile-nixos (fix/pkg-config-regressions)# realpath /run/current-system
/nix/store/8nkv3pgy6hmbxy42112w1fl3x5yjc2m4-nixos-system-sensei-20.09.20200630.b3251e0

@samueldr
Copy link
Member Author

samueldr commented Jul 3, 2020

Oof, I'm currently using Nix 2.3.6 as present in nix stable.

But this is a known issue, NixOS/nix#3471

I think it is a regression in Nix, but I do not know if it actually is and what is going to happen. I also do not grok the error, so I could make the suggested fix in the thread, but then I would be doing something without actually knowing.,

@ingenieroariel
Copy link
Member

I tried the following:

x@sensei /c/m/mobile-nixos (fix/pkg-config-regressions) [1]>
nix-shell -p nix --run "nix-build --version"
nix-build (Nix) 2.3.6
x@sensei /c/m/mobile-nixos (fix/pkg-config-regressions)>
nix-shell -p nix --run "which nix-build"
/nix/store/52d0f2iiwvr5fm8sy18wb0wm8vsp7548-nix-2.3.6/bin/nix-build
x@sensei /c/m/mobile-nixos (fix/pkg-config-regressions)>
nix-shell -p nix --run "nix-build examples/hello --argstr device oneplus-oneplus3 -A build.default"
warning: unknown setting 'experimental-features'
trace: ***************************************
trace: * Evaluating device: oneplus-oneplus3 *
trace: ***************************************
trace: Building with crossSystem?: aarch64-linux != x86_64-linux → we are.
trace:     crossSystem: config: aarch64-unknown-linux-gnu
trace: Building with crossSystem?: aarch64-linux != x86_64-linux → we are.
trace:     crossSystem: config: aarch64-unknown-linux-gnu
these derivations will be built:
  /nix/store/7hq7l8xdrcachkv6dlrf5w75n0vmhbfz-etc-os-release.drv
  /nix/store/h3syk8ghhfnvqilm9x7ldhsrgx9ig41r-nixos-version.drv
  /nix/store/z9w63qplkf5z8xik7713k985c6nkji3l-nixos-container.drv
  /nix/store/xmd0gbl59gij075ylm41m8zrlhfva0ph-system-path.drv
  /nix/store/8a4j8r3lri3hcq4ln1vrzv4jn3la41gm-dbus-1.drv
  /nix/store/6fzs8fmwz5pnmjjfvzmkhiq7sjcc9940-linux-5.4.49-aarch64-unknown-linux-gnu.drv
  /nix/store/agj23y9ax45iw739cxc1dwmd305ixfyv-firmware.drv
  /nix/store/kmg34k3wj7hv85m8dmydrds8klwz3mpy-etc-nixos.conf.drv
  /nix/store/sirbjidkr95wm6kncrd9vvbnzic9z8hs-unit-dbus.service.drv
  /nix/store/wry6r4ig5pp0ar0v852lnxgfb7gq2rsq-user-units.drv
  /nix/store/xh8s0nlpv5my9q3gmnrv5zr1p6qiiqkj-issue.drv
  /nix/store/99hixb3a393nxdnzf7m6d97jwxcdl624-opensc-0.20.0-aarch64-unknown-linux-gnu.drv
  /nix/store/sx5an92v4skdn226s559qrjvmqycr8bb-rng-tools-6.9-aarch64-unknown-linux-gnu.drv
  /nix/store/5gn4kk8kvzy8ny24i2izfnzkch23ns6h-unit-rngd.service.drv
  /nix/store/f7ny98r5symacvcnzmir447ckppp3inh-unit-dbus.service.drv
  /nix/store/gsi9qnf5srhai1kam39wdl81ymclfqi1-unit-systemd-fsck-.service.drv
  /nix/store/zfsjap3gy1126fssaphyg09dm1zxhx58-reload-container.drv
  /nix/store/k4pd3xlqxlz7ryhdfsxvsgpyjqdzaywn-unit-container-.service.drv
  /nix/store/y1x4h07azgjyqc5zan7027vq73nfga23-system-units.drv
  /nix/store/433q06mframfli0ils9gpss0lax2fmsc-etc.drv
  /nix/store/5ib21pxrbjslghr6rrf05ws0xxbv00zb-initrd-oneplus-oneplus3.drv
  /nix/store/imckjry044sy24sbnhszgyq2qlxwgrvj-kernel-modules.drv
  /nix/store/yvg6hg4p38g3gpng763wxyjh82zqw89n-nixos-system-nixos-20.09pre232864.55668eb671b.drv
  /nix/store/ahm3ps9q6s54xi7594mr889xsymssr5g-closure-info.drv
  /nix/store/v561m73m62rwghvx41jgk431x9v7w9dx-mobile-nixos_oneplus-oneplus3_recovery.img.drv
  /nix/store/x4v0zwprhqsd94dp3x3myisdmzffcch6-partition-MOBILE_HELLO.drv
  /nix/store/zsm1717sdyjgg6jgyqkiqm3a2ngmgqgq-initrd-oneplus-oneplus3.drv
  /nix/store/xc569v9plicjiszqvn03ckvlk8p7vaf7-mobile-nixos_oneplus-oneplus3_boot.img.drv
  /nix/store/zbnv2gydbq0m57hqrgydzrab8mz0i46q-android-device-oneplus-oneplus3.drv
error: error: --- BadStorePath --- nix-daemon
path '/nix/store/m589jc4y7cw46bnj4f3pj8dl4wf0xf65-firmware/lib/firmware' is not in the Nix store

@ingenieroariel
Copy link
Member

I also tried the following to no avail (same error)

x@sensei /c/m/mobile-nixos (fix/pkg-config-regressions)> git diff                   
diff --git a/modules/initrd.nix b/modules/initrd.nix
index 954ebfc..fb281eb 100644
--- a/modules/initrd.nix
+++ b/modules/initrd.nix
@@ -74,7 +74,7 @@ let
     (optionals (stage-1 ? contents) (flatten stage-1.contents))
     ++ [
       # Populate /bin/sh to stay POSIXLY compliant.
-      { object = "${extraUtils}/bin/sh"; symlink = "/bin/sh"; }
+      { suffix= "/bin/sh"; object = extraUtils; symlink = "/bin/sh"; }

       # The mostly device-specific configuration for the bootloader.
       { object = bootConfigFile; symlink = "/etc/boot/config"; }
@@ -83,7 +83,7 @@ let
       { object = udevRules; symlink = "/etc/udev/rules.d"; }

       # Init components
-      { object = "${extraUtils}/bin/loader"; symlink = "/loader"; }
+      { suffix= "/bin/loader"; object = extraUtils; symlink = "/loader"; }
       { object = initWrapper; symlink = "/init"; }
       { object = "${mobile-nixos-init}/libexec/init.mrb"; symlink = "/init.mrb"; }
     ]

@ingenieroariel
Copy link
Member

Thanks to @samueldr I got a patch that I could use to compile it on that revision and lead me to a successful boot:

https://gist.github.com/samueldr/da46fe2b234a74daad3735a055fedf50

I tested the hello image and got a mobile nixos logo and a cursor.

@samueldr
Copy link
Member Author

samueldr commented Jul 3, 2020

(The failing CI comes from a weirdness in Nixpkgs, looking into it, but it doesn't affect this PR.)

@samueldr samueldr merged commit 43718f8 into NixOS:master Jul 3, 2020
@samueldr samueldr deleted the fix/pkg-config-regressions branch July 3, 2020 20:35
@samueldr samueldr added 4. type: regression Something stopped working 4. type: bug Something isn't working labels Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. type: bug Something isn't working 4. type: regression Something stopped working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

early-boot-gui-2020-02-05-aarch64-unknown-linux-gnu.drv' failed with exit code 2
2 participants