[GHC] #7904: GHC calls the cc1 of a gcc thats not the first in PATH

GHC cvs-ghc at haskell.org
Sat May 11 07:12:55 CEST 2013


#7904: GHC calls the cc1 of a gcc thats not the first in PATH
-------------------------+--------------------------------------------------
Reporter:  carter        |          Owner:                
    Type:  bug           |         Status:  new           
Priority:  normal        |      Component:  Compiler      
 Version:  7.6.3         |       Keywords:                
      Os:  MacOS X       |   Architecture:  x86_64 (amd64)
 Failure:  None/Unknown  |      Blockedby:                
Blocking:                |        Related:                
-------------------------+--------------------------------------------------
 I was earlier today trying to build some haskell code that ffi's out to
 some c code that uses SSE4 / AVX intrinsics, and was getting odd errors
 about not understanding -mavx or -msse4.2  , which was quite surprising
 since I was able to build those same c source files with clang or the gcc
 4.8 i have at the top of my path.

 After some digging (and running dtrace while trying to bulld my code),  I
 found that some point in the build process, ghc/cabal was running the cc1
 of the apple gcc-llvm v4.2 (ie the gcc version i had used to build the ghc
 and comes with apple dev tools current version, and which lacks support
 for avx or sse4.2 ).

 I only hit this problem because i was deliberately writing code that would
 only compile assuming avx / sse4.2 support on the c compiler side, though
 this does have the implication that when ghc users are doing a simple
 cabalized build of some c code that has SIMD intrinsics, it'll only use
 simd <= ssse3, no higher. This could result in certain  haskell codes on
 os x that lean on vectorized ffi's being 2x slower or worse than on other
 architectures perhaps.

 I'll be working around this problem in my own software development by
 rebuilding ghc on my mac using gcc 4.8 and see if that resolves that
 problem.

 That ends my overview  of the bug whereby ghc uses the cc1 of the gcc that
 built it even when others are earlier in the path (which creates
 unexpected problems when naively using ghc as the c compilation driver).

 Now for the feature request:

  assuming theres a good reason for having the cc1 choice hard coded in,
 it'd probably be helpful for ghc to issue a warning when the hardwired cc1
 refers to a gcc that isn't the first one visible when looking up gcc in
 the $path.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7904>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list