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

ghc prebuilt: Add 7.8.4, 7.10.3 and 8.2.1, and make consistent style #29688

Closed
wants to merge 4 commits into from

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Sep 23, 2017

Motivation for this change

I wanted to keep these maintainable, so I slightly tweaked the style to be consistent everywhere. The new ones have relative RPATHs in ghc-cabal and other build-time utilities.

@peti I do have some of the formatting fixes that you were unsure about before, as part of that normalizing style and methodology, so definitely waiting on your approval.

Now that they are pretty close, we could make a common helper, too.

Closes #19926

Things done

I've currently tested x86_64-linux and x86_64-darwin. Darwin succeeds everywhere. The new Linux ones however don't succeed with:

"utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" copy libraries/ghc-prim dist-install "strip" '' '/nix/store/y1na8avj8q7jxw74nzi9xd5hmqdb65dl-ghc-7.10.3-binary' '/nix/store/y1na8avj8q7jxw74nzi9xd5hmqdb65dl-ghc-7.10.3-binary/lib/ghc-7.10.3' '/nix/store/y1na8avj8q7jxw74nzi9xd5hmqdb65dl-ghc-7.10.3-binary/share/doc/ghc/html/libraries' 'v p dyn'  
ghc-cabal: Saved package config file body is corrupt. Try re-running the 'configure' command.
make[1]: *** [ghc.mk:924: install_packages] Error 1
make: *** [Makefile:24: install] Error 2
  • 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 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

CC @cleverca22

@mention-bot
Copy link

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

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

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

I am all for adding the new builds, and I am completely against modifying the existing builds.

{ stdenv
, fetchurl, perl
, libedit, ncurses5, gmp
}:
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe that a consistent style is important for those files and I would prefer to avoid any changes whatsoever in the old compiler builds unless there is a technical reason to make the change. Reformatting whitespace in the argument lists feels pointless to me.

echo compilation ok
[ $(./main) == "yes" ]
'';
dostallCheck = true;
Copy link
Member

Choose a reason for hiding this comment

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

Typo.

@Ericson2314 Ericson2314 changed the base branch from master to staging September 23, 2017 14:57
@peti
Copy link
Member

peti commented Sep 23, 2017

OK, I now realize why consistent-looking build files are useful in the light of the upcoming cross-compilation changes. I completely revert my previous position and am now in favor of it. :-)

@Ericson2314 Ericson2314 force-pushed the ghc-prebuilt branch 4 times, most recently from 1e9d6db to ae243cc Compare September 23, 2017 16:51
@Ericson2314 Ericson2314 changed the title ghc prebuilt: Add 7.8.4 and 7.10.3, and make consistent style ghc prebuilt: Add 7.8.4, 7.10.3 and 8.2.1, and make consistent style Sep 23, 2017
@Ericson2314
Copy link
Member Author

I merged the reformats to master and rebase this (to staging) on top, making it much easier to read.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Sep 23, 2017

7.8.4-binary is still failing on Linux from the type of RPATH problem I tried to avoid, however. Quite tempted to just add the missing functionality to patchelf.

These changes do break hashes, but are good to have everywhere for
consistency. Plus, changing the bootstrap causes a Haskell mass rebuild
anyways.
The newer to-be-added binaries have relative RPATHs that we'll break if
we try to `patchelf` before installation. We instead us LD_LOAD_LIBRARY
during the installation, which avoids needing to change the RPATH
temporarily.
 - Patch all executables and libraries, while skipping scripts. Base at
   least uses libiconv, so should need this too---I suspect it wasn't a
   problem before as we got away with the immpurity.

 - Rather than hardcoding the symlinks to add, do one per mach-o as
   needed

TEMP no -L no script
@dhess
Copy link
Contributor

dhess commented Oct 1, 2017

This is great, and thank you for including the ARM variants! This is better than the hack I devised to do the same for my ARMv7 and aarch64 systems. I'm looking forward to Hydra building aarch64 Haskell packages so I don't have to build them all myself each time I update!

@domenkozar
Copy link
Member

@Ericson2314 happy to test this once it's ready. Good work!

@dhess
Copy link
Contributor

dhess commented Oct 31, 2017

@Ericson2314 Why not take this PR a step further, and use the binary snapshots you've added to bootstrap the non-binary GHC derivations? (See #19926) You've already done the hard part!

@Ericson2314
Copy link
Member Author

Ericson2314 commented Nov 3, 2017

@dhess Well, I haven't completely the hard part because these don't all build! Not sure when I will have time to finish this, so others feel free to push to this.

@domenkozar
Copy link
Member

@nixborg build

@nixborg
Copy link

nixborg commented Dec 25, 2017

@domenkozar is not a committer

@domenkozar
Copy link
Member

@Ericson2314 can you explain a bit more what's going on linux? If I understand correctly it's trying to parse /tmp/nix-build-ghc-7.10.3-binary.drv-7/ghc-7.10.3/libraries/ghc-prim/dist-install/setup-config and fails to do so.

@domenkozar
Copy link
Member

@Ericson2314 following fixes your current error, but resulting $out/bin/ghc still needs patchelfed libs:

$ git diff
diff --git a/pkgs/development/compilers/ghc/7.10.3-binary.nix b/pkgs/development/compilers/ghc/7.10.3-binary.nix
index 1711531fae1..a7a5bd17cfb 100644
--- a/pkgs/development/compilers/ghc/7.10.3-binary.nix
+++ b/pkgs/development/compilers/ghc/7.10.3-binary.nix
@@ -87,9 +87,9 @@ stdenv.mkDerivation rec {

       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
-      for prog in ld ar gcc strip ranlib; do
-        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
-      done
+      #for prog in ld ar gcc strip ranlib; do
+        #find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
+      #done
     '';

   configurePlatforms = [ ];

@domenkozar
Copy link
Member

domenkozar commented Dec 25, 2017

I have all of these building on darwin/linux in #33054

@domenkozar domenkozar closed this Dec 25, 2017
@dhess
Copy link
Contributor

dhess commented Dec 25, 2017

Are there plans to add armv7l-linux and aarch64-linux haskellPackages to the Hydra builds?

@domenkozar
Copy link
Member

@dhess if you want to do the changes, why not :)

@dhess
Copy link
Contributor

dhess commented Dec 31, 2017

@domenkozar Is there a reason that ghc821Binary isn't used to bootstrap ghc822 in 695a026, rather than ghc7103Binary?

Unfortunately, because ghc7103Binary doesn't support aarch64-linux, I believe this means we still can't build Haskell packages for aarch64-linux out of the box.

@domenkozar
Copy link
Member

No good reason, we can bump it.

@dhess
Copy link
Contributor

dhess commented Dec 31, 2017

OK, great. I should have time to work on ARM GHC stuff over the next few days, so I'll try it out locally and submit a PR if someone doesn't beat me to it.

@Ericson2314 Ericson2314 deleted the ghc-prebuilt branch January 1, 2018 23:09
@dhess
Copy link
Contributor

dhess commented Jan 2, 2018

I just fixed a couple of issues that were preventing GHC from bootstrapping on both ARM platforms. I'm now kicking off armv7l-linux and x86_64-linux builds using ghc821Binary as the bootstrap compiler. If that goes well I'll test aarch64-linux and submit a PR.

@Ericson2314
Copy link
Member Author

Sounds good! But make sure you work from Domen's recent work.

@dhess dhess mentioned this pull request Jan 2, 2018
5 tasks
@dhess
Copy link
Contributor

dhess commented Jan 2, 2018

I propose we track GHC on ARM issues in #33353.

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

6 participants