[GHC] #8139: ghc 7.6.3 fails to build on OS X 10.9

#8139: ghc 7.6.3 fails to build on OS X 10.9
----------------------------------+-------------------------------------
Reporter: darinmorrison | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Keywords: | Operating System: Unknown/Multiple
Architecture: x86_64 (amd64) | Type of failure: None/Unknown
Difficulty: Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: |
----------------------------------+-------------------------------------
ghc 7.6.3 does not compile on OS X 10.9 (as of DP5).
There are a few issues that seem to be causing this:
1) gcc is no longer available and the clang compatibility patches of
http://ghc.haskell.org/trac/ghc/ticket/7678 are not included in 7.6.3.
2) There is some sort of bug that causes mkdirhier.sh to fail in some
cases.
3) There is another bug when compiling RtsProbes.d with DTrace. The
problem seems to be triggered by the inclusion of stdint.h. #undef-ing
HAVE_STDINT_H only for the compilation of RtsProbes.d (which then includes
inttypes.h instead) seems to work for some reason. A better solution may
be possible from someone who understands the DTrace machinery better.
The issue has has been discussed here:
https://github.com/mxcl/homebrew/issues/20546
I have come up with a tentative patch that fixes problems (2) and (3) here
(and also pasted below):
https://github.com/darinmorrison/homebrew/commit/611c76f6d6701c482559a64fe26...
{{{
diff --git a/includes/HsFFI.h b/includes/HsFFI.h
index dceabab..bc5e423 100644
--- a/includes/HsFFI.h
+++ b/includes/HsFFI.h
@@ -21,7 +21,7 @@ extern "C" {
#include "stg/Types.h"
/* get limits for integral types */
-#ifdef HAVE_STDINT_H
+#if defined HAVE_STDINT_H && !defined RTS_PROBES_D
/* ISO C 99 says:
* "C++ implementations should define these macros only when
* __STDC_LIMIT_MACROS is defined before

#8139: ghc 7.6.3 fails to build on OS X 10.9 -------------------------------------+---------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Comment (by darinmorrison): The github discussion thread for the patch is also here: https://github.com/mxcl/homebrew/pull/21960 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 fails to build on OS X 10.9 -------------------------------------+---------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Changes (by carter): * status: new => closed * resolution: => wontfix Comment: Why can't you use the binary build of ghc 7.6.3, and patch the settings file to point to a clang wrapper, as per a variant of Luke Ianni's hack? https://gist.github.com/lukexi/e11668ced04524564a8b . Based on my understanding, that should work with the newest xcode dev preview. To the best of my knowledge, there are no plans to do any further development on the 7.6.X branch of ghc, unless there is a show stopping bug that affects folks using a prebuilt GHC. This issue only comes up with building ghc from source. If you use a prebuilt GCC, would these problems happen? (yes, 10.9 doesn't provide a GCC, but you can have that locally). NB: apple doesn't support GCC anymore, as of xcode 5. All GHC developers are focused on getting 7.8.1 ready for release shortly after ICFP this fall. Accordingly, unless some core GHC devs have the time to do a 7.6.4 release (which they dont, and this has enough work arounds that I think it probably cant be considered show stopping), i'm closing this as a wontfix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by darinmorrison): * status: closed => new * failure: None/Unknown => Building GHC failed * resolution: wontfix => * difficulty: Unknown => Easy (less than 1 hour) * version: 7.6.3 => 7.7 * milestone: => 7.8.1 * os: Unknown/Multiple => MacOS X Comment: I've reopening this and changed to 7.7; you seem to have a misunderstanding about the issues reported.
Why can't you use the binary build of ghc 7.6.3, and patch the settings file to point to a clang wrapper, as per a variant of Luke Ianni's hack? https://gist.github.com/lukexi/e11668ced04524564a8b . Based on my understanding, that should work with the newest xcode dev preview.
Your hack would only be a stopgap: the issues described prevent building of HEAD on 10.9 as well. Unless these patches, or some form of them, are commited, other developers who try to compile current and future version of ghc on 10.9 are going to run into the same problems. This is regardless of whether building with clang or gcc. thoughtpolice's clang preprocessor fixes (http://ghc.haskell.org/trac/ghc/ticket/7678) don't fix them. That means: * the mkdirhier.sh bug is still there on HEAD when compiling on 10.9 * the RtsProbe.d compilation bug is still there HEAD when compiling on 10.9 Those need to be fixed.
NB: apple doesn't support GCC anymore, as of xcode 5.
Accordingly, unless some core GHC devs have the time to do a 7.6.4 release (which they dont, and this has enough work arounds that I think it
NB: I've pointed out several times now that these issues happen with clang and with HEAD. See lukexi's notes compiling HEAD with clang on 10.9: https://gist.github.com/lukexi/6191728 probably cant be considered show stopping), i'm closing this as a wontfix. I will continue my discussion in #ghc with other developers. If need be, I can submit a more direct or modified patch. It's unacceptable to simply ignore these issues when they break compilation of both current and future versions of ghc on 10.9. They require a proper fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by carter): my mistake, I misread the earlier stuff. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9
-------------------------------------+-------------------------------------
Reporter: darinmorrison | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: MacOS X | Architecture: x86_64 (amd64)
Type of failure: Building GHC | Difficulty: Easy (less than 1
failed | hour)
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+-------------------------------------
Comment (by darinmorrison):
I've modified the patch slightly so that it is no longer triggered except
on OS X and version 10.9 specifically.
{{{
diff --git a/includes/HsFFI.h b/includes/HsFFI.h
index 652fbea..a21811e 100644
--- a/includes/HsFFI.h
+++ b/includes/HsFFI.h
@@ -21,7 +21,7 @@ extern "C" {
#include "stg/Types.h"
/* get limits for integral types */
-#ifdef HAVE_STDINT_H
+#if defined HAVE_STDINT_H && !defined USE_INTTYPES_H_FOR_RTS_PROBES_D
/* ISO C 99 says:
* "C++ implementations should define these macros only when
* __STDC_LIMIT_MACROS is defined before

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by darinmorrison): * priority: normal => highest Comment: Manuel Chakravarty and Carter Schonwald suggested I go ahead and bump this to "highest" priority to make sure it gets noticed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Manuel Chakravarty and Carter Schonwald suggested I go ahead and bump
#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by chak): Replying to [comment:7 darinmorrison]: this to "highest" priority to make sure it gets noticed. The justification is that OS X 10.9 is getting close to release (the general estimate is that it will be released before the end of the month). Then, the GHC build will fail on OS X. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by george.colpitts): Isn't it more accurate to say that the problem occurs with Xcode 5 rather than with 10.9? Given that Xcode 5 is out and installs on 10.8 the problem is not limited to 10.9, correct? If so the code that conditionalizes the fix on Mac OS 10.9 should be changed to conditionalize on Xcode 5 if that is possible, correct? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by george.colpitts): * cc: george.colpitts@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by darinmorrison): Replying to [comment:10 george.colpitts]: Actually, no. This patch fixes problems that occur when building on 10.9 regardless of whether GCC or clang (Xcode 5) are used. In other words, it's not related to Xcode 5 at all. Building GHC on 10.8 with Xcode 5 does not require this patch. I've already tested this to make sure. You can see how the patch is applied with the homebrew formula I maintain here: https://github.com/darinmorrison/homebrew- haskell/blob/master/Formula/ghc.rb -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by darinmorrison): * owner: => darinmorrison Comment: Quick update on this: I've put together a proper patch for this against HEAD that I intend to submit by this weekend, closing the issue. By all indications, the patch above has been working fine and hasn't caused any failures. I want to do a little bit more testing first but otherwise I think this one is basically sorted. I'll include this patch in a 7.6.3 hotfix release for 10.9 users that also includes backported clang-fixes from thoughtpolice. The backporting is basically done but needs a bit more testing. Should be ready by next week if not sooner. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Replying to [comment:10 george.colpitts]:
Actually, no. This patch fixes problems that occur when building on 10.9 regardless of whether GCC or clang (Xcode 5) are used. In other words, it's not related to Xcode 5 at all.
Building GHC on 10.8 with Xcode 5 does not require this patch. I've already tested this to make sure.
You can see how the patch is applied with the homebrew formula I
#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by george.colpitts): Thanks, sounds like we are all set. Sorry for any confusion I may caused. "The problem" is a bit ambiguous. I was referring to the first of the 3 issues mentioned: gcc is no longer available and the clang compatibility patches of http://ghc.haskell.org/trac/ghc/ticket/7678 are not included in 7.6.3. After downloading Xcode 5 onto 10.8 I was unable to install the random-fu package getting errors that seemed the same as those mentioned at https://github.com/mxcl/homebrew/issues/20546, particularly those of dhess "GHC uses the system's C preprocessor, and Clang can't parse CPP directives that split lines. A similar problem occurs when compiling certain Haskell libraries (e.g., cereal) on 10.8 using the Xcode 5 DP and Homebrew-installed GHC." Replying to [comment:11 darinmorrison]: maintain here:
haskell/blob/master/Formula/ghc.rb -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by darinmorrison): Replying to [comment:13 george.colpitts]:
Thanks, sounds like we are all set. Sorry for any confusion I may caused.
No worries :] If you're still trying to get it to work, I'd suggest trying the homebrew tap I pointed to (http://github.com/darinmorrison/homebrew-haskell). It should "just work" on 10.8 and 10.9 with or without Xcode 5. Another option is to download the existing bindist from the GHC website and edit the SETTINGS file in the source tree. In that case, you'd have to change "C Compiler Command" to something other than "gcc" (which now points to clang). If it were me, I'd either just use the apple-gcc42 or gcc49 from homebrew. Modifying this entry in SETTINGS will fix random breakage when building Haskell packages with the bindist (caused by GHC using clang for CPP). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by darinmorrison): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by darinmorrison): Just realized these are patches against the 7.6.3-release branch. They probably still apply cleanly to HEAD but I'll go ahead and double check later tonight and upload fixed versions if necessary. Sorry about that… -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by darinmorrison): I updated the patches for HEAD but forgot to click "overwrite" for one of them. Ignore the …8139.2.patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by kazu-yamamoto): * cc: kazu@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8139: ghc 7.6.3 and ghc HEAD fails to build on OS X 10.9 -------------------------------------+------------------------------------- Reporter: darinmorrison | Owner: darinmorrison Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: clang Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by hvr): * keywords: => clang -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8139#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC