[Hackage] #515: --extra-lib-dirs= should add -R/-rpath to hsc2hs calls

Hackage trac at galois.com
Tue Mar 3 04:31:43 EST 2009


#515: --extra-lib-dirs= should add -R/-rpath to hsc2hs calls
------------------------------+---------------------------------------------
  Reporter:  duncan           |        Owner:           
      Type:  defect           |       Status:  new      
  Priority:  normal           |    Milestone:  Cabal-1.8
 Component:  Cabal library    |      Version:  1.6.0.1  
  Severity:  normal           |     Keywords:           
Difficulty:  easy (<4 hours)  |   Ghcversion:           
  Platform:                   |  
------------------------------+---------------------------------------------
 Currently the `--extra-lib-dirs=` flag is only used to add extra `-L`
 flags in calls to `gcc`, `hsc2hs` etc. On systems where `--extra-lib-
 dirs=` is necessary it's almost always the case that we also need
 `-R`/`-rpath` too. Apparently `-rpath` is somewhat controversial and some
 people argue against using it.

 However one case where it is clearly necessary is in invoking `hsc2hs`.
 This is because `hsc2hs` compiles, links and runs a C program. The program
 is run once on the host machine and never installed or distributed. So all
 the usual arguments against `-rpath` do not apply. Hard coding the paths
 of libs is fine since the program is only used once, in the build tree.
 It's also essential for it to actually work.

 Here's an example log from someone hitting this problem:
 {{{
 $ cabal install pcre-light --extra-include-dirs=/usr/local/include
 --extra-lib-dirs=/usr/local/lib
 Resolving dependencies...
 'pcre-light-0.3.1' is cached.
 Configuring pcre-light-0.3.1...
 Preprocessing library pcre-light-0.3.1...
 dist/build/Text/Regex/PCRE/Light/Base_hsc_make: error while loading shared
 libraries: libpcre.so.0: cannot open shared object file: No such file or
 directory
 running dist/build/Text/Regex/PCRE/Light/Base_hsc_make failed
 command was: dist/build/Text/Regex/PCRE/Light/Base_hsc_make
 >dist/build/Text/Regex/PCRE/Light/Base.hs
 }}}

 On this system it appears that `/usr/local/lib` is not on the default
 static linker path, or the default dynamic linker path. So we need
 `-L/usr/local/lib` for the static linker and `-R/usr/local/lib` for the
 dynamic linker.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/515>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects


More information about the cabal-devel mailing list