-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
Make GHC work on armv7l-linux #33405
Conversation
Here is an update on the status of this PR: I am able to build As it's a segfault, I assume the compile is running out of memory. Before this last attempt, I bumped the swap on my Jetson TK1 up to 2GB (so 4GB total including RAM), but that did not help. I will now try to reduce the number of concurrent jobs to 2, which will slow things down quite a bit but will hopefully address this issue and get the build to finish. In any case, I think these changes are ready to merge -- they do not affect other platforms and are sufficient to get The main thing is that I would like to get these changes committed before more of the cross-compile stuff hits @peti can you please have a look? |
Oh no, I didn't review this in time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhess might you have any time to change these accordingly?
@@ -43,6 +43,7 @@ stdenv.mkDerivation rec { | |||
or (throw "cannot bootstrap GHC on this platform")); | |||
|
|||
nativeBuildInputs = [ perl ]; | |||
buildInputs = stdenv.lib.optionals stdenv.isArm [ llvm_35 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdenv.targetPlatform.isArm
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec { | |||
./relocation.patch | |||
]; | |||
|
|||
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ]; | |||
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ] ++ stdenv.lib.optionals stdenv.isArm [ llvm_35 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetPlatform.isArm
@@ -46,7 +46,7 @@ stdenv.mkDerivation (rec { | |||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk | |||
''; | |||
|
|||
buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ]; | |||
buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ] ++ stdenv.lib.optionals (stdenv.isArm || stdenv.isAarch64) [ llvm_39 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(targetPlatform.isArm || targetPlatform.isAarch64)
@@ -46,6 +46,7 @@ stdenv.mkDerivation rec { | |||
or (throw "cannot bootstrap GHC on this platform")); | |||
|
|||
nativeBuildInputs = [ perl ]; | |||
buildInputs = stdenv.lib.optionals (stdenv.isArm || stdenv.isAarch64) [ llvm_39 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(with stdenv.targetPlatform; isArm || isAarch64)
@@ -130,7 +130,7 @@ let | |||
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") | |||
(optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES") | |||
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") | |||
(enableFeature (enableDeadCodeElimination && (versionAtLeast "8.0.1" ghc.version)) "split-objs") | |||
(enableFeature (enableDeadCodeElimination && !stdenv.isArm && !stdenv.isAarch64 && (versionAtLeast "8.0.1" ghc.version)) "split-objs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(hostPlatform.isArm || hostPlatform.isAarch64)
@Ericson2314 Yes, of course. I figured there would be cross fixes coming down the pipe. |
@dhess Thanks! Yeah just would to confirm those additions will work for you. Then, when I land the cross stuff it will be one fewer likely regression :). |
@Ericson2314 It might take me a day or two to get to this (because that is roughly the turnaround time on GHC builds for |
@Ericson2314 PR made, see #33733. Please review and make sure I didn't miss something. |
Motivation for this change
Get GHC working on
armv7l-linux
Things done
master
onarmv7l-linux
is currently broken due to #33403, so I can't test this yet onmaster
, but it is currently building on thenixos-unstable-small
channel. I will update this PR when I can make progress onmaster
, but these changes are straightforward and only affect ARM builds.Note that in a few places there are fixes that are also obviously needed for
aarch64-linux
(e.g., LLVM support), but these patches do not addressaarch64-linux
in general as there is more work needed to bootstrap that platform due to GHC 7.10.3 and 8.0.2 dependencies in the toolchain for building 8.2.2.There will also inevitably be more
haskellPackages
fixes needed forarmv7l-linux
(usually adontCheck
here and there, in my experience with my own GHC ARM overlay), but I will tackle those as they come up, as compiling even a small subset ofhaskellPackages
onarmv7l-linux
is a multi-day effort.build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)