Why does the bonded installation recompile what was built?

Why, when I do cabal build and then cabal install , cabal recompiles things twice. (I use the sandbox).

Update

To clarify, I ask when after doing cabal build (which I understand compiles 2 versions of my files), why do what cabal install compiles again. Isn't that a build target for assembly?

Update2

Well, it seems like it compiles in two different directories dist and dist/sandbox-... what is the difference between both?

 > cabal build Building cache-0.1.0.0... Preprocessing executable 'cache' for cache-0.1.0.0... [1 of 1] Compiling Main ( main.hs, dist/build/cache/cache-tmp/Main.o ) Linking dist/build/cache/cache ... > cabal install Warning: The package list for 'hackage.haskell.org' is 60 days old. Run 'cabal update' to get the latest list of available packages. Resolving dependencies... Configuring cache-0.1.0.0... Warning: The 'license-file' field refers to the file 'LICENSE' which does not exist. Building cache-0.1.0.0... Preprocessing executable 'cache' for cache-0.1.0.0... [1 of 1] Compiling Main ( main.hs, dist/dist-sandbox-db136cca/build/cache/cache-tmp/Main.o ) Linking dist/dist-sandbox-db136cca/build/cache/cache ... 
+5
source share
1 answer

During cabal build it creates two versions of the compiled code: one with profiling and one without it.

The difference in command line arguments is very small and can be easily missed. In the next release, the first is compiled with -O -j2 , and the second is compiled with -O -prof -j2 . Also, the output files have different suffixes - .o compared to .p_o :

 Preprocessing library split-0.2.2... Building library... creating dist/build /usr/bin/ghc --make -fbuilding-cabal-package -O -j2 -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name split-0.2.2 -hide-all-packages -no-user-package-db -package-db /Users/erantapaa/try/split-0.2.2/.cabal-sandbox/x86_64-osx-ghc-7.8.3-packages.conf.d -package-db dist/package.conf.inplace -package-id base-4.7.0.1-df210ede1eb79477fef5662549c32927 -XHaskell2010 Data.List.Split Data.List.Split.Internals -Wall [1 of 2] Compiling Data.List.Split.Internals ( src/Data/List/Split/Internals.hs, dist/build/Data/List/Split/Internals.o ) [2 of 2] Compiling Data.List.Split ( src/Data/List/Split.hs, dist/build/Data/List/Split.o ) /usr/bin/ghc --make -fbuilding-cabal-package -O -prof -j2 -osuf p_o -hisuf p_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name split-0.2.2 -hide-all-packages -no-user-package-db -package-db /Users/erantapaa/try/split-0.2.2/.cabal-sandbox/x86_64-osx-ghc-7.8.3-packages.conf.d -package-db dist/package.conf.inplace -package-id base-4.7.0.1-df210ede1eb79477fef5662549c32927 -XHaskell2010 Data.List.Split Data.List.Split.Internals -Wall [1 of 2] Compiling Data.List.Split.Internals ( src/Data/List/Split/Internals.hs, dist/build/Data/List/Split/Internals.p_o ) [2 of 2] Compiling Data.List.Split ( src/Data/List/Split.hs, dist/build/Data/List/Split.p_o ) Linking... 
+2
source

Source: https://habr.com/ru/post/1208267/


All Articles