Skip to content

cabal repl fails to compile hsc2hs preprocessed files #2012

Open
@RyanGlScott

Description

@RyanGlScott

cabal repl seems to have unusual behavior when running packages that depend on hsc2hs. As an example, here's what happens if I try to call cabal repl on a pre-built network-0.2.5.0.0 sandbox:

> cabal get network
> cd network-2.5.0.0
> cabal sandbox init
> cabal install --only-dependencies
> cabal build
> cabal repl
Preprocessing library network-2.5.0.0...
[ 1 of 11] Compiling Network.URI      ( Network/URI.hs, dist/build/Network/URI.o ) [flags changed]
[ 2 of 11] Compiling Network.Socket.ByteString.IOVec ( dist/build/Network/Socket/ByteString/IOVec.hs, dist/build/Network/Socket/ByteString/IOVec.o ) [flags changed]
[ 3 of 11] Compiling Network.Socket.Types ( dist/build/Network/Socket/Types.hs, dist/build/Network/Socket/Types.o ) [flags changed]

Network/Socket/Types.hsc:714:16: parse error on input ‘CALLCONV’

Completely different behavior results from calling cabal repl on an unbuilt sandbox:

> cabal clean
> cabal repl
<elided network autoconf output>
Preprocessing library network-2.5.0.0...
In file included from dist/build/Network/Socket_hsc_make.c:1:0:
Socket.hsc: In function ‘main’:
Socket.hsc:996:23: error: invalid application of ‘sizeof’ to incomplete type ‘struct ucred’
/usr/local/lib/ghc-7.8.3/template-hsc.h:35:10: note: in definition of macro ‘hsc_const’
     if ((x) < 0)                                      \
          ^
Socket.hsc:996:23: error: invalid application of ‘sizeof’ to incomplete type ‘struct ucred’
/usr/local/lib/ghc-7.8.3/template-hsc.h:36:41: note: in definition of macro ‘hsc_const’
         hsc_printf ("%lld", (long long)(x));          \
                                         ^
Socket.hsc:996:23: error: invalid application of ‘sizeof’ to incomplete type ‘struct ucred’
/usr/local/lib/ghc-7.8.3/template-hsc.h:38:50: note: in definition of macro ‘hsc_const’
         hsc_printf ("%llu", (unsigned long long)(x));
                                                  ^
In file included from /usr/include/rpc/netdb.h:42:0,
                 from /usr/include/netdb.h:32,
                 from include/HsNet.h:92,
                 from Socket.hsc:23:
Socket.hsc:1002:22: error: invalid use of undefined type ‘struct ucred’
Socket.hsc:1002:5: note: in expansion of macro ‘hsc_peek’
Socket.hsc:1003:22: error: invalid use of undefined type ‘struct ucred’
Socket.hsc:1003:5: note: in expansion of macro ‘hsc_peek’
Socket.hsc:1004:22: error: invalid use of undefined type ‘struct ucred’
Socket.hsc:1004:5: note: in expansion of macro ‘hsc_peek’
compiling dist/build/Network/Socket_hsc_make.c failed (exit code 1)
command was: /bin/gcc -c dist/build/Network/Socket_hsc_make.c -o dist/build/Network/Socket_hsc_make.o -fno-stack-protector -D__GLASGOW_HASKELL__=708 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Iinclude -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/usr/local/lib/ghc-7.8.3/unix-2.7.0.1/include -I/usr/local/lib/ghc-7.8.3/time-1.4.2/include -I/usr/local/lib/ghc-7.8.3/bytestring-0.10.4.0/include -I/usr/local/lib/ghc-7.8.3/base-4.7.0.1/include -I/usr/local/lib/ghc-7.8.3/integer-gmp-0.5.1.0/include -I/usr/local/lib/ghc-7.8.3/include -I/usr/local/lib/ghc-7.8.3/include/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions