ennocramer / floskell

Floskell is a flexible Haskell source code pretty printer.
BSD 3-Clause "New" or "Revised" License
178 stars 22 forks source link

Build fails in windows with compiler segfault #50

Closed jneira closed 2 years ago

jneira commented 4 years ago

I'll try to attach logs for cabal asap.

The issue could be upstream (cabal, ghc, both?) but i think tracking here could help other users.

jneira commented 4 years ago

The issue is no deterministic, i've built haskell-language-server with windows 7, cabal-3.2, ghc-8.8.3 and floskell-0.10.3. But i've hit it before with same versions of cabal, ghc and floskell (but in windows 10)

jneira commented 4 years ago

Log of a failed build with cabal-3.2, ghc-8.8.3 and floskell-0.10.3 in windows 10

Build profile: -w ghc-8.8.4 -O1
In order, the following will be built:
 - floskell-0.10.3 (lib) (requires build)
 - haskell-language-server-0.2.0.0 (lib) (first run)
 - haskell-language-server-0.2.0.0 (exe:haskell-language-server-wrapper) (first run)
 - haskell-language-server-0.2.0.0 (exe:haskell-language-server) (first run)
 - haskell-language-server-0.2.0.0 (test:func-test) (first run)
creating D:\dev\ws\haskell\hls\dist-newstyle\build
creating D:\dev\ws\haskell\hls\dist-newstyle\tmp
Extracting
C:\Users\atrey\AppData\Roaming\cabal\packages\hackage.haskell.org\floskell\0.10.3\floskell-0.10.3.tar.gz
to D:\dev\ws\haskell\hls\dist-newstyle\tmp\src-11144...
Updating floskell.cabal with the latest revision from the index.
creating
D:\dev\ws\haskell\hls\dist-newstyle\tmp\src-11144\floskell-0.10.3\dist
Starting     floskell-0.10.3 (lib)
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","configure","--verbose=2","--builddir=dist","--ghc","--prefix=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03","--bindir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\bin","--libdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\lib","--libsubdir=","--dynlibdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\lib","--libexecdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\libexec","--libexecsubdir=","--datadir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\share","--datasubdir=","--docdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\share\\doc","--htmldir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\share\\doc\\html","--haddockdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\share\\doc\\html","--sysconfdir=C:\\sd\\ghc-8.8.4\\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\\etc","--enable-library-vanilla","--disable-library-profiling","--disable-shared","--disable-static","--disable-executable-dynamic","--disable-executable-static","--disable-profiling","--profiling-detail=default","--library-profiling-detail=default","--enable-optimization","--disable-debug-info","--disable-library-for-ghci","--disable-split-sections","--disable-split-objs","--disable-executable-stripping","--disable-library-stripping","--package-db=clear","--package-db=global","--package-db=C:\\sd\\ghc-8.8.4\\package.db","--cid=floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03","--extra-prog-path=D:\\bin","--dependency=aeson=aeson-1.4.7.1-f8d440a3cdb642528523f3afc840c8ea52dec030","--dependency=attoparsec=attoparsec-0.13.2.4-7402645117cecef563be4638a1ab4c75b3fc6d1a","--dependency=base=base-4.13.0.0","--dependency=bytestring=bytestring-0.10.10.1","--dependency=containers=containers-0.6.2.1","--dependency=data-default=data-default-0.7.1.1-8d3542d014c88ea338bb19a08f6b68aecd899cf5","--dependency=directory=directory-1.3.6.0","--dependency=filepath=filepath-1.4.2.1","--dependency=haskell-src-exts=haskell-src-e_-1.23.1-1bd68546037295cea9a670fde5d5377e1ec75652","--dependency=monad-dijkstra=monad-dijkstra-0.1.1.3-15065b2b72f4138d16ef18fb9dce82f0fd5746a5","--dependency=mtl=mtl-2.2.2","--dependency=text=text-1.2.4.0","--dependency=transformers=transformers-0.5.6.2","--dependency=unordered-containers=unordered-con_-0.2.11.0-3d13dac6511b6535f8d51c4a98ea0508f95c1a33","--dependency=utf8-string=utf8-string-1.0.1.1-78f311929da7c0a708d76e5d8b20118df8ed54d8","--disable-coverage","--exact-configuration","--with-ghc=D:\\bin\\stack\\x86_64-windows\\ghc-8.8.4\\bin\\ghc-8.8.4.exe","--with-ghc-pkg=D:\\bin\\stack\\x86_64-windows\\ghc-8.8.4\\bin\\ghc-pkg.exe","--ghc-option=-hide-all-packages","lib:floskell"]
D:\bin\cabal.exe act-as-setup --build-type=Simple -- configure --verbose=2
--builddir=dist --ghc
--prefix=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03
--bindir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\bin
--libdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\lib
--libsubdir=
--dynlibdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\lib
--libexecdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\libexec
--libexecsubdir=
--datadir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\share
--datasubdir=
--docdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\share\doc
--htmldir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\share\doc\html
--haddockdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\share\doc\html
--sysconfdir=C:\sd\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03\etc
--enable-library-vanilla --disable-library-profiling --disable-shared
--disable-static --disable-executable-dynamic --disable-executable-static
--disable-profiling --profiling-detail=default
--library-profiling-detail=default --enable-optimization --disable-debug-info
--disable-library-for-ghci --disable-split-sections --disable-split-objs
--disable-executable-stripping --disable-library-stripping --package-db=clear
--package-db=global --package-db=C:\sd\ghc-8.8.4\package.db
--cid=floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03
--extra-prog-path=D:\bin
--dependency=aeson=aeson-1.4.7.1-f8d440a3cdb642528523f3afc840c8ea52dec030
--dependency=attoparsec=attoparsec-0.13.2.4-7402645117cecef563be4638a1ab4c75b3fc6d1a
--dependency=base=base-4.13.0.0 --dependency=bytestring=bytestring-0.10.10.1
--dependency=containers=containers-0.6.2.1
--dependency=data-default=data-default-0.7.1.1-8d3542d014c88ea338bb19a08f6b68aecd899cf5
--dependency=directory=directory-1.3.6.0
--dependency=filepath=filepath-1.4.2.1
--dependency=mtl=mtl-2.2.2 --dependency=text=text-1.2.4.0
--dependency=transformers=transformers-0.5.6.2
--dependency=unordered-containers=unordered-con_-0.2.11.0-3d13dac6511b6535f8d51c4a98ea0508f95c1a33
--dependency=utf8-string=utf8-string-1.0.1.1-78f311929da7c0a708d76e5d8b20118df8ed54d8
--disable-coverage --exact-configuration
--with-ghc=D:\bin\stack\x86_64-windows\ghc-8.8.4\bin\ghc-8.8.4.exe
--with-ghc-pkg=D:\bin\stack\x86_64-windows\ghc-8.8.4\bin\ghc-pkg.exe
--ghc-option=-hide-all-packages lib:floskell
Redirecting build log to {handle:
C:\Users\atrey\AppData\Roaming\cabal\logs\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03.log}
Building     floskell-0.10.3 (lib)
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","build","--verbose=2","--builddir=dist"]
D:\bin\cabal.exe act-as-setup --build-type=Simple -- build --verbose=2
--builddir=dist
Redirecting build log to {handle:
C:\Users\atrey\AppData\Roaming\cabal\logs\ghc-8.8.4\floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03.log}
CallStack (from HasCallStack):
  die', called at .\\Distribution\\Client\\ProjectOrchestration.hs:1041:55 in main:Distribution.Client.ProjectOrchestration
cabal.exe: Failed to build
floskell-0.10.3-ccc5632702c8a5ae24f882e0349f73bb6b0b0e03. The build process
terminated with exit code 11
Failed to build haskell-language-server-0.2.0.0 because it depends on
haskell-language-server-0.2.0.0 which itself failed to build.
Failed to build haskell-language-server-0.2.0.0 because it depends on
haskell-language-server-0.2.0.0 which itself failed to build.
Failed to build haskell-language-server-0.2.0.0 because it depends on
haskell-language-server-0.2.0.0 which itself failed to build.
Failed to build haskell-language-server-0.2.0.0 because it depends on
haskell-language-server-0.2.0.0 which itself failed to build.
jneira commented 4 years ago

The way i've found to make build hls is downloading floskell locally and add it as a subpackage in the cabal.project or stack.yaml

jneira commented 4 years ago

The way i've found to make build hls is downloading floskell locally and add it as a subpackage in the cabal.project or stack.yaml

I am afraid the solution is not reliable, it works only some times and i dont know yet what triggers it. cabal build works with the above workaround but no cabal install for example. 🤷

hasufell commented 4 years ago

cabal build works with the above workaround but no cabal install for example

cabal install does an sdist, unpacks it to a temporary directory and then builds+installs. That likely means that your cabal.project is ignored.

lukel97 commented 4 years ago

Should we maybe move this issue upstream to GHC @jneira? I'm not sure if an issue for it already exists though, it seems like quite a generic crash. But I can confirm at least from CI that it's crashing semi-reliably on floskell

edit: Just read the linked issue, disregard above!

jneira commented 4 years ago

I've tested a cabal 3.2 version built from source using ghc-8.8.4, to ensure it uses the fixed process version and it did not fix my concrete issue with floskell. Being the error so generic, it could be caused by another unrelated factor.

The way i've used is: git checkout cabal-install-v3.2.0.0 && cabal install cabal-install -w ghc-8.8.4

I've collected some logs here: https://gist.github.com/jneira/58d138a0180e50d24e543d090263f3c3

hasufell commented 4 years ago

The way i've used is: git checkout cabal-install-v3.2.0.0 && cabal install cabal-install -w ghc-8.8.4

To be really sure you should do cabal get cabal-install-3.2.0.0. There's a small chance you get different results from the git repo.

jneira commented 4 years ago

@hasufell thanks for your insights, do you know how could we find out what version of ghc was used to generate a cabal release?

jneira commented 4 years ago

I reported it in the ghc issue tracker: https://gitlab.haskell.org/ghc/ghc/-/issues/18496