Reputation: 242
I am new to stack and not all that proficient with cabal.
I have converted a cabal project to stack. It seems to be building fine. I like it so far.
But I have observed something that I do not understand. When I execute a stack build command I see two output executables get created. Both are in the .stack-work path with one under dist and the other under install. They have radically different sizes. The file in the dist path is almost twice the size of the one in the install path.
The only thing I can think of to explain this is the possibility that the executable file in the dist path includes (embeds within itself) all of the package dependencies required to run this code on a different machine (it is complete and ready for distribution to a different machine), while the file in the install path expects that it is running on the same machine where it was built and where those dependent libraries are installed external to the main application code.
Does that make sense?
Any alternative explanations?
Dave Smith
Upvotes: 3
Views: 371
Reputation: 12060
I also had the same two executables created on my machine.... It was also a mystery for me, but I think I know the answer.
After a little detective work, I found that the executable in ~/.stack-work/install/.... can be identically created from the executable in ~/.stack-work/dist/.... by running strip. Therefore I believe it is pretty clear that dist/.... is one step in the process of creating the final simplified version, which is stored in install/.... (and later copied again to ~/.local/bin/).
Upvotes: 5