Comments (4)
Could we instead use ghc-options
as GHC is used to compiled C files? Alternatively I think __SSE2__
is set by the C compiler itself, it is enabled, but someone needs to double-check with both gcc and llvm.
from hashable.
Ohhh, i have a way to make this work!
https://gist.github.com/cartazio/5842786
I had the same problem, this should fix it! (you need shim in the right flags via setup.hs)
replicating my above gist below
{-# Language NamedFieldPuns #-}
{-#Language BangPatterns #-}
{-# LANGUAGE CPP #-}
import Distribution.Simple
import Distribution.Simple.Program.Builtin
import Distribution.Simple.Program.Types
import Distribution.Simple.Program
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
--main = defaultMain
main :: IO ()
#if x86_64_HOST_ARCH
main = do putStrLn "we recommend using -fllvm for your numerical code. Numerics requires Clang on Mac"
defaultMainWithHooks myhook
#else
main = error "only x86_64 architectures are currently supported"
#endif
{-
this is to work around mac having a really old GCC version and AS (assembler)
darwin is OSX
-}
#if darwin_HOST_OS
myhook = set lensBuildHook2UserHooks myBuildHook simpleUserHooks
where
oldbuildhook = get lensBuildHook2UserHooks simpleUserHooks
myBuildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO ()
myBuildHook packDesc locBuildInfo =
oldbuildhook packDesc (set lensProgramConfig2LocBuildInfo newProgramConfig locBuildInfo)
where !(Just !oldGhcConf) =lookupProgram ghcProgram oldProgramConfig
oldProgramConfig = get lensProgramConfig2LocBuildInfo locBuildInfo
oldOverrideArgs = get lensProgramOverrideArgs2ConfiguredProgram oldGhcConf
newOverrideArgs = oldOverrideArgs++["-pgma clang", "-pgmc clang"]
newGhcConf = set lensProgramOverrideArgs2ConfiguredProgram newOverrideArgs oldGhcConf
newProgramConfig = updateProgram newGhcConf oldProgramConfig
#else
myhook = simpleUserHooks
#endif
{-
On mac we need to use Clang as the assembler and C compiler to enable
-}
{-basically mangle adding -pgma and pgmc to the flags for the ghc withprograms in local build info
local build info -> with program -}
--simpleUserHooks { hookedPrograms = [ghcProgram { programPostConf = \ a b -> return ["-pgma clang", "-pgmc clang"] }] }
lensProgramOverrideArgs2ConfiguredProgram :: Lens [String] ConfiguredProgram
lensProgramOverrideArgs2ConfiguredProgram =
Lens (\ConfiguredProgram{programOverrideArgs}-> programOverrideArgs)
(\newargs confprog -> confprog{programOverrideArgs = newargs})
lensBuildHook2UserHooks :: Lens (PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO ()) UserHooks
lensBuildHook2UserHooks = Lens (\UserHooks{buildHook}->buildHook) (\ bh uhook -> uhook{buildHook=bh})
lensProgramConfig2LocBuildInfo :: Lens (ProgramConfiguration) (LocalBuildInfo)
lensProgramConfig2LocBuildInfo = Lens (\LocalBuildInfo{withPrograms}-> withPrograms)
(\wprog lbi -> lbi{withPrograms= wprog})
-- my mini lens!
data Lens a b = Lens (b->a) (a ->b -> b)
infixr 9 #
(#) :: Lens a b -> Lens b c -> Lens a c
(#) lenA@(Lens getA setA) lenB@(Lens getB setB)= Lens (getA . getB) (\a c -> setB (setA a $ getB c) c)
get :: Lens a b -> b -> a
get (Lens lensGet _) b = lensGet b
set :: Lens a b -> a -> b -> b
set (Lens _ lensSet) a b = lensSet a b
from hashable.
the key point is I pass along some override flags to the ghc ALWAYS, not possible via the .cabal file, modify the above example to pass the options you want
from hashable.
SipHash is now only used in benchmarks so I'm closing this for now.
from hashable.
Related Issues (20)
- Add instances for type(s) in Data.Array.Byte (base-4.17)
- Add instances for new types in `filepath`
- Support GHC 9.4 HOT 1
- Allow GHC-9.4? HOT 2
- Unable to compile on Mac M1 architecture HOT 2
- What's the deal with Fixed? HOT 1
- Hash unstable across executions HOT 6
- hashable doesn't compile in ghc 9.6.1-alpha3 HOT 1
- Hashable 1.4.2.0 fails to build on integer-simple GHC HOT 2
- better instance Hashable IntSet? HOT 5
- ( odd x && odd y) ==> hash (x,y) == hash (negate x, negate y ) HOT 10
- using Hashed inside a tuple produces collisions HOT 4
- Caching hash value sometimes leads to equal hashes for different inputs HOT 1
- Minor release 1.4.3.0 introduces semantic changes HOT 1
- Use fromThreadId HOT 1
- Allow containers-0.7 HOT 2
- GHC99 failed to build: perhaps need to add ‘os-string’ to the build-depends HOT 2
- hashable doesn't support filepath-1.5, ghc-9.10 will bump filepath to 1.5 HOT 3
- Could AES-NI instructions be used for better Int hashes? HOT 1
- Could AES-NI instructions be used for better Int hashes? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashable.