Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to install network-2.4.1.1 (current head), hsc2hs: dist/build/Network/BSD.hs: openFile: unsupported operation #3

Open
billdozr opened this issue Sep 4, 2013 · 9 comments

Comments

@billdozr
Copy link

billdozr commented Sep 4, 2013

Not sure if this is the best place to raise this issue, but I thought I'd put it here since it's related to building agains the GHC-iOS target.

I cloned the current https://github.com/haskell/network (it should have the latest patch for ARM/iOS fixes) and ran:

autoreconf
i386-apple-darwin11-cabal install --disable-library-profiling -v2

I got the below error:

Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install network-2.4.1.1
Waiting for install task to finish...
Configuring network-2.4.1.1...
Dependency base ==4.7.0.0: using base-4.7.0.0
Dependency bytestring ==0.10.3.0: using bytestring-0.10.3.0
Dependency parsec ==3.1.3: using parsec-3.1.3
Dependency unix ==2.7.0.0: using unix-2.7.0.0
'/usr/local/ghc-ios-sim/bin/i386-apple-darwin11-ghc' '--info'
Using Cabal-1.18.0 compiled by ghc-7.6
Using compiler: ghc-7.7.20130831
Using install prefix:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1
Binaries installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/bin
Libraries installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/lib
Private binaries installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/libexec
Data files installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/share
Documentation installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/doc
Configuration files installed in:
/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/etc
Using alex version 3.0.5 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.2.1 given by user at:
/Users/alen/Development/haskell/projects/ghc-ios-scripts/i386-apple-darwin11-gcc
Using ghc version 7.7.20130831 given by user at:
/usr/local/ghc-ios-sim/bin/i386-apple-darwin11-ghc
Using ghc-pkg version 7.7.20130831 given by user at:
/usr/local/ghc-ios-sim/bin/i386-apple-darwin11-ghc-pkg
No greencard found
Using haddock version 2.13.2 found on system at: /usr/bin/haddock
Using happy version 1.18.10 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /usr/bin/hpc
Using hsc2hs version 0.67 found on system at:
/Users/alen/Library/Haskell/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld given by user at:
/Users/alen/Development/haskell/projects/ghc-ios-scripts/i386-apple-darwin11-ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.28 found on system at: /usr/local/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
sh ./configure --with-compiler=ghc --prefix=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1 --bindir=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/bin --libdir=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/lib --libexecdir=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/libexec --datadir=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/share --sysconfdir=/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/network-2.4.1.1/etc --host=i386-apple-darwin11 --with-gcc=/Users/alen/Development/haskell/projects/ghc-ios-scripts/i386-apple-darwin11-gcc
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking build system type... i386-apple-darwin12.4.0
checking host system type... i386-apple-darwin11
checking for i386-apple-darwin11-gcc... i386-apple-darwin11-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i386-apple-darwin11-gcc accepts -g... yes
checking for i386-apple-darwin11-gcc option to accept ISO C89... none needed
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... i386-apple-darwin11-gcc -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 fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.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 sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking ws2tcpip.h usability... no
checking ws2tcpip.h presence... no
checking for ws2tcpip.h... no
checking wspiapi.h usability... no
checking wspiapi.h presence... no
checking for wspiapi.h... no
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking for readlink... yes
checking for symlink... yes
checking for struct msghdr.msg_control... yes
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... yes
checking for in_addr_t in netinet/in.h... yes
checking for SO_PEERCRED and struct ucred in sys/socket.h... no
checking for head_libws2_32_a in -lws2_32... no
checking for getaddrinfo... yes
checking for gai_strerror... yes
checking whether AI_ADDRCONFIG is declared... yes
checking whether AI_ALL is declared... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether AI_V4MAPPED is declared... yes
checking whether IPV6_V6ONLY is declared... yes
checking for sendfile in sys/sendfile.h... no
checking for sendfile in sys/socket.h... yes
checking for gethostent... yes
checking for accept4... no
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
config.status: include/HsNetworkConfig.h is unchanged
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Reading parameters from ./network.buildinfo
Reading parameters from ./network.buildinfo
Component build order: library
creating dist/build
creating dist/build/autogen
Building network-2.4.1.1...
Preprocessing library network-2.4.1.1...
creating dist/build/Network
/Users/alen/Library/Haskell/bin/hsc2hs --cc=/Users/alen/Development/haskell/projects/ghc-ios-scripts/i386-apple-darwin11-gcc --ld=/Users/alen/Development/haskell/projects/ghc-ios-scripts/i386-apple-darwin11-gcc --cflag=-D__GLASGOW_HASKELL
_=707 --cflag=-Ddarwin_BUILD_OS=1 --cflag=-Dx86_64_BUILD_ARCH=1 --cflag=-Dios_HOST_OS=1 --cflag=-Di386_HOST_ARCH=1 --cflag=-Iinclude --cflag=-DCALLCONV=ccall --cflag=-I/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/unix-2.7.0.0/include --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-I/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/time-1.4.1/include --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-I/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/bytestring-0.10.3.0/include --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-I/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/base-4.7.0.0/include --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --cflag=-I/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/include --cflag=-Idist/build/autogen --cflag=-include --cflag=dist/build/autogen/cabal_macros.h --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/unix-2.7.0.0 --lflag=-ldl --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/time-1.4.1 --lflag=-L/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/parsec-3.1.3/lib --lflag=-L/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/text-0.11.3.1/lib --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/old-locale-1.0.0.5 --lflag=-L/Users/alen/Library/Haskell/ghc-7.7.20130831/lib/mtl-2.1.2/lib --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/transformers-0.3.0.0 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/bytestring-0.10.3.0 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/deepseq-1.3.0.2 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/array-0.4.0.2 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/base-4.7.0.0 --lflag=-liconv --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/integer-simple-0.1.1.0 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/ghc-prim-0.3.1.0 --lflag=-L/usr/local/ghc-ios-sim/lib/ghc-7.7.20130831/rts-1.0 --lflag=-lm --lflag=-ldl -o dist/build/Network/BSD.hs Network/BSD.hsc --cross-compile
hsc2hs: dist/build/Network/BSD.hs: openFile: unsupported operation (unknown file type)
Failed to install network-2.4.1.1
cabal: Error: some packages failed to install:
network-2.4.1.1 failed during the building phase. The exception was:
ExitFailure 1

More details of my setup:

GCC: head (7.7x)

Mac OS X version: 10.8.4

GCC: 4.2.1

LLVM: 3.0

XCode: 4.6.3

@the-real-blackh
Copy link
Member

I haven't seen that before. But here's something to check: Tell me what version of hsc2hs it is that you're using: /Users/alen/Library/Haskell/bin/hsc2hs

Make sure it's the latest according to our instructions.

@billdozr
Copy link
Author

billdozr commented Sep 4, 2013

Yes, I can confirm that I followed the instructions for getting the latest hsc2hs and also that it is pointing to the latest version in my path:

/Users/alen/Library/Haskell/bin/hsc2hs -> ../ghc-7.7.20130831/lib/hsc2hs-0.67/bin/hsc2hs

hsc2hs version 0.67

@the-real-blackh
Copy link
Member

It works for me. You'll have to debug it. Is the file dist/build/Network/BSD.hs present? Is there anything odd about it?

stephen-blackheaths-mac-mini:install blackh$ git clone https://github.com/haskell/network
Cloning into 'network'...
remote: Counting objects: 2649, done.
remote: Compressing objects: 100% (1310/1310), done.
remote: Total 2649 (delta 1333), reused 2555 (delta 1248)
Receiving objects: 100% (2649/2649), 683.19 KiB | 327 KiB/s, done.
Resolving deltas: 100% (1333/1333), done.
stephen-blackheaths-mac-mini:network blackh$ autoreconf
stephen-blackheaths-mac-mini:network blackh$ i386-apple-darwin11-cabal install --disable-library-profiling
Resolving dependencies...
Configuring network-2.4.1.1...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
checking build system type... i386-apple-darwin12.4.0
checking host system type... i386-apple-darwin11
checking for i386-apple-darwin11-gcc... i386-apple-darwin11-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i386-apple-darwin11-gcc accepts -g... yes
checking for i386-apple-darwin11-gcc option to accept ISO C89... none needed
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... i386-apple-darwin11-gcc -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 fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.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 sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking ws2tcpip.h usability... no
checking ws2tcpip.h presence... no
checking for ws2tcpip.h... no
checking wspiapi.h usability... no
checking wspiapi.h presence... no
checking for wspiapi.h... no
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking for readlink... yes
checking for symlink... yes
checking for struct msghdr.msg_control... yes
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... yes
checking for in_addr_t in netinet/in.h... yes
checking for SO_PEERCRED and struct ucred in sys/socket.h... no
checking for _head_libws2_32_a in -lws2_32... no
checking for getaddrinfo... yes
checking for gai_strerror... yes
checking whether AI_ADDRCONFIG is declared... yes
checking whether AI_ALL is declared... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether AI_V4MAPPED is declared... yes
checking whether IPV6_V6ONLY is declared... yes
checking for sendfile in sys/sendfile.h... no
checking for sendfile in sys/socket.h... yes
checking for gethostent... yes
checking for accept4... no
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Building network-2.4.1.1...
Preprocessing library network-2.4.1.1...
[ 1 of 11] Compiling Network.URI ( Network/URI.hs, dist/build/Network/URI.o )
[ 2 of 11] Compiling Network.Socket.ByteString.IOVec ( dist/build/Network/Socket/ByteString/IOVec.hs, dist/build/Network/Socket/ByteString/IOVec.o )
[ 3 of 11] Compiling Network.Socket.Types ( dist/build/Network/Socket/Types.hs, dist/build/Network/Socket/Types.o )
[ 4 of 11] Compiling Network.Socket.Internal ( dist/build/Network/Socket/Internal.hs, dist/build/Network/Socket/Internal.o )
[ 5 of 11] Compiling Network.Socket ( dist/build/Network/Socket.hs, dist/build/Network/Socket.o )
[ 6 of 11] Compiling Network.Socket.ByteString.MsgHdr ( dist/build/Network/Socket/ByteString/MsgHdr.hs, dist/build/Network/Socket/ByteString/MsgHdr.o )
[ 7 of 11] Compiling Network.Socket.ByteString.Internal ( Network/Socket/ByteString/Internal.hs, dist/build/Network/Socket/ByteString/Internal.o )
[ 8 of 11] Compiling Network.Socket.ByteString ( dist/build/Network/Socket/ByteString.hs, dist/build/Network/Socket/ByteString.o )
[ 9 of 11] Compiling Network.Socket.ByteString.Lazy ( dist/build/Network/Socket/ByteString/Lazy.hs, dist/build/Network/Socket/ByteString/Lazy.o )
[10 of 11] Compiling Network.BSD ( dist/build/Network/BSD.hs, dist/build/Network/BSD.o )
[11 of 11] Compiling Network ( Network.hs, dist/build/Network.o )
In-place registering network-2.4.1.1...
Running Haddock for network-2.4.1.1...
cabal: Haddock's internal GHC version must match the configured GHC version.
The GHC version is 7.7.20130821 but haddock is using GHC version 6.12.3
Installing library in
/Users/blackh/.cabal/lib/i386-ios-ghc-7.7.20130821/network-2.4.1.1
Registering network-2.4.1.1...
Installed network-2.4.1.1
stephen-blackheaths-mac-mini:network blackh$

@billdozr
Copy link
Author

billdozr commented Sep 4, 2013

Something really strange is going on my end. The BSD.hs was empty.
I cloned the repo again and ran the build again but now I got the error in a different place:

hsc2hs: dist/build/Network/Socket_hsc_test451.txt: openFile: unsupported operation (unknown file type)

Guess what happens when I reran autoconf/autreconf again and build?
Fails in different place.

To many side effects for my liking. :)

@the-real-blackh
Copy link
Member

I think that's an effect of the elusive Higgs Boson.

Here's a suggestion: Try running it without the --cross-compile option (edit your i386-apple-darwin11-cabal script)... With that option turned on, it runs hsc2hs zillions of times - far more times than with it turned off. It could be some kind of weird resource leak.

@the-real-blackh
Copy link
Member

I should add that --cross-compile is absolutely necessary when building for arm, but can be left out for the simulator (because it's x86-based and the executables can actually be run locally).

@billdozr
Copy link
Author

billdozr commented Sep 4, 2013

That worked. Perhaps something worth noting on the wiki, under the cabal section, should others come across this problem. Something along the lines of:
In the rare case that you observe the effect of the elusive Higgs Boson when running the simulator cabal script, try and remove the --cross-compile option.

@the-real-blackh
Copy link
Member

I think we're going to have to find a proper solution, because we need --cross-compile on ARM.

@billdozr
Copy link
Author

billdozr commented Sep 4, 2013

Ping me @the-real-blackh should you need me to rerun the scenario again at some later stage alen dot ribic @ gmail dot com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants