Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
large stack build uses a lot of space in temp directory #3018
General summary/comments (optional)
When stack build needs to build a lot of dependencies, it uses a lot of disk space in the system temp directory. In particular, build directories for all packages are left there after the libraries have been installed into .stack-work, and are only cleaned up after the build finishes.
Steps to reproduce
stack build in git-annex source tree on a system with eg a 1.3 gb tmpfs for /tmp. (The default on a modern debian system with 4 gb of ram.)
Build will eventually use over a GB of space in /tmp/stacknnnn and fail. The temp directory is then freed, and re-running the build picks up where it left off, clearly not needing any of the stuff that was being kept in the temp directory.
Set TMP to point to a directory with more space than /tmp
Delete package build directories of dependencies after the copy/register step.
I'm fairly sure current stack also behaves this way too. Looking at https://github.com/commercialhaskell/stack/blob/4ee027d2d93f42e790ff170c139094cc8dbb2373/src/Stack/Build/Execute.hs , withExecuteEnv is used to run the build plan and uses a single withSystemTempDir
Method of installation
Stack 1.3.2 on ArchLinux behaves the same way.