Description

I have a package that bundles in C library sources. I never had a problem with this when using GHC 7.6.

In GHC 7.8, the order of the c-sources in the cabal file now matters. Sources must be listed earlier if they have symbols that subsequently loaded object files will need. If the c-sources are in the wrong order, when running "cabal repl" I get

When using the same code and cabal file with GHC 7.6, "cabal repl" works fine: GHCi loads each static object (regardless of ordering in the cabal file), links up the necessary symbols, and launches successfully.

Change History (6)

I have a similar issue. In particular, my cabal project defines a C source file which in turn calls a C function from a library (outside of my project). But since cabal repl tries to load the in-project .o file first, it encounters undefined symbols (in particular, it errors on a struct which is declared "extern" by the library).

This is not influenced by the order of the "c-sources" and "extra-libraries" in my .cabal file.