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

nix 2.4: include lowdown in both buildInputs and nativeBuildInputs. #107163

Closed
wants to merge 2 commits into from

Conversation

Gaelan
Copy link
Contributor

@Gaelan Gaelan commented Dec 18, 2020

Motivation for this change

Lowdown is both called at compile time and statically linked into the nix binary, so we need both when cross-compiling.

With this, nix-build . --arg system '"aarch64-linux"' --arg crossSystem '(import ./. {}).lib.systems.examples.raspberryPi' -A nixFlakes works and produces aarch32 binaries that seem to run fine (on the 64-bit build machine, at least - I haven't tried an actual 32-bit ARM processor).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Lowdown is both called at compile time and statically linked into
the nix binary, so we need both when cross-compiling.
@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Dec 18, 2020
@ofborg ofborg bot requested a review from edolstra December 20, 2020 01:11
@symphorien
Copy link
Member

How about adding strictDeps = true to prevent future regressions of this kind?

@Gaelan
Copy link
Contributor Author

Gaelan commented Dec 20, 2020

I'm not sure that would help. As I understand it, strictDeps makes sure nothing in nativeBuildInputs ends up in the closure; nix statically links to lowdown, so it wouldn't get caught by strictDeps.

@symphorien
Copy link
Member

It does more than that: if I add strictDeps = true to nixpkgs without your patch, nixUnstable fails to build:

src/nix/markdown.cc:7:10: fatal error: lowdown.h: No such file or directory
    7 | #include <lowdown.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [mk/patterns.mk:3: src/nix/markdown.o] Error 1
make: *** Waiting for unfinished jobs....
builder for '/nix/store/y3l65349zf332vh1mjbxijxldfhxqm2z-nix-2.4pre20201118_79aa7d9.drv' failed with exit code 2
error: build of '/nix/store/y3l65349zf332vh1mjbxijxldfhxqm2z-nix-2.4pre20201118_79aa7d9.drv' failed

@Gaelan
Copy link
Contributor Author

Gaelan commented Dec 20, 2020

Ah, neat! Added.

@SuperSandro2000
Copy link
Member

Closing in davor of #107909

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 sort platform than than they will be run on 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants