occasional linking problems with --make?

Evan Laforge qdunkan at gmail.com
Tue Aug 2 07:35:23 CEST 2011

I'm just wondering if other GHC users see the errors I see.
Occasionally, a program will fail to link, with an error similar to
the following:

Linking build/test/RunTests ...
lUndefined symbols:
  "_UiziRulerC_dk8C", referenced from:
      _skev_info in RulerC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

The program involves some C FFI, the Ui.RulerC module mention above is
one such FFI-using module.

It's consistent in that if I do another 'make' I'll keep seeing the
error, but inconsistent in that if I rm a bunch of .o files to force
them to recompile, I usually get a successful link afterwards.  I
haven't really figured out what exact files I need to rebuild, but I
don't think it's necessarily just the "referenced from" module, on
occasion deleting a bunch of files doesn't solve the problem and I
just do a 'make clean'.  I haven't noticed if it's always FFI using
modules, or which exact .o files I have to delete to fix the problem,
but I'll pay more attention in the future.  I've been seeing this
problem pretty regularly (maybe once every couple of weeks) since
upgrading to ghc7 a long time ago.

Do other people see this same issue?  Is there something I can do to
better track it down, other than the two things I mentioned above?
I'd like to blame my hacky makefile, but then again all the haskell
modules use --make so it seems like ghc is to blame.

Also, when I remove an import from a module I can fairly reliably get
the "modules below me: missing <module no longer imported>, hi files
probably out of date" warning from every module above.  It's annoying
but seems to be harmless, and when I get tired of the noise I do a
make clean.  Is this a common problem?  I feel like there's something
wrong in the dependency tracking that yields these problems.

This is ghc 7.0.2, btw.

More information about the Glasgow-haskell-users mailing list