Linking and Including nonstandard paths

Hi! 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 environment. 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 configure.mk(.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. Help? Thanks in advance!

On Thu, 2007-04-05 at 17:20 -0500, Chris McCraw wrote:
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.
Modify the library-dirs used by the rts packages to include your extra linker search path. eg: - library-dirs: /usr/local/lib/ghc-6.6 + library-dirs: /usr/local/lib/ghc-6.6, /lusr/gnu/lib First, backup ghc's package.conf file just in case... Then: $ ghc-pkg describe rts > rts.package.conf $ $EDITOR rts.package.conf $ ghc-pkg update rts.package.conf Duncan

I wonder if this package.conf hacking would be a good topic for a GHC wiki page? Somewhere here: http://haskell.org/haskellwiki/GHC Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On | Behalf Of Duncan Coutts | Sent: 05 April 2007 23:44 | To: Chris McCraw | Cc: Glasgow-haskell-users@haskell.org | Subject: Re: Linking and Including nonstandard paths | | On Thu, 2007-04-05 at 17:20 -0500, Chris McCraw wrote: | | > 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. | | Modify the library-dirs used by the rts packages to include your extra | linker search path. eg: | | - library-dirs: /usr/local/lib/ghc-6.6 | + library-dirs: /usr/local/lib/ghc-6.6, /lusr/gnu/lib | | First, backup ghc's package.conf file just in case... | | Then: | $ ghc-pkg describe rts > rts.package.conf | $ $EDITOR rts.package.conf | $ ghc-pkg update rts.package.conf | | Duncan | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Fri, 2007-04-06 at 08:18 +0100, Simon Peyton-Jones wrote:
I wonder if this package.conf hacking would be a good topic for a GHC wiki page? Somewhere here: http://haskell.org/haskellwiki/GHC
Done.
participants (3)
-
Chris McCraw
-
Duncan Coutts
-
Simon Peyton-Jones