You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
- foo-0 (lib:foo) (first run)
Configuring foo-0...
Preprocessing library for foo-0..
c2hs: Errors during generation of C wrappers:
./Foo.chs:9: (column 4) [ERROR] >>> Internal wrapper error!
Something went wrong generating a bare structure wrapper.
makeArg:arg=False
cdecl=CDecl [CTypeSpec (CTypeDef (Ident "WINDOW" 143904934 (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),6) (Name {nameId = 4053}))) (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),6) (Name {nameId = 4054})))] [(Just (CDeclr Nothing [CPtrDeclr [] (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),1) (Name {nameId = 4055}))] Nothing [] (OnlyPos <no file> (<no file>,-1))),Nothing,Nothing)] (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),1) (Name {nameId = 4056}))
idx=1
Run ./build again:
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
- foo-0 (lib:foo) (first run)
Preprocessing library for foo-0..
Building library for foo-0..
[1 of 1] Compiling Foo ( /home/mitchell/junk/dist-newstyle/build/x86_64-linux/ghc-8.4.3/foo-0/build/Foo.hs, /home/mitchell/junk/dist-newstyle/build/x86_64-linux/ghc-8.4.3/foo-0/build/Foo.o )
ignoring (possibly broken) abi-depends field for packages
For some reason, c2hs barfs the first time, then stops complaining. The generated file looks fine to me, even after only one invocation of ./build:
$ cat $(find dist-newstyle -name Foo.hs)
-- GENERATED by C->Haskell Compiler, version 0.28.3 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!
{-# LINE 1 "./Foo.chs" #-}
{-# language ForeignFunctionInterface #-}
module Foo where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
type Window = C2HSImp.Ptr (())
{-# LINE 7 "./Foo.chs" #-}
keypad :: (Window) -> (Bool) -> IO ((Int))
keypad a1 a2 =
let {a1' = id a1} in
let {a2' = C2HSImp.fromBool a2} in
keypad'_ a1' a2' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 9 "./Foo.chs" #-}
foreign import ccall safe "Foo.chs.h __c2hs_wrapped__keypad"
keypad'_ :: ((Window) -> (C2HSImp.CInt{-bool-} -> (IO C2HSImp.CInt)))
Sorry for the mess of info, I'm not too sure what's going on here :) Thanks.
The text was updated successfully, but these errors were encountered:
I've run into a similar issue. After c2hs invocation fails once, cabal tries to use the generated .hs file anyhow, and then fails to find it, viz.
vanessa@vanessa-desktop ~/programming/haskell/done/lzlib 🌸 cabal build
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- lzlib-0.2.0.2 (lib) (first run)
Configuring library for lzlib-0.2.0.2..
Preprocessing library for lzlib-0.2.0.2..
c2hs: C header contains errors:
cbits/lzlib.h:59: (column 23) [ERROR] >>> Syntax error !
The symbol `uint8_t' does not fit here.
vanessa@vanessa-desktop ~/programming/haskell/done/lzlib 🌸 cabal build
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- lzlib-0.2.0.2 (lib) (first run)
Preprocessing library for lzlib-0.2.0.2..
Building library for lzlib-0.2.0.2..
<no location info>: error:
module ‘Codec.Lzip.Raw’ cannot be found locally
I've put together a repo that reproduces what I thought was a
language-c
bug, but cabal is behaving oddly as well.The repo:
https://github.com/mitchellwrosen/language-c-issue-54
To reproduce:
./build
once:./build
again:For some reason,
c2hs
barfs the first time, then stops complaining. The generated file looks fine to me, even after only one invocation of./build
:Sorry for the mess of info, I'm not too sure what's going on here :) Thanks.
The text was updated successfully, but these errors were encountered: