Describe the bug
Building a package depending on network fails due to the error below after chcp 65001:
realgcc.exe: error: dist\build\Network\Socket\Info_hsc_make.o: No such file or directory
To Reproduce
Steps to reproduce the behavior:
$ mkdir cabal-depending-on-network
$ cd cabal-depending-on-network
# Delete %APPDATA%\cabal\store\network-3.1.1.0-* in advance.
# Then append `, network == 3.1.1.0` to build-depends of cabal-depending-on-network.cabal
# (I haven't tried the other versions of network)
$ chcp 65001
Active code page: 65001
$ cabal v2-build
Build profile: -w ghc-8.8.1 -O1
In order, the following will be built (use -v for more details):
- network-3.1.1.0 (lib:network) (requires build)
- cabal-depending-on-network-0.1.0.0 (exe:cabal-depending-on-network) (dependency rebuilt)
Starting network-3.1.1.0 (all, legacy fallback)
Building network-3.1.1.0 (all, legacy fallback)
Failed to build network-3.1.1.0.
Build log (
C:\t\\cabal\logs\ghc-8.8.1\network-3.1.1.0-fd9ea96187cde462dc7ff77f5aaeaf7924808ea8.log
):
Preprocessing library for network-3.1.1.0..
realgcc.exe: error: dist\build\Network\Socket\Info_hsc_make.o: No such file or directory
linking dist\build\Network\Socket\Info_hsc_make.o failed (exit code 1)
command was: C:\ghc\ghc-8.8.1\lib\../mingw/bin\gcc.exe dist\build\Network\Socket\Info_hsc_make.o dist\build\Network\Socket\Info_hsc_utils.o -o dist\build\Network\Socket\Info_hsc_make.exe -lws2_32 -liphlpapi -LC:\ghc\ghc-8.8.1\lib\bytestring-0.10.9.0 -LC:\ghc\ghc-8.8.1\lib\deepseq-1.4.4.0 -LC:\ghc\ghc-8.8.1\lib\array-0.5.4.0 -LC:\ghc\ghc-8.8.1\lib\base-4.13.0.0 -lwsock32 -luser32 -lshell32 -lmsvcrt -lmingw32 -lmingwex -LC:\ghc\ghc-8.8.1\lib\integer-gmp-1.0.2.0 -LC:\ghc\ghc-8.8.1\lib\ghc-prim-0.5.3 -luser32 -lmingw32 -lmingwex -LC:\ghc\ghc-8.8.1\lib/rts -lm -lwsock32 -lgdi32 -lwinmm -ldbghelp -lpsapi
b\../mingw/bin\gcc.exe -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/uio.h usability... no
checking sys/uio.h presence... no
checking for sys/uio.h... no
checking sys/socket.h usability... no
checking sys/socket.h presence... no
checking for sys/socket.h... no
checking netinet/in.h usability... no
checking netinet/in.h presence... no
checking for netinet/in.h... no
checking netinet/tcp.h usability... no
checking netinet/tcp.h presence... no
checking for netinet/tcp.h... no
checking sys/un.h usability... no
checking sys/un.h presence... no
checking for sys/un.h... no
checking arpa/inet.h usability... no
checking arpa/inet.h presence... no
checking for arpa/inet.h... no
checking netdb.h usability... no
checking netdb.h presence... no
checking for netdb.h... no
checking net/if.h usability... no
checking net/if.h presence... no
checking for net/if.h... no
checking netioapi.h usability... yes
checking netioapi.h presence... yes
checking for netioapi.h... yes
checking for struct ucred... no
checking for gai_strerror... no
checking for gethostent... no
checking for accept4... no
checking for getpeereid... no
checking whether AI_ADDRCONFIG is declared... no
checking whether AI_ALL is declared... no
checking whether AI_NUMERICSERV is declared... no
checking whether AI_V4MAPPED is declared... no
checking whether IPV6_V6ONLY is declared... yes
checking whether IPPROTO_IP is declared... yes
checking whether IPPROTO_TCP is declared... yes
checking whether IPPROTO_IPV6 is declared... yes
checking whether SO_PEERCRED is declared... no
checking for struct msghdr.msg_control... no
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... no
configure: creating ./network.buildinfo
configure: creating ./config.status
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler
cabal.exe: Failed to build network-3.1.1.0 (which is required by
exe:cabal-depending-on-network from cabal-depending-on-network-0.1.0.0). See
the build log above for details.
Expected behavior
The cabal-depending-on-network package should be build with network-3.1.1.0.
System information
cabal --version:Additional note
stack build doesn't cause the same issue.APPDATA and USERPROFILE don't contain locale characters.I'am not sure if cabal-3.0.0.0 could be used with ghc-8.8.1, see https://github.com/haskell/cabal/issues/6327~~
.exe from http://downloads.haskell.org/cabal or via choco install cabal)Thanks for clarification i misreaded the issue.
I've tried to reproduce and cabal built succesfully the package in my windows 10 using cabal-3.0.0.0 with cabal get nerwork-3.1.1.0 && cd nerwork-3.1.1.0 && cabal build
@igrep have you tried to build it standalone?
@jneira No. Can that be a workaround? If I remember correctly, when I tried cabal v2-build network in the same directory where I met the same problem for the first time, it was successful but cabal v2-build after it resulted in the same (still had to build network package, then exited with the same error).
So I guess building standalone isn't a workaround.
This isn't a cabal issue.
realgcc.exe: error: dist\build\Network\Socket\Info_hsc_make.o: No such file or directory
This is coming from hsc2hs which failed while processing Info.hsc. The current latest version of hsc2hs has a race condition on Windows which makes it non-deterministically work or fail.
The git version is more stable but there's no release for it yet on Hackage.
I recall seeing some discussion about hs2hsc on #ghc channel. I suppose the hs2hsc will be released around GHC-8.10 release time, the latest.
@Mistuke thanks for your insight. I'm closing this, as there's nothing to be done.
@igrep as a workaround you can build and install hsc2hs from source from git. That should give you a working version.
Most helpful comment
6327 is about building cabal-install-3.0 w/ GHC 8.8.1; in fact, lib:Cabal 3.0 (and transitively exe:cabal-install-3.0) is required for proper GHC 8.8.1 support (but you can't build exe:cabal-install-3.0.0 w/ GHC 8.8.1 -- but in case of windows you can simply grab either the cabal 3.0
.exefrom http://downloads.haskell.org/cabal or viachoco install cabal)