3

I am trying to run a few basic Haskell snippets on a windows 10 machine with GHC Version 8.2.2 via Stack tool. I get the following access violation error:

e:\reset\as>stack runghc a.hs
stack runghc a.hs
Access violation in generated code when executing data at ffffffffac0039e0

the contents of "a.hs" are:

{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE QuasiQuotes     #-}
{-# LANGUAGE TemplateHaskell     #-}
{-# LANGUAGE TypeFamilies     #-}

import Yesod

data HelloWorld = HelloWorld

mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]

instance Yesod HelloWorld

getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]

main :: IO()
main = warp 3000 HelloWorld

I was able to get a few results in return to my google-fu, but I don't think there is a proper solution for this version of ghci:

temporary solution: Haskell-Stack: Access violation error during build

violation on GHC 8.0.2: https://github.com/hedgehogqa/haskell-hedgehog/issues/111

works while compiling to dll: Access violation in GHCI

Is there an explanation for why this error occurs, and how I can avoid it?

Edit: @epsilonhable asked if compiling works; I tried it, it compiles and runs with no issues.

e:\dir\reset\as>stack ghc a.hs
stack ghc a.hs
[1 of 1] Compiling Main             ( a.hs, a.o )
Linking a.exe ...


e:\HiHenry\reset\as>
e:\HiHenry\reset\as>a.exe
a.exe
01/Feb/2018:15:59:07 +0530 [Info#yesod-core] Application launched @(yesod-core-1.4.37.3-JVciWQSLH8J1mylGVdkmic:Yesod.Core.Dispatch .\Yesod\Core\Dispatch.hs:166:11)
127.0.0.1 - - [01/Feb/2018:15:59:50 +0530] "GET / HTTP/1.1" 200 82 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
127.0.0.1 - - [01/Feb/2018:15:59:50 +0530] "GET /favicon.ico HTTP/1.1" 404 118 "http://127.0.0.1:3001/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"

Running it via interpreter(stack runghc a.hs) still results in an access violation.

Lyt_Seeker
  • 93
  • 1
  • 5
  • Does it work when you compile instead of interpreting it? – epsilonhalbe Jan 31 '18 at 19:11
  • @epsilonhalbe, yes it does! – Lyt_Seeker Feb 01 '18 at 13:53
  • @epsilonhalbe, yes it does! e:\dir\reset\as>stack ghc a.hs stack ghc a.hs [1 of 1] Compiling Main ( a.hs, a.o ) Linking a.exe ... e:\HiHenry\reset\as> e:\HiHenry\reset\as>a.exe a.exe 01/Feb/2018:15:59:07 +0530 [Info#yesod-core] Application launched @(yesod-core-1.4.37.3-JVciWQSLH8J1mylGVdkmic:Yesod.Core.Dispatch .\Yesod\Core\Dispatch.hs:166:11) 127.0.0.1 - - [01/Feb/2018:15:59:50 +0530] "GET / HTTP/1.1" 200 82 "" – Lyt_Seeker Feb 01 '18 at 14:01
  • Does GHCi work _at all_ (without a module like `a.hs`)? – leftaroundabout Feb 01 '18 at 14:07
  • @leftaroundabout, yes it does, a simple hello world program works fine. – Lyt_Seeker Feb 01 '18 at 14:51
  • Often antivirus software can cause problems with GHC-generated code. In particular `HitmanPro` is a known offender. You may want to try after disabling such AV. – sclv Feb 02 '18 at 22:17
  • hey @sclv, tried to disable Symantec end point protection on my machine and retry, still the same error. I don't have hitmanpro installed. – Lyt_Seeker Feb 03 '18 at 06:13
  • 1
    one other workaround is the `-fexternal-interpreter` flag. Not sure what else could be at issue... – sclv Feb 04 '18 at 04:44

0 Answers0