[GHC] #7678: GHC should compile cleanly with clang

#7678: GHC should compile cleanly with clang --------------------------------+------------------------------------------- Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: clang Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: 7602 | Related: --------------------------------+------------------------------------------- I'm running into several difficulties (which I'll catalog shortly) building GHC HEAD with Clang 3.2. These mostly seem to be difficulties relating to the preprocessor and the fact clang does not really respect ```-traditional-cpp``` mode, and that it is stricter than gcc about whitespace and whatnot too. This means code like: {{{ {-# RULES "thing" ... #-} }}} becomes invalid: ```clang``` is strict about the fact that preprocessor definitions must occur on the beginning of a line. There seems to be a bug in the preprocessor directive source code to this effect (that it doesn't handle whitespace before a directive.) It's quite unfortunate, because we do this a lot. This also causes build failures in the parser due to some crazy CPP hackery we do. I'll follow up with that shortly. As a workaround, we may have to force ```CPP``` to just continue being ```cpp``` which will Do The Right Thing, while ```CC``` will use ```clang``` instead. Or we'll have to have some script that seds whitespace out or something. This currently blocks #7602 since I can't test my fix otherwise. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang
--------------------------------+-------------------------------------------
Reporter: thoughtpolice | Owner: thoughtpolice
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.7 | Keywords: clang
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Building GHC failed | Blockedby:
Blocking: 7602 | Related:
--------------------------------+-------------------------------------------
Comment(by aseipp@…):
commit 213e1c71e8c574e989f463ca623bef6d2dcccea6
{{{
Author: Austin Seipp

#7678: GHC should compile cleanly with clang
--------------------------------+-------------------------------------------
Reporter: thoughtpolice | Owner: thoughtpolice
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.7 | Keywords: clang
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Building GHC failed | Blockedby:
Blocking: 7602 | Related:
--------------------------------+-------------------------------------------
Comment(by aseipp@…):
commit 61e8d5df26522b01922bc5358b9c233de0d1fc29
{{{
Author: Austin Seipp

#7678: GHC should compile cleanly with clang ---------------------------------+------------------------------------------ Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Keywords: clang | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7602 Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * priority: normal => high * difficulty: => Unknown * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang ---------------------------------+------------------------------------------ Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Keywords: clang | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7602 Related: | ---------------------------------+------------------------------------------ Changes (by lelf): * cc: anton.nik@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang ---------------------------------+------------------------------------------ Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Keywords: clang | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7602 Related: | ---------------------------------+------------------------------------------ Comment(by carter): I'm able to suppress the spurious CPP warnings clang gives by wrapping clang in the following script and then on my mac I can use the patched Clang instead of gcc to build my haaskell code fine with GHC 7.6.3 {{{ #! /bin/sh clang -Wno-unicode -Wno-trigraphs -Wno-invalid-pp-token -Wno-return- type $@ }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang ---------------------------------+------------------------------------------ Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Keywords: clang | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7602 Related: | ---------------------------------+------------------------------------------ Comment(by carter): i'm seeing the following build error when i try to build ghc head using clang head: {{{ In file included from compiler/basicTypes/DataCon.lhs:49:0: compiler/HsVersions.h:29:5: error: '#' is not followed by a macro parameter {-# NOINLINE name #-}; \ ^ compiler/HsVersions.h:34:5: error: '#' is not followed by a macro parameter {-# NOINLINE name #-}; \ ^ 2 errors generated. make[1]: *** [compiler/stage1/build/.depend-v.haskell] Error 1 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang ---------------------------------+------------------------------------------ Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Keywords: clang | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7602 Related: | ---------------------------------+------------------------------------------ Comment(by carter): the pragma problem i just posted seems to happen whether or not i I use quick or quick-llvm , and gcc or clang.... -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7678: GHC should compile cleanly with clang ----------------------------------+----------------------------------------- Reporter: thoughtpolice | Owner: thoughtpolice Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: clang Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: 7602 | Related: ----------------------------------+----------------------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed Comment: HEAD as of commit 1a9832 can now build a working stage1 and stage2 compiler when using Clang. primitive fails to build due to a Clang 'bug' descibed in http://llvm.org/bugs/show_bug.cgi?id=16371 but this can be worked around. I'll be committing this fix later, and with that a full stage2 build can happen. I'm marking this ticket closed; further problems will be put into other tickets. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7678#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (2)
-
GHC
-
GHC