Opened 8 years ago

Closed 8 years ago

Last modified 15 months ago

#5706 closed bug (fixed)

building ghc from source tarball requires alex?

Reported by: kosmikus Owned by:
Priority: high Milestone: 7.4.1
Component: Build System (make) Version: 7.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Building a recent GHC snapshot via my usual Nix expression for doing this resulted in an error:

building utils/haddock/dist/
"inplace/bin/ghc-cabal" configure --with-ghc="/tmp/nix-build-j66qzyg325kggqaj69vmmfgvq54cg83y-ghc-7.3.20111212.drv-0/ghc-7.3.20111212/inplace/bin/ghc-stage1" --with-ghc-pkg="/tmp/nix-build-j66qzyg325kggqaj69vmmfgvq54cg83y-ghc-7.3.20111212.drv-0/ghc-7.3.20111212/inplace/bin/ghc-pkg" --flag in-ghc-tree --enable-library-profiling --enable-shared --enable-library-for-ghci --configure-option=CFLAGS=" -fno-stack-protector  " --configure-option=LDFLAGS=" -Wl,--hash-size=31 -Wl,--reduce-memory-overheads  " --configure-option=CPPFLAGS="   " --with-gcc="/nix/store/2yghakb86zfivd2da4x1ipcz03xmz6rd-gcc-wrapper-4.5.1/bin/gcc" --configure-option=--with-cc="/nix/store/2yghakb86zfivd2da4x1ipcz03xmz6rd-gcc-wrapper-4.5.1/bin/gcc" --with-ar="/nix/store/9b3q62czfh5zld9zg2p8sbk65hkbvpzi-binutils-2.21/bin/ar" --with-ranlib="true" -- dist utils/haddock
Configuring haddock-2.9.4...
ghc-cabal: The program alex version >=2.3 is required but it could not be
make[1]: *** [utils/haddock/dist/] Error 1
[qmake: *** [all] Error 2
[q[q[qbuilder for `/nix/store/j66qzyg325kggqaj69vmmfgvq54cg83y-ghc-7.3.20111212.drv' failed; keeping build directory `/tmp/nix-build-j66qzyg325kggqaj69vmmfgvq54cg83y-ghc-7.3.20111212.drv-0'
builder for `/nix/store/j66qzyg325kggqaj69vmmfgvq54cg83y-ghc-7.3.20111212.drv' failed with exit code 2
cannot build derivation `/nix/store/gmllr5nfxlxw2cfvmvfymk3y6q9qzdlv-ghc-7.3.20111212-wrapper.drv': 1 dependencies couldn't be built
error: build of `/nix/store/gmllr5nfxlxw2cfvmvfymk3y6q9qzdlv-ghc-7.3.20111212-wrapper.drv' failed

The requirement for alex seems new. At least I know that the same Nix expression successfully built older (i.e., 7.1) snapshots. Is alex really required to build from a source tarball?

Change History (4)

comment:1 Changed 8 years ago by simonmar

difficulty: Unknown
Milestone: 7.4.1
Priority: normalhigh

Alex should not be required for building from source, this is indeed a bug. I'm not sure what could have changed though.

comment:2 Changed 8 years ago by kosmikus

It actually seems to require both alex and happy. The build succeeded once I added both packages to the build inputs.

comment:3 Changed 8 years ago by igloo

Resolution: fixed
Status: newclosed

I believe this is fixed by changeset:505df72e9e0962e01cf031f799d8d8940ced73b1

Author: Ian Lynagh <>
Date:   Sun Dec 18 12:56:16 2011 +0000

    Fix (untested) building from source tarball without alex/happy

    haddock's .cabal file was declaring that it needed alex and happy to
    build, but in the GHC source tarballs it doesn't.

Please reopen if you still have problems.

comment:4 Changed 15 months ago by bgamari

Component: Build SystemBuild System (make)

The new Hadrian build system has been merged. Relabeling the tickets concerning the legacy make build system to prevent confusion.

Note: See TracTickets for help on using tickets.