justinethier / husk-scheme

A full implementation of the Scheme programming language for the Haskell Platform.
http://justinethier.github.io/husk-scheme
MIT License
308 stars 29 forks source link

Build with -fuseffi fails #209

Closed oubiwann closed 8 years ago

oubiwann commented 8 years ago

On Mac OS X (10.10.5 with GHC 8.0.1), I am able to build vanilla husk, but with -fuseffi the compile fails:

hs-src/Language/Scheme/FFI.hs:41:19: error:
    • The constructor ‘Continuation’ should have 5 arguments, but has been given 4
    • In the pattern: Continuation env _ _ _
      In the pattern:
        [(Continuation env _ _ _),
         String targetSrcFile,
         String moduleName,
         String externalFuncName,
         String internalFuncName]
      In an equation for ‘evalfuncLoadFFI’:
          evalfuncLoadFFI
            [(Continuation env _ _ _),
             String targetSrcFile,
             String moduleName,
             String externalFuncName,
             String internalFuncName]
            = do { result <- liftIO
                             $ defaultRunGhc
                               $ do { dynflags <- GHC.getSessionDynFlags;
                                      .... };
                   defineVar env internalFuncName (IOFunc result) }
cabal: Leaving directory '.'
Failed to install husk-scheme-3.19.2
Updating documentation index /Users/oubiwann/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
husk-scheme-3.19.2 failed during the building phase. The exception was:
ExitFailure 1

On Linux (Ubuntu 15.04, GHC 7.6.3) I am not actually able to build vanilla husk or husk with ffi using cabal.

However, using Stack, I am able to build vanilla husk. When trying to build with ffi, though, I get a similar error as on Mac:

    [13 of 18] Compiling Language.Scheme.FFI ( hs-src/Language/Scheme/FFI.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Language/Scheme/FFI.o )

    /tmp/stack19582/husk-scheme-3.19.2/hs-src/Language/Scheme/FFI.hs:41:19:
        Constructor ‘Continuation’ should have 5 arguments, but has been given 4
        In the pattern: Continuation env _ _ _
        In the pattern:
          [(Continuation env _ _ _),
           String targetSrcFile,
           String moduleName,
           String externalFuncName,
           String internalFuncName]
        In an equation for ‘evalfuncLoadFFI’:
            evalfuncLoadFFI
              [(Continuation env _ _ _),
               String targetSrcFile,
               String moduleName,
               String externalFuncName,
               String internalFuncName]
              = do { result <- liftIO
                               $ defaultRunGhc
                                 $ do { dynflags <- GHC.getSessionDynFlags;
                                        .... };
                     defineVar env internalFuncName (IOFunc result) }
oubiwann commented 8 years ago

Update: The build on both Mac and Linux was done against husk-scheme-3.19.2.

justinethier commented 8 years ago

Sorry about that. I just put in a fix for this on master, if you want to try building from the latest version on github. This will be included in the 3.19.3 release.

oubiwann commented 8 years ago

No worries -- that was fast!

Thanks so much :-)

justinethier commented 8 years ago

:)

No problem, please let me know if you run into any more issues and if not we can close this out.

oubiwann commented 8 years ago

Will do -- trying to get Stack tweaked to pull from the repo, then I'll give it a shot.

oubiwann commented 8 years ago

Phew! That was anti-intuitive (Stack's handling and (non)building of non-cabal deps.

Anyway, your fix works like a chap (tested build only; haven't actually tried to use FFI yet, though...)