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

Various small crossDrv fixes #24871

Merged
merged 4 commits into from Apr 15, 2017
Merged

Various small crossDrv fixes #24871

merged 4 commits into from Apr 15, 2017

Conversation

elitak
Copy link
Contributor

@elitak elitak commented Apr 13, 2017

Motivation for this change

Fixed and tested for armv5 cross builds.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@elitak, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @vcunat and @DavidEGrayson to be potential reviewers.

@elitak
Copy link
Contributor Author

elitak commented Apr 13, 2017

I have more mass-rebuild triggering cross-build fixes to glibc, gcc, etc that I've yet to stage. Should I make an effort to include them all here at once?

@dezgeg
Copy link
Contributor

dezgeg commented Apr 13, 2017

As far as I can see, none of these actually cause mass rebuilds (for non-cross packages). So better to get them separately.

@DavidEGrayson
Copy link
Contributor

DavidEGrayson commented Apr 13, 2017

In the coreutils package, I'm pretty sure you can simplify stdenv.ccCross.libc or {} ? libiconv to stdenv.ccCross ? libc.libiconv.

For kmod, I assume the reason you had to add the native xz to the front of the path was so you could hide the cross-built xz. I am kind of surprised that cross-built inputs have their binaries added to the PATH. Seems like you would almost never want that, and fixing the root of that problem in another pull request would be cool.

Overall, the pull request seems fine to me.

I'm not the best person to review this though, @Ericson2314 would be better.

@elitak
Copy link
Contributor Author

elitak commented Apr 13, 2017

I made the coreutils change.

Stdenv does need some rework to fix the general issue of having its PATH clobbered by crossDrv buildInputs. I've already opened an issue for this, but didn't get any input. I've just now added some proposals for fixing the issue: #21191

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Right idea, but in 2 places there's a more idiomatic way to acomplish the same thing --- sorry these idioms aren't very obvious in the future it should be better.

@@ -66,6 +66,6 @@ runCommand name
passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else null;
}
''
${perl}/bin/perl -w ${./builder.pl}
${perl.nativeDrv or perl}/bin/perl -w ${./builder.pl}
Copy link
Member

Choose a reason for hiding this comment

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

Use buildPackages.perl.

@@ -14,13 +14,17 @@ in stdenv.mkDerivation rec {
};

nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ];
buildInputs = [ xz /* zlib */ ];
buildInputs = [ xz ];
Copy link
Member

Choose a reason for hiding this comment

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

Use nativeBuildInputs = [ xz ] and no crossAttrs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This derivation requires liblzma.so from xz.crossDrv.out, so I don't think that will work.

@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
++ optional aclSupport acl.crossDrv
++ optional attrSupport attr.crossDrv
++ optionals selinuxSupport [ libselinux.crossDrv libsepol.crossDrv ]
++ optional (stdenv.ccCross.libc ? libiconv)
++ optional (stdenv.ccCross or {} ? libc.libiconv)
Copy link
Member

Choose a reason for hiding this comment

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

Nice trick :)

Copy link
Member

Choose a reason for hiding this comment

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

@DavidEGrayson's is nice too. I have no idea whether it works. These sort of "utility attrs" aren't very consistent in nixpkgs, sadly.

Copy link
Contributor

Choose a reason for hiding this comment

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

The or {} part is not needed. If you think ccCross might not exist, you can do:

stdenv ? ccCross.libc.libiconv

I think that is just part of Nix syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't really remember, but I think the issue I originally ran into was that some part of that expression had a null instead of just being absent, so that's what I came up with. I don't think I had considered putting more than 0 dots on the rhs of the ?, though. I will just go with your last suggestion, if it works.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the Nix or operator doesn't help you when an attribute is set to null, unlike the "or" operations in a lot of other languages. The or is just used to specify a backup value in case the attribute path you specified to the left cannot be evaluated because one of the attributes is missing. Anyway, I'm sure you are able to play around with it and find a simple expression that works.

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 13, 2017

@DavidEGrayson

I am kind of surprised that cross-built inputs have their binaries added to the PATH. Seems like you would almost never want that, and fixing the root of that problem in another pull request would be cool.

Right this is aweful and should indeed be fixed, but would cause a mass rebuild.

@elitak
In general I have a huge number of native-hash-preserving changes to merge for cross, and then some mass rebuild ones too. It would be great to coordinate on this :). See https://github.com/obsidiansystems/nixpkgs/tree/ghc-android for the backlog of native-hash-preserving changes---good things most of those near-100 commits subsume previous ones!

@elitak
Copy link
Contributor Author

elitak commented Apr 13, 2017

@Ericson2314, your branch's commits subsume commits from what branch? Do you mean you want to coordinate the native-mass-rebuild-triggering changes? I've got some small (but crucial to crossDrv) changes to glibc, I think, as well as some fixing the very broken mingw32 target platforms. I'll try to extricate these from my backlog and make it my next PR.

Also take a look at the proposals on issue #21191 and tell me which you feel is best and I may PR a fix.

@DavidEGrayson
Copy link
Contributor

DavidEGrayson commented Apr 13, 2017

Ooh, feel free to mention me with an @-sign when you make pull requests about cross-compiling for MinGW. I've done a lot of work in that area on a separate project.

@elitak elitak force-pushed the cross-staging branch 2 times, most recently from 27d52ea to 6d4ad0c Compare April 15, 2017 00:45
@elitak
Copy link
Contributor Author

elitak commented Apr 15, 2017

Okay, I think everything has been addressed and tested now.

@Ericson2314 Ericson2314 merged commit 3bff114 into NixOS:master Apr 15, 2017
@Ericson2314
Copy link
Member

@elitak I mean most of those commits canned squashed as they are themselves broken and fixed by later commits. That makes the overall doff not so bad.

And yeah, I want to first merge my "platform normalization PR", second rebase that non-breaking "ghc-android" branch, and third do the mass rebuild. If you have anything to stage with any of those three, I'm all ears! :)

The first should be very interesting for you because windows target triples are subtle and I do not yet handle that complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants