Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build corruption bug when moving a project #2936

Closed
mrakgr opened this issue Jan 18, 2017 · 5 comments
Closed

Build corruption bug when moving a project #2936

mrakgr opened this issue Jan 18, 2017 · 5 comments

Comments

@mrakgr
Copy link

mrakgr commented Jan 18, 2017

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.

@decentral1se
Copy link
Member

Hmmm, yes, I can also blow up my package build if I rename the top level directory. I also get various different errors. What would you propose Stack would do in this case?

@mrakgr
Copy link
Author

mrakgr commented Jan 21, 2017

Just work. Is there any reason Stack is sensitive to a project's absolute path?

Having it be like this, means that project must never be moved or risk Stack's ire.

@mrakgr
Copy link
Author

mrakgr commented Jan 21, 2017

I really should have noted, that asd is not the top level directory. The simple folder inside it is.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 1, 2017

Considering this is a linker error, it is likely an upstream issue with cabal

@mgsloan mgsloan added this to the Support milestone Feb 1, 2017
@mgsloan
Copy link
Contributor

mgsloan commented Mar 19, 2017

Closing as an old support issue / upstream issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants