Compiling GHC with Clang

Christian Maeder Christian.Maeder at dfki.de
Wed Apr 2 14:06:12 UTC 2014


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
>
> 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 at haskell.org
>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list