snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 37 forks source link

ghctags fails to configure, Cabal not installed #214

Closed centromere closed 8 years ago

centromere commented 8 years ago
root@4275737668ba:/tmp/foo/ghc# ./inplace/bin/ghc-pkg list
/tmp/foo/ghc/inplace/lib/package.conf.d
    array-0.5.1.0
    base-4.9.0.0
    binary-0.8.2.0
    bytestring-0.10.7.0
    containers-0.5.7.1
    deepseq-1.4.2.0
    directory-1.2.5.1
    filepath-1.4.1.0
    ghc-8.1
    ghc-boot-8.1
    ghc-prim-0.5.0.0
    ghci-8.1
    haskeline-0.7.2.2
    hoopl-3.10.2.1
    hpc-0.6.0.3
    integer-gmp-1.0.0.1
    pretty-1.1.3.2
    process-1.4.2.0
    rts-1.0
    template-haskell-2.11.0.0
    terminfo-0.4.0.2
    time-1.6
    transformers-0.5.2.0
    unix-2.7.2.0
root@4275737668ba:/tmp/foo/ghc# ./shake-build/build.sh --flavour=quick
[82 of 91] Compiling Rules.Cabal      ( /tmp/foo/ghc/shake-build/src/Rules/Cabal.hs, /tmp/foo/ghc/shake-build/.shake/Rules/Cabal.o ) [Distribution.Verbosity changed]
[90 of 91] Compiling Rules            ( /tmp/foo/ghc/shake-build/src/Rules.hs, /tmp/foo/ghc/shake-build/.shake/Rules.o ) [Rules.Cabal changed]
[91 of 91] Compiling Main             ( /tmp/foo/ghc/shake-build/src/Main.hs, /tmp/foo/ghc/shake-build/.shake/Main.o ) [Rules changed]
Linking /tmp/foo/ghc/shake-build/.shake/build ...
Reading shake-build/cfg/system.config...
Reading package dependencies...
Reading .build/stage0/utils/ghc-cabal/package-data.mk...
Reading .build/stage1/rts/package-data.mk...
Reading .build/stage0/libraries/binary/package-data.mk...
Reading .build/stage0/libraries/Cabal/Cabal/package-data.mk...
Reading .build/stage0/libraries/ghc-boot/package-data.mk...
Reading .build/stage0/libraries/terminfo/package-data.mk...
Reading .build/stage0/utils/ghc-pkg/package-data.mk...
Reading dependencies from .build/stage0/libraries/terminfo/.dependencies...
Reading dependencies from .build/stage0/libraries/ghc-boot/.dependencies...
Reading dependencies from .build/stage0/libraries/binary/.dependencies...
Reading dependencies from .build/stage0/libraries/Cabal/Cabal/.dependencies...
Reading dependencies from .build/stage0/utils/ghc-pkg/.dependencies...
Reading .build/stage0/libraries/hoopl/package-data.mk...
Reading .build/stage0/libraries/hpc/package-data.mk...
Reading .build/stage0/libraries/template-haskell/package-data.mk...
Reading .build/stage0/libraries/transformers/package-data.mk...
Reading .build/stage0/compiler/package-data.mk...
Reading .build/stage0/ghc/package-data.mk...
Reading dependencies from .build/stage0/libraries/transformers/.dependencies...
Reading dependencies from .build/stage0/libraries/template-haskell/.dependencies...
Reading dependencies from .build/stage0/libraries/hpc/.dependencies...
Reading .build/stage0/utils/hsc2hs/package-data.mk...
Reading dependencies from .build/stage0/utils/hsc2hs/.dependencies...
Reading dependencies from .build/stage0/libraries/hoopl/.dependencies...
Reading dependencies from .build/stage0/compiler/.dependencies...
Reading dependencies from .build/stage0/ghc/.dependencies...
Reading .build/stage1/libraries/ghc-prim/package-data.mk...
Reading .build/stage1/libraries/integer-gmp/package-data.mk...
Reading .build/stage1/libraries/base/package-data.mk...
Reading .build/stage1/libraries/array/package-data.mk...
Reading .build/stage1/libraries/deepseq/package-data.mk...
Reading .build/stage1/libraries/bytestring/package-data.mk...
Reading .build/stage1/libraries/containers/package-data.mk...
Reading .build/stage1/libraries/filepath/package-data.mk...
Reading .build/stage1/libraries/time/package-data.mk...
Reading .build/stage1/libraries/unix/package-data.mk...
Reading .build/stage1/libraries/directory/package-data.mk...
Reading .build/stage1/libraries/binary/package-data.mk...
Reading .build/stage1/libraries/ghc-boot/package-data.mk...
Reading .build/stage1/libraries/pretty/package-data.mk...
Reading .build/stage1/libraries/template-haskell/package-data.mk...
Reading .build/stage1/libraries/transformers/package-data.mk...
Reading .build/stage1/libraries/ghci/package-data.mk...
Reading .build/stage1/libraries/hoopl/package-data.mk...
Reading .build/stage1/libraries/hpc/package-data.mk...
Reading .build/stage1/libraries/process/package-data.mk...
Reading .build/stage1/compiler/package-data.mk...
Reading .build/stage1/libraries/terminfo/package-data.mk...
Reading .build/stage1/libraries/haskeline/package-data.mk...
Reading .build/stage1/ghc/package-data.mk...
Reading dependencies from .build/stage1/libraries/unix/.dependencies...
Reading dependencies from .build/stage1/libraries/base/.dependencies...
Reading dependencies from .build/stage1/libraries/time/.dependencies...
Reading dependencies from .build/stage1/libraries/bytestring/.dependencies...
Reading dependencies from .build/stage1/libraries/transformers/.dependencies...
Reading dependencies from .build/stage1/libraries/deepseq/.dependencies...
Reading dependencies from .build/stage1/libraries/terminfo/.dependencies...
Reading dependencies from .build/stage1/libraries/template-haskell/.dependencies...
Reading dependencies from .build/stage1/libraries/ghc-boot/.dependencies...
Reading dependencies from .build/stage1/libraries/pretty/.dependencies...
Reading dependencies from .build/stage1/rts/.dependencies...
Reading .build/stage0/utils/genapply/package-data.mk...
Reading dependencies from .build/stage0/utils/genapply/.dependencies...
Reading .build/stage0/utils/deriveConstants/package-data.mk...
Reading dependencies from .build/stage0/utils/deriveConstants/.dependencies...
Executable found: make => /usr/bin/make
Reading dependencies from .build/stage1/libraries/process/.dependencies...
Reading dependencies from .build/stage1/libraries/integer-gmp/.dependencies...
Reading dependencies from .build/stage1/libraries/ghc-prim/.dependencies...
Executable found: patch => /usr/bin/patch
Reading dependencies from .build/stage1/libraries/hpc/.dependencies...
Reading dependencies from .build/stage1/libraries/filepath/.dependencies...
Reading dependencies from .build/stage1/libraries/containers/.dependencies...
Reading dependencies from .build/stage1/libraries/hoopl/.dependencies...
Reading dependencies from .build/stage1/libraries/haskeline/.dependencies...
Reading dependencies from .build/stage1/libraries/directory/.dependencies...
Reading dependencies from .build/stage1/libraries/ghci/.dependencies...
Reading dependencies from .build/stage1/libraries/binary/.dependencies...
Reading dependencies from .build/stage1/libraries/array/.dependencies...
Reading .build/stage0/utils/genprimopcode/package-data.mk...
Reading dependencies from .build/stage0/utils/genprimopcode/.dependencies...
Reading dependencies from .build/stage1/compiler/.dependencies...
Reading dependencies from .build/stage1/ghc/.dependencies...
Reading .build/stage2/utils/mkUserGuidePart/package-data.mk...
Reading dependencies from .build/stage2/utils/mkUserGuidePart/.dependencies...
/--------------------------------------------------\
| Run GhcCabal (stage = Stage2, package = ghctags) |
|      input: utils/ghctags/ghctags.cabal          |
|  => output: utils/ghctags/stage2/package-data.mk |
\--------------------------------------------------/
Configuring ghctags-0.1...
ghc-cabal: At least the following dependencies are missing:
Cabal >=1.22 && <1.24
shakeArgsWith         0.000s    0%                           
Function shake        0.169s    4%  =                        
Database read         0.778s   20%  =======                  
Database compression  0.309s    7%  ==                       
With database         0.025s    0%                           
Running rules         2.604s   67%  =========================
Total                 3.886s  100%                           
Error when running Shake build system:
* inplace/bin/ghctags
* OracleQ (PackageDataKey (".build/stage2/utils/ghctags/package-data.mk",".build_stage2_utils_ghctags_C_SRCS"))
* .build/stage2/utils/ghctags/package-data.mk
* .build/stage2/utils/ghctags/package-data.mk utils/ghctags/stage2/package-data.mk
user error (Development.Shake.cmd, system command failed
Command: inplace/bin/ghc-cabal configure utils/ghctags stage2  --with-ghc=/tmp/foo/ghc/inplace/bin/ghc-stage2 --with-ghc-pkg=/tmp/foo/ghc/inplace/bin/ghc-pkg --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --configure-option=CFLAGS=-fno-stack-protector --configure-option=CPPFLAGS=-Iincludes -Iincludes/dist-derivedconstants/header --gcc-options=-fno-stack-protector --configure-option=--with-cc=/usr/bin/gcc --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld --with-ar=/usr/bin/ar --with-alex=/opt/alex/3.1.4/bin/alex --with-happy=/opt/happy/1.19.5/bin/happy
Exit code: 1
Stderr:
ghc-cabal: At least the following dependencies are missing:
Cabal >=1.22 && <1.24
)
snowleopard commented 8 years ago
[82 of 91] Compiling Rules.Cabal      ( /tmp/foo/ghc/shake-build/src/Rules/Cabal.hs, /tmp/foo/ghc/shake-build/.shake/Rules/Cabal.o ) [Distribution.Verbosity changed]
[90 of 91] Compiling Rules            ( /tmp/foo/ghc/shake-build/src/Rules.hs, /tmp/foo/ghc/shake-build/.shake/Rules.o ) [Rules.Cabal changed]
[91 of 91] Compiling Main             ( /tmp/foo/ghc/shake-build/src/Main.hs, /tmp/foo/ghc/shake-build/.shake/Main.o ) [Rules changed]

@centromere Do I understand correctly that you are working on the Cabal package? (guessing from Distribution.Verbosity changed).

Also, the previous build must have been unsuccessful, since Cabal is not listed by ghc-pkg list.

It's very hard for me to understand what's going on. Can you do a build clean and try to build again?

centromere commented 8 years ago

I am not working on the Cabal package. I am only testing the build system. Just now I started from a clean build:

/---------------------------------------------------------------------\
| Successfully built program 'mkUserGuidePart' (Stage2).              |
| Executable: inplace/bin/mkUserGuidePart                             |
| Program synopsis: Generate various portions of GHC's documentation. |
\---------------------------------------------------------------------/
/--------------------------------------------------\
| Run GhcCabal (stage = Stage2, package = ghctags) |
|      input: utils/ghctags/ghctags.cabal          |
|  => output: utils/ghctags/stage2/package-data.mk |
\--------------------------------------------------/
Configuring ghctags-0.1...
ghc-cabal: At least the following dependencies are missing:
Cabal >=1.22 && <1.24
shakeArgsWith     0.000s    0%                           
Function shake    0.144s    0%                           
Database read     0.000s    0%                           
With database     0.000s    0%                           
Running rules  2085.326s   99%  =========================
Total          2085.471s  100%                           
Error when running Shake build system:
* inplace/bin/ghctags
* OracleQ (PackageDataKey (".build/stage2/utils/ghctags/package-data.mk",".build_stage2_utils_ghctags_C_SRCS"))
* .build/stage2/utils/ghctags/package-data.mk
* .build/stage2/utils/ghctags/package-data.mk utils/ghctags/stage2/package-data.mk
user error (Development.Shake.cmd, system command failed
Command: inplace/bin/ghc-cabal configure utils/ghctags stage2  --with-ghc=/tmp/foo/ghc/inplace/bin/ghc-stage2 --with-ghc-pkg=/tmp/foo/ghc/inplace/bin/ghc-pkg --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --configure-option=CFLAGS=-fno-stack-protector --configure-option=CPPFLAGS=-Iincludes -Iincludes/dist-derivedconstants/header --gcc-options=-fno-stack-protector --configure-option=--with-cc=/usr/bin/gcc --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld --with-ar=/usr/bin/ar --with-alex=/opt/alex/3.1.4/bin/alex --with-happy=/opt/happy/1.19.5/bin/happy
Exit code: 1
Stderr:
ghc-cabal: At least the following dependencies are missing:
Cabal >=1.22 && <1.24
)

NB: I'm using --flavour=quick

snowleopard commented 8 years ago

This is very strange, I have no idea how the build system could reach stage2 without having built the Cabal library first. It did build inplace/bin/ghc-stage2 somehow -- but that requires Cabal library too!

What happens if you explicitly ask it to build the Cabal library?

build.sh --flavour=quick .build/stage1/libraries/Cabal/Cabal/libHSCabal-1.23.1.0.a

Perhaps, the library is built, but ghc-pkg failed to register it?

NB: I'm using --flavour=quick

That should be fine.

snowleopard commented 8 years ago

To test that ghc-pkg registration works as expected, you could also try the following:

build.sh --flavour=quick inplace/lib/package.conf.d/Cabal-1.23.1.0.conf
centromere commented 8 years ago
/--------------------------------------------------------------------\
| Successfully built library 'Cabal' (Stage1, way v).                |
| Library: .build/stage1/libraries/Cabal/Cabal/libHSCabal-1.23.1.0.a |
| Library synopsis: A framework for packaging Haskell software.      |
\--------------------------------------------------------------------/
shakeArgsWith                        0.000s    0%                           
Function shake                       0.147s    0%                           
Database read                        0.472s    0%                           
With database                        0.023s    0%                           
Running rules                      143.143s   99%  =========================
Pool finished (3431 threads, 1 max)  0.000s    0%                           
Lint checking                        0.059s    0%                           
Total                              143.844s  100%                           
Build completed in 2:24m

After restarting, the build finishes successfully.

snowleopard commented 8 years ago

@centromere Thanks! So, the conclusion seems to be: the Cabal library was deleted after stage2 GHC got built, but before ghctags. I will try to reproduce tomorrow. This looks like a missing dependency somewhere.

centromere commented 8 years ago

This was performed in a stock ubuntu:16.04 docker container.

snowleopard commented 8 years ago

I have difficulties reproducing this exact problem, but discovered a serious bug in the process: #216.

@centromere Can you reproduce the problem? If yes, could you provide the exact steps?

centromere commented 8 years ago

@snowleopard Try doing the following:

docker run -it ubuntu:16.04 /bin/bash
echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 063DAB2BDC0B3F9FCEBC378BFF3AEACEF6F88286
apt-get update
apt-get install -y --no-install-recommends git autoconf g++ file ncurses-dev bzip2 make cabal-install-1.22 ghc-7.10.3 happy-1.19.5 alex-3.1.4
export PATH=/root/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.4/bin:$PATH
cabal update
cabal install --global ansi-terminal mtl shake QuickCheck
git clone --recursive git://git.haskell.org/ghc.git
cd ghc
git clone git://github.com/snowleopard/shaking-up-ghc shake-build
./boot
./configure
./shake-build/build.sh --flavour=quick
root@1bd30ea47f29:/ghc# git submodule status --recursive
 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 .arc-linters/arcanist-external-json-linter (heads/master)
 ec37a68838566cb830c33cb30bfade003a306cff libffi-tarballs (remotes/origin/libffi-3.2.1)
 ecdf65a3c1e01b798e9d073258a6d1c8ff63a6d8 libraries/Cabal (Cabal-1.22.0.0-release-840-gecdf65a)
 fec966e6d77a5e7f4a586de6096954137a1fe914 libraries/Win32 (Win32-2.3.1.0-release-1-gfec966e)
 6551ad9edaca1634a8149ad9c27a72feb456d4e1 libraries/array (v0.5.1.0-9-g6551ad9)
 2afc452571f8176af84c01e47da91ee371bbefbd libraries/binary (0.8.2.0)
 84d041649c39e7dc0fe8d348da10d6ed1679a8f9 libraries/bytestring (0.10.6.0-38-g84d0416)
 aa982fb83f2561d3b27b89b46d36ffca21e072cc libraries/containers (v0.5.7.1-13-gaa982fb)
 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 libraries/deepseq (v1.4.1.1-15-g40d4db0)
 33ce1ca6bef97b60957e4763b046eac9a982ead0 libraries/directory (v1.2.5.1)
 33eb2fb7e178c18f2afd0d537d791d021ff75231 libraries/dph (2009-06-25-1149-g33eb2fb)
 f510e50feefe9995334769dd5e26c79edbe6fdc1 libraries/filepath (v1.4.1.0)
 5e53651b2683f31bf5efc842c33f07afc05ec287 libraries/haskeline (0.7.2.2-7-g5e53651)
 b4477e825a93373124ec5cf29b9850df9608f5bd libraries/hoopl (v3.10.2.1)
 17c3771e42e64ecda8970e8d6bea5c7e7fe1a4d6 libraries/hpc (v0.6.0.2-14-g17c3771)
 ec04d059b13fc348789d87adfbabb9351f8574db libraries/parallel (v3.2.0.6-13-gec04d05)
 9fd5f2b596bdfbce0414f973009b579d5d2430fa libraries/pretty (pretty-1.1.3.2-release)
 1af89788d5c9ab7a0a93ff6764e1770e6c80d957 libraries/primitive (primitive-0.5.2.1-release-58-g1af8978)
 296cbce6294316d6534b4449fc7ab0f0d3f5775b libraries/process (v1.4.1.0-9-g296cbce)
 c72dd0a01ae6255bead2d4fad33f002bb5684030 libraries/random (v1.1-9-gc72dd0a)
 ee756000fc654a105ff3f8a319b904f2df33c65b libraries/stm (v2.4.4.1-4-gee75600)
 140ca44db6fc734cfc0388e82f9e5270f31475d8 libraries/terminfo (0.4.0.2)
 a73564c366b15f7057b614188662d7b7a8eaab19 libraries/time (time-1.6-release-6-ga73564c)
 10348c4bbf60debbfc82463e1035aca1cb7b51bc libraries/transformers (0_5_2_0)
 861ad256e0a5337a1a685b1cd50ae91ee9374cab libraries/unix (v2.7.1.0-52-g861ad25)
 6c17dd6fadc5e7e3e09f7892380ce1339f296efd libraries/vector (0_7-245-g6c17dd6)
 fb9e0bbb69e15873682a9f25d39652099a3ccac1 libraries/xhtml (3000.2.1)
 a5995850221d2808cf3f71965f0e8df0f2908ca1 nofib (2009-06-25-233-ga599585)
 ab954263a793d8ced734459d6194a5d89214b66c utils/haddock (haddock-2.16.1-release-473-gab95426)
 d9c13cb8f5be89a030783d758fcf7c077351c6a9 utils/hsc2hs (2009-06-25-94-gd9c13cb)
snowleopard commented 8 years ago

I'm closing this, as I couldn't reproduce the issue. The build system has changed quite a bit, so this could be no longer relevant. Feel free to reopen if the issue reoccurs.