Ticket #35 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

AI_NUMERICSERV issue when installing network with GHC 7 and OS 10.6

Reported by: batterseapower Owned by:
Priority: major Milestone:
Component: network Version:
Keywords: Cc:

Description

I've seen this problem on both of my OS X 10.6 machines now. I try to install network 2.3, and I get the error:

Preprocessing library network-2.2.1.10...
Socket.hsc: In function ‘main’:
Socket.hsc:1846: error: ‘AI_NUMERICSERV’ undeclared (first use in this function)
Socket.hsc:1846: error: (Each undeclared identifier is reported only once
Socket.hsc:1846: error: for each function it appears in.)
compiling dist/build/Network/Socket_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/Network/Socket_hsc_make.c -o dist/build/Network/Socket_hsc_make.o -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -D__GLASGOW_HASKELL__=700 -Iinclude -DCALLCONV=ccall -DBASE4 -I/Library/Frameworks/GHC.framework/Versions/7.0.1.20101215-i386/usr/lib/ghc-7.0.1.20101215/base-4.3.1.0/include -I/Library/Frameworks/GHC.framework/Versions/7.0.1.20101215-i386/usr/lib/ghc-7.0.1.20101215/include -I/Library/Frameworks/GHC.framework/Versions/7.0.1.20101215-i386/usr/lib/ghc-7.0.1.20101215/include -I/Library/Frameworks/GHC.framework/Versions/7.0.1.20101215-i386/usr/lib/ghc-7.0.1.20101215/include/

I'm not really sure why this happens. The earlier configure check seems OK:

checking whether AI_NUMERICSERV is declared... yes

Removing the offending #ifdef solves the problem.

Change History

Changed 4 years ago by batterseapower

The problem is that the configure test for AI_NUMERICSERV uses GCC, but Sockets.hsc is compiled with GHC. I checked and the tets program does indeed not compile if you use GHC instead of GCC.

This happens because GHC invokes GCC with a command line like this:

/Developer/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 -isysroot /Developer/SDKs/MacOSX10.5.sdk ...

The -isysroot parameter means that we get 10.5 headers, and 10.5 did not include AI_NUMERICSERV. However, configure is testing against 10.6 headers, which do define that constant.

What to do?

Changed 4 years ago by batterseapower

Another workaround is:

ghc --make Setup.hs
./Setup configure
CPP=/usr/bin/cpp CC=ghc ./configure
./Setup build
sudo ./Setup install

Or perhaps:

CPP=/usr/bin/cpp CC=ghc cabal install network
}}

Perhaps it should be the default for GHC to be used as the C compiler for these tests? We can change the AC_PROG_CC to just:

{{{
AC_PROG_CC([ghc])
}}

However, since `ghc -E` dosen't return anything meaningful, configure falls back on /lib/cpp for the C preprocessor, which is quite wrong...
}}}

Changed 4 years ago by batterseapower

  • status changed from new to closed
  • resolution set to fixed

OK, I think this was fixed upstream 4 days ago by Ian's Cabal patch entitled "Pass gcc/ld locations and flags to configure scripts". See also http://hackage.haskell.org/trac/ghc/ticket/4852#comment:8

I can't test this theory until we have another GHC release candidate out, but I'm going to close this ticket anyway.

Note: See TracTickets for help on using tickets.