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

hadrian does not notice submodule update somehow #490

Closed nh2 closed 6 years ago

nh2 commented 6 years ago

Today I had a problem where after switching from commit https://github.com/ghc/ghc/commit/6f0df84a1a (on top of GHC 8.2.2) to commit https://github.com/ghc/ghc/commit/0fa8aeccce (on top of current 8.4 HEAD), I got the error:

Error when running Shake build system:
* _build/stage1/libraries/pretty/libHSpretty-1.1.3.5.a
* _build/stage1/libraries/pretty/Text/PrettyPrint/Annotated/HughesPJ.o
* _build/stage1/libraries/pretty/Text/PrettyPrint/Annotated/HughesPJ.o _build/stage1/libraries/pretty/Text/PrettyPrint/Annotated/HughesPJ.hi
user error (Development.Shake.cmd, system command failed
Command: inplace/bin/ghc-stage1.exe -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db "-this-unit-id pretty-1.1.3.5" "-package-id base-4.11.0.0" "-package-id deepseq-1.4.3.0" "-package-id ghc-prim-0.5.2.0" -i -i_build/stage1/libraries/pretty -i_build/stage1/libraries/pretty/build/autogen -ilibraries/pretty/src -Iincludes -I_build/generated -I_build/stage1/libraries/pretty -IC:/Users/IEUser/ghc/libraries/base/include -IC:/Users/IEUser/ghc/libraries/integer-gmp/include -IC:/Users/IEUser/ghc/_build/stage1/rts -IC:/Users/IEUser/ghc/includes -IC:/Users/IEUser/ghc/_build/generated -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/libraries/pretty/build/autogen/cabal_macros.h -optc-fno-stack-protector -odir _build/stage1/libraries/pretty -hidir _build/stage1/libraries/pretty -stubdir _build/stage1/libraries/pretty -Werror -Wnoncanonical-monad-instances -optc-Wno-error=inline -c libraries/pretty/src/Text/PrettyPrint/Annotated/HughesPJ.hs -o _build/stage1/libraries/pretty/Text/PrettyPrint/Annotated/HughesPJ.o -O2 -H32m -Wall -fwarn-tabs -XHaskell98 -XCPP -XBangPatterns -XDeriveGeneric -Wno-deprecated-flags -Wno-unused-imports
Exit code: 1
Stderr:
libraries\pretty\src\Text\PrettyPrint\Annotated\HughesPJ.hs:454:28: error:
    Ambiguous occurrence `<>'
    It could refer to either `Semi.<>',
                             imported from `Prelude' at libraries\pretty\src\Text\PrettyPrint\Annotated\HughesPJ.hs:25:8-42
                             (and originally defined in `GHC.Base')
                          or `Text.PrettyPrint.Annotated.HughesPJ.<>',
                             defined at libraries\pretty\src\Text\PrettyPrint\Annotated\HughesPJ.hs:678:3
    |
454 | quotes p       = char '\'' <> p <> char '\''
    |                            ^^

which really looks like some old (submodule?) code is being used instead of the latest contents (I checked all submodules are up to date).

Running clean with Hadrian didn't help.

Only git clean -fdx helped.

Here's the full build output from my terminal (on mingw64 WIndows): hadrian-old-library-problem.txt

snowleopard commented 6 years ago

Hmm, I don't understand how this can possibly happen. Hadrian does not interact with git files in any way. It only looks at GHC files and at build artefacts in _build, so it's not different from Make in this respect.

Running clean with Hadrian didn't help.

You shouldn't need to run clean after manipulating the source tree with git -- Hadrian is designed to reuse as much of the previous build as possible.

@nh2 Could you give me a precise list of commands to reproduce this problem?

nh2 commented 6 years ago

it's not different from Make in this respect.

I don't know if this problem would occur with make, maybe it would happen there too?

Could you give me a precise list of commands to reproduce this problem?

Unfortunately the best I can provide is to run hadrian/build.stack.sh -j --configure --flavour=quickest inplace/bin/ghc-stage2.exe +RTS -qg on https://github.com/ghc/ghc/commit/6f0df84a1a, then to checkout https://github.com/ghc/ghc/commit/0fa8aeccce, git submodule update --init, and run the build command again (all on Windows).

You shouldn't need to run clean after manipulating the source tree with git -- Hadrian is designed to reuse as much of the previous build as possible.

I agree, that's why I'm filing it :)

snowleopard commented 6 years ago

I have a feeling this is somehow related to changing Hadrian from git subtree to git submodule, which happened a few days ago.

nh2 commented 6 years ago

@snowleopard I think my commits are slightly too old for that, might not contain that change yet in their history.

snowleopard commented 6 years ago

@nh2 Trying to checkout the commit in question but getting strange errors:

$ git checkout 6f0df84a1ae56d29cc4bdf43af9421b735d025c5
fatal: reference is not a tree: 6f0df84a1ae56d29cc4bdf43af9421b735d025c5

$ git reset --hard 6f0df84a1ae56d29cc4bdf43af9421b735d025c5
fatal: Could not parse object '6f0df84a1ae56d29cc4bdf43af9421b735d025c5'.

I feel very dumb asking this but: what am I doing wrong? Maybe it's time to get some sleep :)

nh2 commented 6 years ago

@snowleopard They are in my git remote.

git remote add nh2github git@github.com:nh2/ghc.git
git fetch nh2github
snowleopard commented 6 years ago

@nh2 Aha, I see, thanks! Running out of time today -- will try to look into this soon.

snowleopard commented 6 years ago

I couldn't reproduce this, so closing. My impression is that was a git issue, not Hadrian -- please reopen if I'm wrong.