id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
3780	unix-2.4.0.0 fails with base 4.1	duncan	igloo	"The unix package states:
{{{
build-depends: base >=4.1 && <4.3
}}}

And while it does compile with base 4.1, using ghc-6.10, nothing can successfully link against it.

The symptoms are:
{{{
/usr/lib64/ghc-6.10.4/base-4.1.0.0/libHSbase-4.1.0.0.a(PrelIOUtils.o): In function `__hscore_d_name':
(.text+0x1c0): multiple definition of `__hscore_d_name'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(dirUtils.o):dirUtils.c:(.text+0x0): first defined here
/usr/lib64/ghc-6.10.4/base-4.1.0.0/libHSbase-4.1.0.0.a(PrelIOUtils.o): In function `__hscore_free_dirent':
(.text+0x4f0): multiple definition of `__hscore_free_dirent'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(dirUtils.o):dirUtils.c:(.text+0x10): first defined here
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sk63_info':
(.text+0x30c4): undefined reference to `fcntl_read'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sk6A_info':
(.text+0x31f0): undefined reference to `fcntl_write'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sk8h_info':
(.text+0x36cc): undefined reference to `fcntl_read'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sl4O_info':
(.text+0x3a52): undefined reference to `fcntl_lock'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sl6S_info':
(.text+0x3cc2): undefined reference to `fcntl_lock'
/home/duncan/.cabal/lib/unix-2.4.0.0/ghc-6.10.4/libHSunix-2.4.0.0.a(IO.o): In function `sl9I_info':
(.text+0x402a): undefined reference to `fcntl_lock'
}}}

There are two problems here, the duplicate `__hscore_*` symbols and and the missing `fcntl_*` symbols.

The `__hscore_d_name` C function really is duplicated. There is one copy in `base/include/HsBase.h` in ghc-6.10, there is another copy in `cbits/dirUtils.c` in unix-2.4.0.0. Clearly what has happened is that the function from base has been moved into the unix package. However that means when building the unix package with the older base then we get both. The solution is to rename the one in the unix package. Ideally we could limit the visibility of symbols somehow.

The `fcntl_read` are not defined in the unix package. They are defined in `HsBase.h` in ghc-6.12 but not in 6.10. Hence they are also missing when unix-2.4.0.0 is built against the older base. The solution is to define them locally.

Originally filed as Cabal ticket: http://hackage.haskell.org/trac/hackage/ticket/620"	merge	closed	normal	6.12.2	libraries/unix	6.12.1	fixed			Unknown/Multiple	Unknown/Multiple	Other	Easy (less than 1 hour)				
