Haskell cabal build undefined reference bug and duplicate recompilation

My question has two parts. Firstly, when I compile my project, I get a long list of form errors

(.text+0x137f): undefined reference to `raytrzuAd6RComi0WmBiuT4685WWH_Types_zdfBinaryColor_closure' 

A complete list of errors can be found here. The code that creates this error can be found here .

I am using ghc 7.10.1 and cabal 1.22.4.0.

The second part of my question is that, although following the same structure of cabal as this question , cabal still recompiles the library 3 times every cabal build, despite executable files and a library that has a unique hs-source-dir and depending on the library.

EDIT: Regarding triple compilation, the first time you create .o files [ 2 of 15] Compiling Types ( src/Types.hs, dist/build/Types.o ) . The second time, it creates .p_o files [ 2 of 15] Compiling Types ( src/Types.hs, dist/build/Types.p_o ) , which are caused by TemplateHaskell and profiling.

+7
haskell cabal
source share
1 answer

You must include all other non-exportable modules in your Cabal file in the other-modules field, otherwise they will not be correctly linked when creating the final library or executable file.

You can see the Cabal User Guide for more information (although this pretty much summarizes the situation with other-modules !).

+6
source share

All Articles