
Hello *, I've been trying to compile GHC with Clang instead of GCC on Ubuntu, by configuring the build with CC=/usr/bin/clang ./configure --with-gcc=/usr/bin/clang but then, 'make' runs into ,---- | "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -fasm -package-name ghc-7.8.0.20140401 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -Icompiler/stage2 -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.0 -package bin-package-db-0.0.0.0 -package bytestring-0.10.4.0 -package containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2 -package hoopl-3.10.0.0 -package hpc-0.6.0.1 -package process-1.2.0.0 -package template-haskell-2.9.0.0 -package time-1.4.2 -package transformers-0.3.0.0 -package unix-2.7.0.1 -Wall -fno-warn-name-shadowing -XHaskell98 -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -XNondecreasingIndentation -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O0 -fasm -no-user-package-db -rtsopts -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -dynamic-too -c compiler/stage2/build/Lexer.hs -o compiler/stage2/build/Lexer.o -dyno compiler/stage2/build/Lexer.dyn_o | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(>=)’, namely ‘offset’ | In the expression: (offset >= "0#") | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (offset >= "0#") | In the first argument of ‘(&&)’, namely | ‘(tagToEnum# (offset >= "0#"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(==)’, namely ‘check’ | In the expression: (check == "ord_c") | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (check == "ord_c") | In the second argument of ‘(&&)’, namely | ‘(tagToEnum# (check == "ord_c"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | make[1]: *** [compiler/stage2/build/Lexer.o] Error 1 | make: *** [all] Error 2 `---- the versions of happy & alex were: ,---- | $ happy --version | Happy Version 1.19.3 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow | | $ alex --version | Alex version 3.1.3, (c) 2003 Chris Dornan and Simon Marlow `---- ...anyone know why this happens when using Clang instead of GCC, or better yet, what I need to do in order to build GHC with Clang on Linux?

I had a similar problem on a Mac (and clang) that I could solve by updating to the versions of (happy and) alex that you already use. Are you sure that Lexer.hs was freshly (re-)generated? HTH Christian Am 02.04.2014 09:14, schrieb Herbert Valerio Riedel:
Hello *,
I've been trying to compile GHC with Clang instead of GCC on Ubuntu, by configuring the build with
CC=/usr/bin/clang ./configure --with-gcc=/usr/bin/clang
but then, 'make' runs into
,---- | "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -fasm -package-name ghc-7.8.0.20140401 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -Icompiler/stage2 -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.0 -package bin-package-db-0.0.0.0 -package by testring- 0.10.4.0 -package containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2 -package hoopl-3.10.0.0 -package hpc-0.6.0.1 -package process-1.2.0.0 -package template-haskell-2.9.0.0 -package time-1.4.2 -package transformers-0.3.0.0 -package unix-2.7.0.1 -Wall -fno-warn-name-shadowing -XHaskell98 -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -XNondecreasingIndentation -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O0 -fasm -no-user-package-db -rtsopts -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -dynamic-too -c compiler/stage2/build/Lexer.hs -o compiler/stage2/build/Lexer.o -dyno compiler/stage2/build/Lexer.dyn_o | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(>=)’, namely ‘offset’ | In the expression: (offset >= "0#") | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (offset >= "0#") | In the first argument of ‘(&&)’, namely | ‘(tagToEnum# (offset >= "0#"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(==)’, namely ‘check’ | In the expression: (check == "ord_c") | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (check == "ord_c") | In the second argument of ‘(&&)’, namely | ‘(tagToEnum# (check == "ord_c"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | make[1]: *** [compiler/stage2/build/Lexer.o] Error 1 | make: *** [all] Error 2 `----
the versions of happy & alex were:
,---- | $ happy --version | Happy Version 1.19.3 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow | | $ alex --version | Alex version 3.1.3, (c) 2003 Chris Dornan and Simon Marlow `----
...anyone know why this happens when using Clang instead of GCC, or better yet, what I need to do in order to build GHC with Clang on Linux? _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On 2014-04-02 at 09:35:31 +0200, Christian Maeder wrote:
I had a similar problem on a Mac (and clang) that I could solve by updating to the versions of (happy and) alex that you already use. Are you sure that Lexer.hs was freshly (re-)generated?
...it was freshly generated (by [1] - I forced it to be recreated by removing it), and it has exactly the same content it has when using GCC for building (which succeeds compiling it) Does it make a difference whether 'Alex' was compiled by a Clang-configured GHC in the first place? [1]: "${HOME}/.cabal/bin/alex" -g --latin1 compiler/parser/Lexer.x -o compiler/stage2/build/Lexer.hs ...and ${HOME}/.cabal/bin/alex is in fact version 3.1.3

In the sources of ghc-7.8-rc2 I only find the file compiler/parser/Lexer.x.source How is this one turned into a file Lexer.x? Am 02.04.2014 09:49, schrieb Herbert Valerio Riedel:
On 2014-04-02 at 09:35:31 +0200, Christian Maeder wrote:
I had a similar problem on a Mac (and clang) that I could solve by updating to the versions of (happy and) alex that you already use. Are you sure that Lexer.hs was freshly (re-)generated?
...it was freshly generated (by [1] - I forced it to be recreated by removing it), and it has exactly the same content it has when using GCC for building (which succeeds compiling it)
Does it make a difference whether 'Alex' was compiled by a Clang-configured GHC in the first place?
[1]: "${HOME}/.cabal/bin/alex" -g --latin1 compiler/parser/Lexer.x -o compiler/stage2/build/Lexer.hs
...and ${HOME}/.cabal/bin/alex is in fact version 3.1.3

Am 02.04.2014 10:21, schrieb Christian Maeder:
In the sources of ghc-7.8-rc2 I only find the file compiler/parser/Lexer.x.source
How is this one turned into a file Lexer.x?
Just by renaming! It seems Lexer.x was moved to Lexer.x.source in order to avoid regeneration of Lexer.hs. C.
Am 02.04.2014 09:49, schrieb Herbert Valerio Riedel:
On 2014-04-02 at 09:35:31 +0200, Christian Maeder wrote:
I had a similar problem on a Mac (and clang) that I could solve by updating to the versions of (happy and) alex that you already use. Are you sure that Lexer.hs was freshly (re-)generated?
...it was freshly generated (by [1] - I forced it to be recreated by removing it), and it has exactly the same content it has when using GCC for building (which succeeds compiling it)
Does it make a difference whether 'Alex' was compiled by a Clang-configured GHC in the first place?
[1]: "${HOME}/.cabal/bin/alex" -g --latin1 compiler/parser/Lexer.x -o compiler/stage2/build/Lexer.hs
...and ${HOME}/.cabal/bin/alex is in fact version 3.1.3
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

Probably I could only update alex and happy after using https://www.haskell.org/platform/ghc-clang-wrapper that indirectly solved my problem. Sorry for the confusion. Christian Am 02.04.2014 09:35, schrieb Christian Maeder:
I had a similar problem on a Mac (and clang) that I could solve by updating to the versions of (happy and) alex that you already use. Are you sure that Lexer.hs was freshly (re-)generated?
HTH Christian
Hello *,
I've been trying to compile GHC with Clang instead of GCC on Ubuntu, by configuring the build with
CC=/usr/bin/clang ./configure --with-gcc=/usr/bin/clang
but then, 'make' runs into
,---- | "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -fasm -package-name ghc-7.8.0.20140401 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -Icompiler/stage2 -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.0 -package bin-package-db-0.0.0.0 -package by testring- 0.10.4.0 -package containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2 -package hoopl-3.10.0.0 -package hpc-0.6.0.1 -package
Am 02.04.2014 09:14, schrieb Herbert Valerio Riedel: process-1.2.0.0 -package template-haskell-2.9.0.0 -package time-1.4.2 -package transformers-0.3.0.0 -package unix-2.7.0.1 -Wall -fno-warn-name-shadowing -XHaskell98 -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -XNondecreasingIndentation -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O0 -fasm -no-user-package-db -rtsopts -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -dynamic-too -c compiler/stage2/build/Lexer.hs -o compiler/stage2/build/Lexer.o -dyno compiler/stage2/build/Lexer.dyn_o
| | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(>=)’, namely ‘offset’ | In the expression: (offset >= "0#") | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (offset >= "0#") | In the first argument of ‘(&&)’, namely | ‘(tagToEnum# (offset >= "0#"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(==)’, namely ‘check’ | In the expression: (check == "ord_c") | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (check == "ord_c") | In the second argument of ‘(&&)’, namely | ‘(tagToEnum# (check == "ord_c"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | make[1]: *** [compiler/stage2/build/Lexer.o] Error 1 | make: *** [all] Error 2 `----
the versions of happy & alex were:
,---- | $ happy --version | Happy Version 1.19.3 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow | | $ alex --version | Alex version 3.1.3, (c) 2003 Chris Dornan and Simon Marlow `----
...anyone know why this happens when using Clang instead of GCC, or better yet, what I need to do in order to build GHC with Clang on Linux? _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

Maybe alex needs to be compiled with clang, too? C. Am 02.04.2014 09:14, schrieb Herbert Valerio Riedel:
Hello *,
I've been trying to compile GHC with Clang instead of GCC on Ubuntu, by configuring the build with
CC=/usr/bin/clang ./configure --with-gcc=/usr/bin/clang
but then, 'make' runs into
,---- | "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H64m -O0 -fasm -package-name ghc-7.8.0.20140401 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -Icompiler/stage2 -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.18.1.3 -package array-0.5.0.0 -package base-4.7.0.0 -package bin-package-db-0.0.0.0 -package by testring- 0.10.4.0 -package containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2 -package hoopl-3.10.0.0 -package hpc-0.6.0.1 -package process-1.2.0.0 -package template-haskell-2.9.0.0 -package time-1.4.2 -package transformers-0.3.0.0 -package unix-2.7.0.1 -Wall -fno-warn-name-shadowing -XHaskell98 -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -XNondecreasingIndentation -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O0 -fasm -no-user-package-db -rtsopts -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -dynamic-too -c compiler/stage2/build/Lexer.hs -o compiler/stage2/build/Lexer.o -dyno compiler/stage2/build/Lexer.dyn_o | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(>=)’, namely ‘offset’ | In the expression: (offset >= "0#") | | compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (offset >= "0#") | In the first argument of ‘(&&)’, namely | ‘(tagToEnum# (offset >= "0#"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(==)’, namely ‘check’ | In the expression: (check == "ord_c") | | compiler/stage2/build/Lexer.hs:2426:73: | Couldn't match expected type ‘Int#’ with actual type ‘Bool’ | In the expression: (check == "ord_c") | In the second argument of ‘(&&)’, namely | ‘(tagToEnum# (check == "ord_c"))’ | In the expression: | (tagToEnum# (offset >= "0#")) && (tagToEnum# (check == "ord_c")) | make[1]: *** [compiler/stage2/build/Lexer.o] Error 1 | make: *** [all] Error 2 `----
the versions of happy & alex were:
,---- | $ happy --version | Happy Version 1.19.3 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow | | $ alex --version | Alex version 3.1.3, (c) 2003 Chris Dornan and Simon Marlow `----
...anyone know why this happens when using Clang instead of GCC, or better yet, what I need to do in order to build GHC with Clang on Linux? _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On 2014-04-02 at 09:14:28 +0200, Herbert Valerio Riedel wrote: [...]
| compiler/stage2/build/Lexer.hs:2426:41: | Couldn't match expected type ‘[Char]’ with actual type ‘Int#’ | In the first argument of ‘(>=)’, namely ‘offset’ | In the expression: (offset >= "0#")
FYI: I've found the cause, it's due to Clang's pre-processor: The line in question is new_s = if GTE(offset,0#) && EQ(check,ord_c) while the GET and EQ macros are defined as #if __GLASGOW_HASKELL__ > 706 #define GTE(n,m) (tagToEnum# (n >=# m)) #define EQ(n,m) (tagToEnum# (n ==# m)) #else #define GTE(n,m) (n >=# m) #define EQ(n,m) (n ==# m) #endif However, this is preprocessed into new_s = if (tagToEnum# (offset >="0#")) && (tagToEnum# (check =="ord_c")) meaning that Clang's CPP made use of the stringifying operator '#' to turn '0#' into '"0#"'

On 2014-04-02 at 09:14:28 +0200, Herbert Valerio Riedel wrote:
Hello *,
I've been trying to compile GHC with Clang instead of GCC on Ubuntu, by configuring the build with
CC=/usr/bin/clang ./configure --with-gcc=/usr/bin/clang
but then, 'make' runs into
[...] Just as follow-up, the problem was due to the 'clang-3.4' package included by Ubuntu Saucy[1] not being a proper 3.4 release but rather a pre-release snapshot of 3.4 which lacked an important fix[2]; After upgrading to Ubuntu Trusty which features proper clang-3.4 package, the problems went away. [1]: http://packages.ubuntu.com/saucy/clang-3.4 [2]: http://permalink.gmane.org/gmane.comp.compilers.clang.scm/76596
participants (3)
-
Christian Maeder
-
Herbert Valerio Riedel
-
Herbert Valerio Riedel