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 39 forks source link

cannot install module check-ppr : linker error #593

Closed chitrak7 closed 6 years ago

chitrak7 commented 6 years ago

I tried to install the program check-ppr and check-api-annotations for validation purposes. Although the later was installed smoothely, check-ppr is not getting installed. the error code and stderr is: user error (Development.Shake.cmd, system command failed Command: _build/stage0/bin/ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-package-id Cabal-2.3.0.0' '-package-id base-4.12.0.0' '-package-id bytestring-0.10.8.2' '-package-id containers-0.5.11.0' '-package-id directory-1.3.2.3' '-package-id filepath-1.4.2' '-package-id ghc-8.5' -i -i_build/stage1/utils/check-ppr/build -i_build/stage1/utils/check-ppr/build/check-ppr/autogen -iutils/check-ppr/. -Iincludes -I_build/generated -I_build/stage1/utils/check-ppr/build -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/ghc-8.5/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/process-1.6.3.0/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/unix-2.8.0.0/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/time-1.8.0.2/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/bytestring-0.10.8.2/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/base-4.12.0.0/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/integer-gmp-1.0.2.0/include -I/home/chitrak/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180508/rts-1.0/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/utils/check-ppr/build/check-ppr/autogen/cabal_macros.h -optc-fno-stack-protector -odir _build/stage1/utils/check-ppr/build -hidir _build/stage1/utils/check-ppr/build -stubdir _build/stage1/utils/check-ppr/build -no-auto-link-packages -no-hs-main -optl-lgmp -Wnoncanonical-monad-instances -optc-Werror=unused-but-set-variable -optc-Wno-error=inline _build/stage1/utils/check-ppr/build/Main.o -o _build/stage1/bin/check-ppr -O2 -H32m -Wall -XHaskell2010 -ghcversion-file=/home/chitrak/ghc/_build/generated/ghcversion.h Exit code: 1 Stderr: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o:function _start: error: undefined reference to 'main' collect2: error: ld returned 1 exit status gcc' failed in phaseLinker'. (Exit code: 1) )

chitrak7 commented 6 years ago

@snowleopard @izgzhen can you try to install these modules directly to confirm these errors. We will need to create the package in GHC/Packages.hs and then add it to stage1packages for testing.

snowleopard commented 6 years ago

@chitrak7 I'll try to reproduce soon. I'm currently travelling, so it's difficult to find time.

izgzhen commented 6 years ago

I'll help check this in one or two hours :)

izgzhen commented 6 years ago

@chitrak7 what steps do I need to execute to reproduce this?

chitrak7 commented 6 years ago

@izgzhen We have to first add check-ppr to known packages to GHC. In GHC/Packages.hs add: checkPpr = hsUtil "check-ppr" setPath "utils/check-ppr" Then for trial, we can simply add checkPpr to stage1Packages. On running build, the given error occurs.

snowleopard commented 6 years ago

In the above PR I've added checkPpr package and some infrastructure for testsuite packages.

Now I can build checkPpr simply by running Hadrian with the target _build/stage1/bin/check-ppr.exe.

@chitrak7 Let me know if you still have the link error.

chitrak7 commented 6 years ago

checkPpr built successfully. Thanks!!!

snowleopard commented 6 years ago

@chitrak7 Awesome, thanks!