When I run cabal build
, cabal goes through the process of compiling twice. Since compiling takes relatively long time already (~60 seconds), this is starting to impede my workflow.
Here is the ghc options in my cabal file:
GHC-Options: -O3 -rtsopts -funbox-strict-fields -threaded -Wall -feager-blackholing -fllvm -optlo-O3
if flag(Eventlog)
GHC-Options: -O3 -rtsopts -funbox-strict-fields -threaded -eventlog -Wall
if flag(Profiling)
ghc-prof-options: -O3 -auto-all
GHC-Options: -O3 -rtsopts -funbox-strict-fields -threaded -fprof-auto -Wall
if flag(Dump)
GHC-options: -O3 -funbox-strict-fields -Wall -ddump-simpl -dsuppress-module-prefixes -dsuppress-uniques -ddump-to-file
The output from cabal build
looks completely normal except the compilation restarts as soon as the last module finishes compiling the first time.
[ 1 of 13] Compiling HaObj ( src/HaObj.hs, nothing )
[ 2 of 13] Compiling Surfaces ( src/Surfaces.hs, nothing )
[ 3 of 13] Compiling Materials ( src/Materials.hs, nothing )
[ 4 of 13] Compiling Geometry3 ( src/Geometry3.hs, nothing )
[ 5 of 13] Compiling Triangles ( src/Triangles.hs, nothing )
[ 6 of 13] Compiling BoundingVolumeHierarchy ( src/BoundingVolumeHierarchy.hs, nothing )
[ 7 of 13] Compiling RayTracer ( src/RayTracer.hs, nothing )
[ 8 of 13] Compiling BenchmarkScene5 ( src/BenchmarkScene5.hs, nothing )
[ 9 of 13] Compiling BenchmarkScene4 ( src/BenchmarkScene4.hs, nothing )
[10 of 13] Compiling BenchmarkScene3 ( src/BenchmarkScene3.hs, nothing )
[11 of 13] Compiling BenchmarkScene2 ( src/BenchmarkScene2.hs, nothing )
[12 of 13] Compiling BenchmarkScene ( src/BenchmarkScene.hs, nothing )
[13 of 13] Compiling Main ( src/Main.hs, nothing )
[ 1 of 13] Compiling HaObj ( src/HaObj.hs, nothing )
[ 2 of 13] Compiling Surfaces ( src/Surfaces.hs, nothing )
[ 3 of 13] Compiling Materials ( src/Materials.hs, nothing )
[ 4 of 13] Compiling Geometry3 ( src/Geometry3.hs, nothing )
[ 5 of 13] Compiling Triangles ( src/Triangles.hs, nothing )
[ 6 of 13] Compiling BoundingVolumeHierarchy ( src/BoundingVolumeHierarchy.hs, nothing )
[ 7 of 13] Compiling RayTracer ( src/RayTracer.hs, nothing )
[ 8 of 13] Compiling BenchmarkScene5 ( src/BenchmarkScene5.hs, nothing )
[ 9 of 13] Compiling BenchmarkScene4 ( src/BenchmarkScene4.hs, nothing )
[10 of 13] Compiling BenchmarkScene3 ( src/BenchmarkScene3.hs, nothing )
[11 of 13] Compiling BenchmarkScene2 ( src/BenchmarkScene2.hs, nothing )
[12 of 13] Compiling BenchmarkScene ( src/BenchmarkScene.hs, nothing )
[13 of 13] Compiling Main ( src/Main.hs, nothing )
I'm using Ubuntu 14.04, GHC 7.10.1, cabal-install 1.22.4, cabal library 1.22.3. Here is a link to the repo if you are interested in trying to reproduce. I would recommend running cabal build --ghc-options="-fno-code"
to decrease build time to a couple of seconds.
EDIT: Zeta pointed out that is was because I have both an executable ray-tracer
and a benchmark bench
in my cabal file. Is there a way to build only one of them? I tried cabal build ray-tracer
but this also built both targets. I also tried cabal configure --disable-benchmarks
. Is there a way to selectively build only one of the targets without reorganizing the structure of the cabal file?
Posting the answer from comments as community-wiki:
The syntax to build a single component is (for example) cabal build exe:ray-tracer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With