Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,410
    • Issues 5,410
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 604
    • Merge requests 604
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20131
Closed
Open
Issue created Jul 19, 2021 by Ben Gamari@bgamari🐢Maintainer

Darwin use of nix is too unpredictable

Currently GHC's CI infrastructure relies on nix on Darwin to provide the native toolchain, GHC, and associated build dependencies. While convenient, it is not convinced that this configuration provides us with the environment that a non-Nix Darwin user would see. For instance,

$ cat > toolchain.nix <<EOF
let
  sources = import ./nix/sources.nix;
  #nixpkgsSrc = sources.nixpkgs;
  nixpkgsSrc = <nixpkgs>;
  #nixpkgsSrc = /Users/administrator/nixpkgs;
  aarch64Pkgs = import nixpkgsSrc { system = "aarch64-darwin"; };
  x86Pkgs = import nixpkgsSrc { system = "x86_64-darwin"; };
in

let
  ghcVer = "ghc8105Binary";
  ghc = aarch64Pkgs.haskell.compiler."${ghcVer}";
  alex = hsPkgs.alex;
  happy = hsPkgs.happy;
  hsPkgs = x86Pkgs.haskellPackages;
in

aarch64Pkgs.writeTextFile {
  name = "toolchain";
  text = ''
    export PATH
    PATH="${aarch64Pkgs.autoconf}/bin:$PATH"
    PATH="${aarch64Pkgs.automake}/bin:$PATH"
    PATH="${aarch64Pkgs.clang}/bin:$PATH"
    PATH="${aarch64Pkgs.llvm_11}/bin:$PATH"
    PATH="${aarch64Pkgs.coreutils}/bin:$PATH"
    export HAPPY="${happy}/bin/happy"
    export ALEX="${alex}/bin/alex"
    export GHC="${ghc}/bin/ghc"
    export SPHINX_BUILD="${aarch64Pkgs.python3Packages.sphinx}/bin/sphinx-build"
    export CABAL_INSTALL="${hsPkgs.cabal-install}/bin/cabal"
    export CABAL="$CABAL_INSTALL"
    export CURSES_LIB_DIRS="${aarch64Pkgs.ncurses}/lib"
  '';
}
EOF
$ nix build -I nixpkgs=https://github.com/bgamari/nixpkgs/archive/faf319a81bf.tar.gz -f toolchain.nix
$ source result
$ $CABAL update
$ $CABAL install -w $GHC --lib clock

will fail with a slew of warnings from the system's stdio.h since the clang provided by nixpkgs is incompatible with the system's libc headers, e.g.:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: error:
     warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
                     int (* _Nullable)(void *));

On the other hand, if I drop clang from PATH I rather get assembler errors as the assembler is trying to assemble AArch64 assembly as x86 syntax.

Edited Jul 19, 2021 by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking