haskell / happy

The Happy parser generator for Haskell
Other
288 stars 84 forks source link

Can't install happy in Windows 10 x86 #119

Closed mcandre closed 6 years ago

mcandre commented 6 years ago

I can install happy in Windows 10 x86_64, and I can install other packages like Shake in Windows 10 x86, however when I try to install happy in Windows 10 x86, I get a strange error.

Trace

PS C:\> choco install -force -y ghc

PS C:> $cabalPath = "C:\Users\vagrant\Application Data\cabal\bin;C:\Users\All Users\chocolatey\lib\cabal\tools\x86"
PS C:\> $env:PATH += ";$cabalPath"
PS C:\> $userPath = (Get-ItemProperty "Registry::HKEY_CURRENT_USER\Environment").PATH
PS C:\> Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Environment" -Name PATH -Value "$userPath;$cabalPath"

PS C:\> cabal install -v happy
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\lib/../mingw/bin\gcc.exe" "-dumpversion"          
looking for tool haddock near compiler in                                                            
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin                                                
found haddock in                                                                                     
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\haddock.exe                                    
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\haddock.exe" "--version"                      
looking for tool hpc near compiler in                                                                
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin                                                
found hpc in C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hpc.exe                           
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hpc.exe" "version"                            
looking for tool hsc2hs near compiler in                                                             
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin                                                
found hsc2hs in                                                                                      
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hsc2hs.exe                                     
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hsc2hs.exe" "--version"                       
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc.exe" "-hide-all-packages" "-c" "C:\Users\v
agrant\AppData\Local\Temp\6540-0.c" "-o" "C:\Users\vagrant\AppData\Local\Temp\6540-1.o"              
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\lib/../mingw/bin\ld.exe" "-x" "-r" "C:\Users\vagra
nt\AppData\Local\Temp\6540-1.o" "-o" "C:\Users\vagrant\AppData\Local\Temp\6540-2.o"                  
looking for tool runghc near compiler in                                                             
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin                                                
found runghc in                                                                                      
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\runghc.exe                                     
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\runghc.exe" "--version"                       
"C:\Program Files\Git\usr\bin\tar.exe" "--help"                                                      
Reading available packages of hackage.haskell.org...                                                 
Using most recent state specified from most recent cabal update                                      
index-state(hackage.haskell.org) = 2018-05-17T01:00:29Z                                              
Failed to query pkg-config, Cabal will continue without solving for pkg-config                       
constraints: dieVerbatim: user error (CallStack (from HasCallStack):                                 
die', called at .\Distribution\Simple\Program\Db.hs:423:28 in                                        
Cabal-2.2.0.1-498b1ffb97317cbfc8432b5b6c862cebeca566be:Distribution.Simple.Program.Db                
requireProgram, called at .\Distribution\Solver\Types\PkgConfigDb.hs:65:21 in                        
main:Distribution.Solver.Types.PkgConfigDb                                                           
cabal: The program 'pkg-config' is required but it could not be found.                               
)                                                                                                    
Resolving dependencies...                                                                            
Number of threads used: 2.                                                                           
Extracting                                                                                           
C:\Users\vagrant\AppData\Roaming\cabal\packages\hackage.haskell.org\happy\1.19.9\happy-1.19.9.tar.gz 
to C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540...                                             
Updating happy.cabal with the latest revision from the index.                                        
Configuring happy-1.19.9...                                                                          
creating                                                                                             
C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup                           
creating C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist                        
creating                                                                                             
C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup                           
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc.exe" "--make" "-fbuilding-cabal-package" "
-odir" "C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup" "-hidir" "C:\User
s\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup" "-i" "-iC:\Users\vagrant\AppData
\Local\Temp\cabal-tmp-6540\happy-1.19.9" "-optP-include" "-optPC:\Users\vagrant\AppData\Local\Temp\ca
bal-tmp-6540\happy-1.19.9\dist\setup\setup_macros.h" "-hide-all-packages" "-package-id" "Cabal-2.2.0.
1" "-package-id" "base-4.11.1.0" "-package-id" "directory-1.3.1.5" "-package-id" "filepath-1.4.2" "C:
\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.hs" "-o" "C:\Users\vag
rant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.exe" "-threaded"                
C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.exe                 
configure --verbose=2 --builddir=dist --ghc                                                          
--prefix=C:\Users\vagrant\AppData\Roaming\cabal                                                      
--bindir=C:\Users\vagrant\AppData\Roaming\cabal\bin                                                  
--libdir=C:\Users\vagrant\AppData\Roaming\cabal                                                      
--libsubdir=i386-windows-ghc-8.4.2\happy-1.19.9-KeeVHae3CJkAYnWGzas02f                               
--dynlibdir=C:\Users\vagrant\AppData\Roaming\cabal\i386-windows-ghc-8.4.2                            
--libexecdir=C:\Users\vagrant\AppData\Roaming\cabal\happy-1.19.9-KeeVHae3CJkAYnWGzas02f              
--libexecsubdir=i386-windows-ghc-8.4.2\happy-1.19.9                                                  
--datadir=C:\Users\vagrant\AppData\Roaming\cabal                                                     
--datasubdir=i386-windows-ghc-8.4.2\happy-1.19.9                                                     
--docdir=C:\Users\vagrant\AppData\Roaming\cabal\doc\i386-windows-ghc-8.4.2\happy-1.19.9              
--htmldir=C:\Users\vagrant\AppData\Roaming\cabal\doc\i386-windows-ghc-8.4.2\happy-1.19.9\html        
--haddockdir=C:\Users\vagrant\AppData\Roaming\cabal\doc\i386-windows-ghc-8.4.2\happy-1.19.9\html     
--sysconfdir=C:\Users\vagrant\AppData\Roaming\cabal\etc --user                                       
--flags=small_base --ipid=happy-1.19.9-KeeVHae3CJkAYnWGzas02f                                        
--extra-prog-path=C:\Users\vagrant\AppData\Roaming\cabal\bin                                         
--dependency=array=array-0.5.2.0 --dependency=base=base-4.11.1.0                                     
--dependency=containers=containers-0.5.11.0 --dependency=mtl=mtl-2.2.2                               
--disable-tests --exact-configuration --disable-benchmarks                                           
Redirecting build log to {handle:                                                                    
C:\Users\vagrant\AppData\Roaming\cabal\logs\ghc-8.4.2\happy-1.19.9-KeeVHae3CJkAYnWGzas02f.log}       
Building happy-1.19.9...                                                                             
creating                                                                                             
C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup                           
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc.exe" "--make" "-fbuilding-cabal-package" "
-odir" "C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup" "-hidir" "C:\User
s\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup" "-i" "-iC:\Users\vagrant\AppData
\Local\Temp\cabal-tmp-6540\happy-1.19.9" "-optP-include" "-optPC:\Users\vagrant\AppData\Local\Temp\ca
bal-tmp-6540\happy-1.19.9\dist\setup\setup_macros.h" "-hide-all-packages" "-package-id" "Cabal-2.2.0.
1" "-package-id" "base-4.11.1.0" "-package-id" "directory-1.3.1.5" "-package-id" "filepath-1.4.2" "C:
\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.hs" "-o" "C:\Users\vag
rant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.exe" "-threaded"                
C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.exe                 
build --verbose=2 --builddir=dist                                                                    
Redirecting build log to {handle:                                                                    
C:\Users\vagrant\AppData\Roaming\cabal\logs\ghc-8.4.2\happy-1.19.9-KeeVHae3CJkAYnWGzas02f.log}       
Failed to install happy-1.19.9                                                                       
Build log ( C:\Users\vagrant\AppData\Roaming\cabal\logs\ghc-8.4.2\happy-1.19.9-KeeVHae3CJkAYnWGzas02f
.log ):                                                                                              
Component build order: executable 'happy'                                                            
"C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc-pkg.exe" "init" "dist\package.conf.inplace
"                                                                                                    
\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.hs, C:\Users\vagrant\AppData\Local\T
emp\cabal-tmp-6540\happy-1.19.9\dist\setup\Main.o )                                                  
Linking C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9\dist\setup\setup.exe ...     
Using Parsec parser                                                                                  
Warning: happy.cabal:25:2: Tabs used as indentation at 25:2, 26:2, 27:2, 28:2,                       
29:2, 30:2, 31:2, 32:2, 33:2, 34:2, 35:2, 36:2, 37:2, 38:2, 39:2, 40:2, 41:2,                        
42:2, 43:2, 44:2, 45:2, 46:2, 47:2, 48:2, 49:2, 50:2, 51:2, 52:2, 53:2, 54:2,                        
55:2, 56:2, 57:2, 58:2, 59:2, 60:2, 61:2, 62:2, 63:2, 64:2, 65:2, 66:2, 67:2,                        
68:2, 69:2, 70:2, 71:2, 72:2, 73:2, 74:2, 75:2, 76:2, 77:2, 78:2, 79:2, 80:2,                        
81:2, 82:2, 83:2, 84:2, 85:2, 86:2, 87:2, 88:2, 89:2, 90:2, 91:2, 92:2, 93:2,                        
94:2, 95:2, 96:2, 97:2, 98:2, 99:2, 100:2, 101:2, 102:2, 103:2, 104:2, 105:2,                        
106:2, 107:2, 108:2, 109:2, 110:2, 111:2, 112:2, 113:2, 114:2, 115:2, 116:2,                         
117:2, 118:2, 119:2, 120:2, 121:2, 122:2                                                             
Configuring happy-1.19.9...                                                                          
Flags chosen: small_base=True                                                                        
Dependency array ==0.5.2.0: using array-0.5.2.0                                                      
Dependency base ==4.11.1.0: using base-4.11.1.0                                                      
Dependency containers ==0.5.11.0: using containers-0.5.11.0                                          
Dependency mtl ==2.2.2: using mtl-2.2.2                                                              
Source component graph: component exe:happy                                                          
Configured component graph:                                                                          
    component happy-1.19.9-KeeVHae3CJkAYnWGzas02f-happy                                              
        include base-4.11.1.0                                                                        
        include array-0.5.2.0                                                                        
        include containers-0.5.11.0                                                                  
        include mtl-2.2.2                                                                            
Linked component graph:                                                                              
    unit happy-1.19.9-KeeVHae3CJkAYnWGzas02f-happy                                                   
        include base-4.11.1.0                                                                        
        include array-0.5.2.0                                                                        
        include containers-0.5.11.0                                                                  
        include mtl-2.2.2                                                                            
Ready component graph:                                                                               
    definite happy-1.19.9-KeeVHae3CJkAYnWGzas02f-happy                                               
        depends base-4.11.1.0                                                                        
        depends array-0.5.2.0                                                                        
        depends containers-0.5.11.0                                                                  
        depends mtl-2.2.2                                                                            
Using Cabal-2.2.0.1 compiled by ghc-8.4                                                              
Using compiler: ghc-8.4.2                                                                            
Using install prefix: C:\Users\vagrant\AppData\Roaming\cabal                                         
Executables installed in: C:\Users\vagrant\AppData\Roaming\cabal\bin (fixed                          
location)                                                                                            
Libraries installed in:                                                                              
C:\Users\vagrant\AppData\Roaming\cabal\i386-windows-ghc-8.4.2\happy-1.19.9-KeeVHae3CJkAYnWGzas02f    
(fixed location)                                                                                     
Dynamic Libraries installed in:                                                                      
C:\Users\vagrant\AppData\Roaming\cabal\i386-windows-ghc-8.4.2 (fixed location)                       
Private executables installed in:                                                                    
C:\Users\vagrant\AppData\Roaming\cabal\happy-1.19.9-KeeVHae3CJkAYnWGzas02f\i386-windows-ghc-8.4.2\hap
py-1.19.9                                                                                            
(fixed location)                                                                                     
Data files installed in:                                                                             
C:\Users\vagrant\AppData\Roaming\cabal\i386-windows-ghc-8.4.2\happy-1.19.9                           
(fixed location)                                                                                     
Documentation installed in:                                                                          
C:\Users\vagrant\AppData\Roaming\cabal\doc\i386-windows-ghc-8.4.2\happy-1.19.9                       
(fixed location)                                                                                     
Configuration files installed in: C:\Users\vagrant\AppData\Roaming\cabal\etc                         
(fixed location)                                                                                     
No alex found                                                                                        
Using ar found on system at:                                                                         
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\lib/../mingw/bin\ar.exe                            
No c2hs found                                                                                        
No cpphs found                                                                                       
No doctest found                                                                                     
Using gcc version 7.2.0 found on system at:                                                          
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\lib/../mingw/bin\gcc.exe                           
Using ghc version 8.4.2 found on system at:                                                          
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc.exe                                        
Using ghc-pkg version 8.4.2 found on system at:                                                      
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\ghc-pkg.exe                                    
No ghcjs found                                                                                       
No ghcjs-pkg found                                                                                   
No greencard found                                                                                   
Using haddock version 2.20.0 found on system at:                                                     
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\haddock.exe                                    
No happy found                                                                                       
Using haskell-suite found on system at: haskell-suite-dummy-location                                 
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location                         
No hmake found                                                                                       
Using hpc version 0.67 found on system at:                                                           
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hpc.exe                                        
Using hsc2hs version 0.68.3 found on system at:                                                      
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\hsc2hs.exe                                     
No hscolour found                                                                                    
No jhc found                                                                                         
Using ld found on system at:                                                                         
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\lib/../mingw/bin\ld.exe                            
No lhc found                                                                                         
No lhc-pkg found                                                                                     
No pkg-config found                                                                                  
Using runghc version 8.4.2 found on system at:                                                       
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\bin\runghc.exe                                     
Using strip version 2.29 found on system at:                                                         
C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.4.2\mingw\bin\strip.exe                                
Using tar found on system at: C:\Program Files\Git\usr\bin\tar.exe                                   
No uhc found                                                                                         
cabal: Leaving directory 'C:\Users\vagrant\AppData\Local\Temp\cabal-tmp-6540\happy-1.19.9'           
World file is already up to date.                                                                    
CallStack (from HasCallStack):                                                                       
  die', called at .\Distribution\Client\Install.hs:993:15 in main:Distribution.Client.Install        
cabal: Error: some packages failed to install:                                                       
happy-1.19.9-KeeVHae3CJkAYnWGzas02f failed during the building phase. The                            
exception was:                                                                                       
ExitFailure (-1073741819)
simonmar commented 6 years ago

I have no idea what the problem is here. Anyone able to help?

OlivierSohn commented 6 years ago

I'm building with stack, on windows, and have issues with happy, too: this is the appveyor output : https://ci.appveyor.com/project/OlivierSohn/hamazed/build/1.0.111

erikd commented 6 years ago

@OlivierSohn's issue seems to be different from the original issue.

Its actually possible to copy and paste the output from AppVeyor like this:

C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\.stack-work\dist\ba067387\setup\Main.o )

    C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\Setup.lhs:48:22: warning: [-Wdeprecations]
        In the use of `rawSystemProgramConf'
        (imported from Distribution.Simple.Program):
        Deprecated: "use runDbProgram instead. This symbol will be removed in Cabal-3.0 (est. Oct 2018)."
       |
    48 |   let runProgram p = rawSystemProgramConf (fromFlagOrDefault normal (buildVerbosity flags))
       |                      ^^^^^^^^^^^^^^^^^^^^

which to me looks like it may be using version 2.2 of Cabal the library.

Might be worth trying to build happy with the following patch:

diff --git a/happy.cabal b/happy.cabal
index 4cff02c..c60c71e 100644
--- a/happy.cabal
+++ b/happy.cabal
@@ -129,7 +129,7 @@ extra-source-files:
         tests/typeclass_monad_lexer.y

 custom-setup
-  setup-depends: Cabal <2.4,
+  setup-depends: Cabal <2.2,
                  base >=4.6 && <5,
                  directory <1.4,
                  filepath <1.5
erikd commented 6 years ago

That warning obviously wasn't the issue. I suspect its actually dying running the program compiled from Setup.lhs.

OlivierSohn commented 6 years ago

I too thought that the warning was not the issue, and that the issue was coming later, but the logs were somehow truncated by appveyor logging system.

Here is the end of the log:

echo "" | stack --resolver nightly-2018-06-07 --skip-msys --with-gcc=c:\msys64\MINGW32\bin\gcc --no-terminal --extra-lib-dirs c:\msys64\MINGW32\lib\ --extra-lib-dirs C:\stack\portaudio-build\Release\ --extra-include-dirs c:\msys64\MINGW32\include\ --extra-include-dirs C:\stack\portaudio\include\ test imj-music --jobs 1
Cloning 89a5657db7cf0a6b95a6fba8467445208f9313e6 from https://github.com/OlivierSohn/mwc-random.git
Cloning into '/c/stack/.stack-work/downloaded/jNmoFavzvthp'...
': not a valid identifier
[1 of 2] Compiling Main             ( C:\sr\setup-exe-src\setup-Z6RU0evB.hs, C:\sr\setup-exe-src\setup-Z6RU0evB.o )
[2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\sr\setup-exe-src\setup-shim-Z6RU0evB.o )
Linking C:\sr\setup-exe-cache\i386-windows\tmp-Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe ...
clock-0.7.2: download
clock-0.7.2: configure
clock-0.7.2: build
clock-0.7.2: copy/register
happy-1.19.9: download
happy-1.19.9: configure
happy-1.19.9: build
hashable-1.2.7.0: download
hashable-1.2.7.0: configure
hashable-1.2.7.0: build
hashable-1.2.7.0: copy/register
async-2.2.1: download
async-2.2.1: configure
async-2.2.1: build
async-2.2.1: copy/register
haskell-lexer-1.0.1: download
haskell-lexer-1.0.1: configure
haskell-lexer-1.0.1: build
haskell-lexer-1.0.1: copy/register
imj-bindings-audio-types-0.1.0.3: configure (lib)
imj-bindings-audio-types-0.1.0.3: build (lib)
imj-bindings-audio-types-0.1.0.3: copy/register
primitive-0.6.3.0: download
primitive-0.6.3.0: configure
primitive-0.6.3.0: build
primitive-0.6.3.0: copy/register
strict-concurrency-0.2.4.2: download
strict-concurrency-0.2.4.2: configure
strict-concurrency-0.2.4.2: build
strict-concurrency-0.2.4.2: copy/register
unliftio-core-0.1.1.0: download
unliftio-core-0.1.1.0: configure
unliftio-core-0.1.1.0: build
unliftio-core-0.1.1.0: copy/register
unliftio-0.2.7.0: download
unliftio-0.2.7.0: configure
unliftio-0.2.7.0: build
unliftio-0.2.7.0: copy/register
vector-0.12.0.1: download
vector-0.12.0.1: configure
vector-0.12.0.1: build
vector-0.12.0.1: copy/register
imj-bindings-audio-0.1.0.3: configure (lib)
imj-bindings-audio-0.1.0.3: build (lib)
imj-bindings-audio-0.1.0.3: copy/register
--  While building custom Setup.hs for package happy-1.19.9 using:
      C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\.stack-work\dist\ba067387\setup\setup --builddir=.stack-work\dist\ba067387 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure (-1073741819)
    Logs have been written to: C:\stack\.stack-work\logs\happy-1.19.9.log
    [1 of 2] Compiling Main             ( C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\Setup.lhs, C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\.stack-work\dist\ba067387\setup\Main.o )

    C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\Setup.lhs:48:22: warning: [-Wdeprecations]
        In the use of `rawSystemProgramConf'
        (imported from Distribution.Simple.Program):
        Deprecated: "use runDbProgram instead. This symbol will be removed in Cabal-3.0 (est. Oct 2018)."
       |
    48 |   let runProgram p = rawSystemProgramConf (fromFlagOrDefault normal (buildVerbosity flags))
       |                      ^^^^^^^^^^^^^^^^^^^^
    [2 of 2] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\.stack-work\dist\ba067387\setup\StackSetupShim.o )
    Linking C:\Users\appveyor\AppData\Local\Temp\1\stack1404\happy-1.19.9\.stack-work\dist\ba067387\setup\setup.exe ...
    Warning: happy.cabal:25:2: Tabs used as indentation at 25:2, 26:2, 27:2, 28:2,
    29:2, 30:2, 31:2, 32:2, 33:2, 34:2, 35:2, 36:2, 37:2, 38:2, 39:2, 40:2, 41:2,
    42:2, 43:2, 44:2, 45:2, 46:2, 47:2, 48:2, 49:2, 50:2, 51:2, 52:2, 53:2, 54:2,
    55:2, 56:2, 57:2, 58:2, 59:2, 60:2, 61:2, 62:2, 63:2, 64:2, 65:2, 66:2, 67:2,
    68:2, 69:2, 70:2, 71:2, 72:2, 73:2, 74:2, 75:2, 76:2, 77:2, 78:2, 79:2, 80:2,
    81:2, 82:2, 83:2, 84:2, 85:2, 86:2, 87:2, 88:2, 89:2, 90:2, 91:2, 92:2, 93:2,
    94:2, 95:2, 96:2, 97:2, 98:2, 99:2, 100:2, 101:2, 102:2, 103:2, 104:2, 105:2,
    106:2, 107:2, 108:2, 109:2, 110:2, 111:2, 112:2, 113:2, 114:2, 115:2, 116:2,
    117:2, 118:2, 119:2, 120:2, 121:2, 122:2
    Configuring happy-1.19.9...
Command exited with code 1
OlivierSohn commented 6 years ago

@erikd in the first log of the original poster, I found this :

Reading available packages of hackage.haskell.org...                                                 
Using most recent state specified from most recent cabal update                                      
index-state(hackage.haskell.org) = 2018-05-17T01:00:29Z                                              
Failed to query pkg-config, Cabal will continue without solving for pkg-config                       
constraints: dieVerbatim: user error (CallStack (from HasCallStack):                                 
die', called at .\Distribution\Simple\Program\Db.hs:423:28 in                                        
Cabal-2.2.0.1-498b1ffb97317cbfc8432b5b6c862cebeca566be:Distribution.Simple.Program.Db                
requireProgram, called at .\Distribution\Solver\Types\PkgConfigDb.hs:65:21 in                        
main:Distribution.Solver.Types.PkgConfigDb                                                           
cabal: The program 'pkg-config' is required but it could not be found.                               
)      

which indicates cabal 2.2 is used.

I'll see if I can now point to your fork of happy apply your patch and relauch my build, to see if your changes fix the problem

OlivierSohn commented 6 years ago

@erikd The cabal version wasn't the issue, actually Cabal 2.2 is the right version when building with ghc 8.4.x ! Here are the logs : https://ci.appveyor.com/project/OlivierSohn/hamazed

Thanks for the suggestion anyway :)

Mistuke commented 6 years ago

If it helps, -1073741819 is a segfault. Haskell exit codes are signed, while windows error codes are unsigned. -1073741819 == 0xc0000005 which is the system code for segfault.

Mistuke commented 6 years ago

I don't think the error is happy related, we've been having a persistent segfault on the 32bit build of GHC which seems to only happen every so often. But AppVeyor seems to regularly trigger it. Unfortunately I have yet to be able to reproduce it locally which makes debugging very hard.. I'm waiting for information from a few people to see if I can get dumps or information to reproduce it.

Mistuke commented 6 years ago

from the output and the crash location this seems to be https://ghc.haskell.org/trac/ghc/ticket/15154

OlivierSohn commented 6 years ago

So maybe my issue is different (I'm building with ghc 8.4.3, the ticket says ghc 8.4.2 is fine)

Then my problem comes from stack maybe? (when building happy on my machine, it's fine with stack + ghc8.2, but broken with stack + ghc8.4.3 with a 'couldn't find happy' error)

Mistuke commented 6 years ago

GHC 8.4.3 isn't free of the problem, it's just easier to reproduce on certain versions/environments.

However in your case it's not a segfault, the exit code is 1. That I don't know what's going on since I don't know how to debug stack.

But the original issue from @mcandre is the memory corruption that's been in the 32 bit versions of ghc for a while now. Unfortunately reproducing it on any of my machines has been unsuccessful... So any dumps I can get would be very helpful.

Mistuke commented 6 years ago

@OlivierSohn looking at your log again, you do have the same issue

--  While building custom Setup.hs for package happy-1.19.9 using:
      C:\Users\appveyor\AppData\Local\Temp\1\stack3016\happy-1.19.9\.stack-work\dist\ba067387\setup\setup --builddir=.stack-work\dist\ba067387 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure (-1073741819)
    Logs have been written to: C:\stack\.stack-work\logs\happy-1.19.9.log

is a bit higher up in the build log.

Mistuke commented 6 years ago

It may also be https://ghc.haskell.org/trac/ghc/ticket/15095 where unlit seems to be segfaulting on the 32 bit builds. AppVeyor seems to reasonably deterministically trigger these but I don't know why.. Without any sort of a dump I don't even know where to begin here...

OlivierSohn commented 6 years ago

Would it be possible to get dumps from appveyor?

Mistuke commented 6 years ago

Yes, you can set up remote desktop to the instance https://www.appveyor.com/docs/how-to/rdp-to-build-worker/

and then replay the command that failed, in your case C:\Users\appveyor\AppData\Local\Temp\1\stack3016\happy-1.19.9\.stack-work\dist\ba067387\setup\setup --builddir=.stack-work\dist\ba067387 build --ghc-options " -ddump-hi -ddump-to-file"

instructions are in https://ghc.haskell.org/trac/ghc/ticket/15154

OlivierSohn commented 6 years ago

I see. I'm afraid I won't be able to retry this anytime soon, but anyone can fork my repo and use appveyor to reproduce it / grab the dump.

OlivierSohn commented 6 years ago

I can confirm that using the 64-bit ghc fixes the issue for me!

Mistuke commented 6 years ago

Found the cause, I'll fix it this sometime this week. This ticket can be closed as it's a GHC bug, the progress can be tracked on the trac link above.