Linking and Including nonstandard paths

Chris McCraw fool at
Thu Apr 5 18:20:34 EDT 2007


We're fairly happy users of ghc in my department.  We use it widely
for instruction and to some degree for research.  I'm the fellow tasked
with maintaining the local installation, and I have a couple of simple
and seemingly related problems that I'm sure have easy solutions, though
I haven't been able to find them.

1) I'd like to embed an additional library search directory in ghc so
that it does the equivalent of -L/path/to/extra/dir every time it's
used to link something.  Unfortunately, our libgmp resides in a nonstandard
directory and so *every time* someone wants to compile they must
	ghc -L/lusr/gnu/lib ...
to find -lgmp.  I promise, we have thought about moving libgmp into the
default search path, and setting $LD_LIBRARY_PATH, but those break a
lot of other stuff in our setup, and are really not practical in our
We build all of our utilities from source (including ghc) so I would be
happy & able to tweak some setting during configure or make or even hack
the source--but I can't figure out where to change it.  I figured it'd be
in but adding "-R /lusr/gnu/lib" to the LD command
line did not do the trick in generating a ghc binary that calls ld/collect2
in the same way.

2) When building something, I often need to add an include directory.
As an example, GSLHaskell:

% runhaskell -I/lusr/gnu/include Setup.hs build
[16 of 17] Compiling GSL.Plot         ( GSL/Plot.hs, dist/build/GSL/Plot.p_o )
[17 of 17] Compiling GSL              ( GSL.hs, dist/build/GSL.p_o )

GSL/gslaux.c:2:26:  gsl/gsl_blas.h: No such file or directory

GSL/gslaux.c:3:28:  gsl/gsl_linalg.h: No such file or directory

gsl/gsl_blas.h and friends are indeed in /lusr/gnu/include and I'd
like to do the equivalent of adding a $CFLAGS of -I/lusr/gnu/include to
the build (or to every build--it'd be grand if that was included by
default, though not as necessary as item #1 above) but can't figure
out how.

I'm working with ghc-6.6 on ubuntu linux, in case that matters.  I'm
not sure what else is relevant, but am happy to provide details as needed.


Thanks in advance!

More information about the Glasgow-haskell-users mailing list