Skip to content

Build corruption bug when moving a project #2936

Closed
@mrakgr

Description

@mrakgr
C:\asd\simple>stack build
simple-0.1.0.0: unregistering (local file changes: C:\asde\simple\app\Main.hs C:\asde\simple\simple.cabal C:\asde\simple\src\Lib.hs C:\asde\simple\t...)
simple-0.1.0.0: configure
Configuring simple-0.1.0.0...
simple-0.1.0.0: build
Preprocessing library simple-0.1.0.0...
Preprocessing executable 'simple-exe' for simple-0.1.0.0...
simple-0.1.0.0: copy/register
Installing library in
C:\asd\simple\.stack-work\install\93264ba9\lib\x86_64-windows-ghc-8.0.1\simple-0.1.0.0-F3BExGhCZsn2GnfzIVL0FA
Installing executable(s) in C:\asd\simple\.stack-work\install\93264ba9\bin
Registering simple-0.1.0.0...

C:\asd\simple>stack clean

C:\asd\simple>stack build
simple-0.1.0.0: unregistering (local file changes: app\Main.hs simple.cabal src\Lib.hs test\Spec.hs)
simple-0.1.0.0: configure
Configuring simple-0.1.0.0...
simple-0.1.0.0: build
Preprocessing library simple-0.1.0.0...
[1 of 1] Compiling Lib              ( src\Lib.hs, .stack-work\dist\b7fec021\build\Lib.o )
Preprocessing executable 'simple-exe' for simple-0.1.0.0...
[1 of 1] Compiling Main             ( app\Main.hs, .stack-work\dist\b7fec021\build\simple-exe\simple-exe-tmp\Main.o )
Linking .stack-work\dist\b7fec021\build\simple-exe\simple-exe.exe ...
C:/Program Files/Haskell Platform/8.0.1/mingw/bin/ld.exe: cannot find -lHSbytestring-show-0.3.5.6-BjSy8lPQnxSIztPkxWzSlH
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)

--  While building package simple-0.1.0.0 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\setup-Simple-Cabal-1.24.0.0-ghc-8.0.1.exe --builddir=.stack-work\dist\b7fec021 build lib:simple exe:simple-exe --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

I ran into some strange issues yesterday while trying to install the bytestring-show package and after trying for an hour in order to write this report, I could not replicate it. It seemed to me that I was going crazy and the errors were on my own end, but by accident I managed to make it happen.

At first I thought the just renaming or moving the folder might be enough to trigger the bug, but that was not it. Nor was it that Stack was forgetting to close the file handles.

Here is the recipe.

  1. Start a new project using stack new simple in C:\asd.
  2. Add bytestring and bytestring-show to the cabal simple-exe build dependencies.
  build-depends:       base
                     , simple
                     , bytestring
                     , bytestring-show
  1. Add bytestring-show-0.3.5.6 to the yaml file.
extra-deps: [bytestring-show-0.3.5.6]
  1. stack build the project.
  2. Rename the asd folder in which the project is in to asde.
  3. Run stack build, stack clean and stack build again and the project will get corrupted.

Cleaning it again will not work, nor will restarting the command prompt. Yesterday I had different errors than the above so there might be more than one bug, but this is the only one I could actually reproduce. It is also likely that yesterday's errors were due to my haphazard actions while running the build as I am not familiar with Stack, so this might in fact be the only one.

Not related to this bug, one other bug is that stack upgrade is failing as shown in the SO post.

Edit: This is on Windows 10. I installed the latest full Haskell Platform 3 days ago.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions