[GHC] #10221: LLVM does not work on OSX

#10221: LLVM does not work on OSX -------------------------------------------+---------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: Other Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------------+---------------------------- I can't seem to be able to use the LLVM backend on OSX. I get the error: {{{ error: unknown directive .macosx_version_min 10, 0 ^ <no location info>: Error running clang! you need clang installed to use theLLVM backend (or GHC tried to execute clang incorrectly) <no location info>: ghc: phase `Clang (Assembler)' failed (exitcode = 1) }}} This is on GHC 7.10.1 {{{ % clang --version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix yongqli@auxiliary ~/secrets/projects/stocvol % opt --version LLVM (http://llvm.org/): LLVM version 3.5.1 Optimized build with assertions. Built Jan 15 2015 (18:24:46). Default target: x86_64-apple-darwin14.1.0 Host CPU: core-avx2 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * component: Compiler => Compiler (LLVM) Comment: Please supply the smallest program that fails, with the command you use to compile it. See [wiki:ReportABug] for details. Please note that ghc doesn't have very many people working on fixing [https://ghc.haskell.org/trac/ghc/query?status=!closed&os=MacOS+X OSX specific bugs] at the moment. Volunteers welcome. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): I have seen this reported before, I think it is due to using a third-party gcc (to compile llc's output) together with an Apple llc, or something like that. Smallest program that fails is most likely `main = return ()`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by yongqli): I've just uninstall all gcc from my system but it still happens. {{{ % gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): Can you run ghc with `-v` and copy the failing invocation here? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by yongqli): {{{ % cabal build -v2 Using a sandbox located at /Users/yongqli/Documents/ghctestcase/.cabal- sandbox Reading available packages... Reading installed packages... /Applications/ghc-7.10.1.app/Contents/bin/ghc-pkg dump '--package- db=/Users/yongqli/Documents/ghctestcase/.cabal-sandbox/x86_64-osx- ghc-7.10.1-packages.conf.d' -v0 /Applications/ghc-7.10.1.app/Contents/bin/ghc --print-libdir Found no modified add-source deps. Component build order: executable 'ModelTest' creating dist/build creating dist/build/autogen Building mlmodel-0.1.0.0... /Applications/ghc-7.10.1.app/Contents/bin/ghc-pkg init dist/package.conf.inplace Preprocessing executable 'ModelTest' for mlmodel-0.1.0.0... Building executable ModelTest... creating dist/build/ModelTest creating dist/build/ModelTest/ModelTest-tmp /Applications/ghc-7.10.1.app/Contents/bin/ghc --make -no-link -fbuilding- cabal-package -O -j8 -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build/ModelTest/ModelTest-tmp -odir dist/build/ModelTest /ModelTest-tmp -hidir dist/build/ModelTest/ModelTest-tmp -stubdir dist/build/ModelTest/ModelTest-tmp -i -idist/build/ModelTest/ModelTest-tmp -isrc -idist/build/autogen -Idist/build/autogen -Idist/build/ModelTest /ModelTest-tmp -optP-include -optPdist/build/autogen/cabal_macros.h -hide- all-packages -no-user-package-db -package-db /Users/yongqli/Documents/ghctestcase/.cabal-sandbox/x86_64-osx- ghc-7.10.1-packages.conf.d -package-db dist/package.conf.inplace -package- id base-4.8.0.0-9015e10d2b2b0f71f570c3f2bbe09c8a -package-id linear-1.18.0.1-cbd55feca9eb96b48a763e434624a836 -package-id mtl-2.2.1-9986828fc95bc8459870303efaabd81e -package-id vector-0.10.12.3-46b824313b7a6e427d3957d73978f382 -package-id vector-th- unbox-0.2.1.2-103bf73b42f980755b23fd8b8b31c5b4 -XHaskell2010 -XArrows -XBangPatterns -XConstraintKinds -XEmptyDataDecls -XFlexibleContexts -XFlexibleInstances -XFunctionalDependencies -XGADTs -XGeneralizedNewtypeDeriving -XMultiParamTypeClasses -XRankNTypes -XScopedTypeVariables -XTemplateHaskell -XTypeFamilies -XTypeOperators src/Main.hs -O1 -rtsopts -threaded -fllvm -feager-blackholing [1 of 3] Compiling Stats.Types ( src/Stats/Types.hs, dist/build/ModelTest/ModelTest-tmp/Stats/Types.o ) /var/folders/vg/650_vlys0sv_dkzdclr2_68r0000gn/T/ghc21346_0/ghc21346_6.s:3:2: error: unknown directive .macosx_version_min 10, 0 ^ <no location info>: Error running clang! you need clang installed to use theLLVM backend (or GHC tried to execute clang incorrectly) <no location info>: ghc: phase `Clang (Assembler)' failed (exitcode = 1) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): I mean run ghc with `-v`, i.e., run cabal with `--ghc-option=-v`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by yongqli): {{{ % ghc -v Glasgow Haskell Compiler, Version 7.10.1, stage 2 booted by GHC version 7.6.3 Using binary package database: /Applications/ghc-7.10.1.app/Contents/lib/ghc-7.10.1/package.conf.d/package.cache Using binary package database: /Users/yongqli/.ghc/x86_64-darwin-7.10.1/package.conf.d/package.cache wired-in package ghc-prim mapped to ghc- prim-0.4.0.0-7c945cc0c41d3b7b70f3edd125671166 wired-in package integer-gmp mapped to integer- gmp-1.0.0.0-3c947e5fb6dca14804d9b2793c521b67 wired-in package base mapped to base-4.8.0.0-9015e10d2b2b0f71f570c3f2bbe09c8a wired-in package rts mapped to builtin_rts wired-in package template-haskell mapped to template- haskell-2.10.0.0-7dd4b8bf14d5c74339cc9bf2cb38ffa4 wired-in package ghc mapped to ghc-7.10.1-c4bfbbb7949f2ae4e8f34b616f56df3b wired-in package dph-seq not found. wired-in package dph-par not found. Hsc static flags: *** Deleting temp files: Deleting: *** Deleting temp dirs: Deleting: ghc: no input files Usage: For basic information, try the `--help' option. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by yongqli): See also http://lpaste.net/129949 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): You probably have a non-Apple (e.g., homebrew) `clang` installed then, that doesn't know about `.macosx_version_min`. The use of `clang` (whichever one is first on your PATH) is hard-coded. I would guess that the original issue that led to this situation (#5636) is no longer relevant, but I don't know whether using the configured C compiler is more likely to work here in general. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by jakzale): Actually, it is seems to be the other way round. Apple's clang is based on LLVM 3.5, and it seems to have some difficulties with compiling the assembly code generated by LLVM used as backend (which is probably newer). Using the version of clang that comes with the LLVM used as a backend for GHC seems to sort out the problem for me. Try `PATH=/path/to/llvm ghc -fllvm File.hs` to ensure that GHC uses the correct version of clang. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM backend does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by bgamari): yongqli, is this resolved? Starting with GHC 7.12 we'll be (optionally) shipping LLVM alongside GHC which should hopefully prevent this sort of issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM backend does not work on OSX -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => infoneeded -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10221: LLVM backend does not work on OSX ------------------------------------+-------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ------------------------------------+-------------------------------------- Changes (by George): * status: infoneeded => closed * resolution: => fixed * architecture: Unknown/Multiple => x86_64 (amd64) Comment: has worked for me for a couple of years now. Currenlty works on ghc 8.0.1 and XCode 8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10221#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC