RE: 4.04 posix/AF_UNIX lossage
> > Hi Simon, I eventually managed to produce an executable (but see > > below) with the following patches (note that the address family > > enumeration below is *not* identical to freebsd): > [..] > > + | Psuedo_AF_RTIP -- Help Identify RTIP packets >^^ > > I think this should be `Pseudo'... the others are correct though. Thanks; fixed. Simon
Re: 4.04 posix/AF_UNIX lossage
> Hi Simon, I eventually managed to produce an executable (but see > below) with the following patches (note that the address family > enumeration below is *not* identical to freebsd): [..] > + | Psuedo_AF_RTIP -- Help Identify RTIP packets ^^ I think this should be `Pseudo'... the others are correct though. --KW 8-) -- : Keith Wansbrough, MSc, BSc(Hons) (Auckland) ---: : PhD Student, Computer Laboratory, University of Cambridge, UK. : : Native of Antipodean Auckland, New Zealand: 174d47'E, 36d55'S. : : http://www.cl.cam.ac.uk/users/kw217/ mailto:[EMAIL PROTECTED] : ::
RE: 4.04 posix/AF_UNIX lossage
> Hi Simon, I eventually managed to produce an executable (but see > below) with the following patches (note that the address family > enumeration below is *not* identical to freebsd): great, thanks. I've incorporated your patches. > however compiling: > > main = "better dead than imperative" > > produces: > > foo.hs:1: > Couldn't match `IO t' against `[Char]' > Expected type: IO t > Inferred type: [Char] > When checking that `main' has the required type that should be main = print "better dead than imperative" the type system is complaining that it can't match String (i.e. [Char]) against the type of main, namely (IO t). > compiling Say.hs (from hugs), produces: > > proff@suburbia:/pkg/share/hugs/demos$ ghc Say.hs > > Say.hs:44: Variable not in scope: `isUpper' > > Say.hs:45: Variable not in scope: `isLower' > > Say.hs:46: Variable not in scope: `isSpace' > > Say.hs:47: Variable not in scope: `isDigit' > > Compilation had errors Hugs has a bug in that it brings these functions into scope from the Prelude, when they should only be available from the Char module according to the Haskell 98 spec. Fix: add 'import Char' to get it to compile under GHC. > root@suburbia:/pkg/share/hugs/demos# ghc Literate.lhs > > Literate.lhs:50: Variable not in scope: `isSpace' > > Compilation had errors Same problem here. > root@suburbia:/pkg/share/hugs/demos# ghc Stack.hs > Stack.hs:5: parse error on input `in' > > Compilation had errors The stack demo uses restricted type synonyms, which is a Hugs extension. GHC doesn't have restricted type synonyms (yet). Thanks again for the patches, Simon
Re: 4.04 posix/AF_UNIX lossage
Hi Simon, I eventually managed to produce an executable (but see below) with the following patches (note that the address family enumeration below is *not* identical to freebsd): $NetBSD$ --- ghc/lib/misc/SocketPrim.lhs Wed Sep 15 09:06:26 1999 +++ ghc/lib/misc/SocketPrim.lhs Tue Dec 14 13:00:08 1999 @@ -941,10 +941,56 @@ #endif +#if netbsd_TARGET_OS || netbsd_elf_TARGET_OS + +data Family = + AF_UNSPEC -- unspecified + |AF_UNIX -- local to host (pipes, portals) + |AF_INET -- internetwork: UDP, TCP, etc. + |AF_IMPLINK -- arpanet imp addresses + |AF_PUP -- pup protocols: e.g. BSP + |AF_CHAOS-- mit CHAOS protocols + |AF_NS -- XEROX NS protocols + |AF_ISO -- ISO protocols +--|AF_OSI is the same as AF_ISO + |AF_ECMA -- european computer manufacturers + |AF_DATAKIT -- datakit protocols + |AF_CCITT-- CCITT protocols, X.25 etc + |AF_SNA -- IBM SNA + | AF_DECnet -- DECnet + | AF_DLI -- DEC Direct data link interface + | AF_LAT -- LAT + |AF_HYLINK -- NSC Hyperchannel + |AF_APPLETALK-- Apple Talk + |AF_ROUTE-- Internal Routing Protocol + |AF_LINK -- Link layer interface + |Pseudo_AF_XTP -- eXpress Transfer Protocol (no AF) + | AF_COIP -- connection-oriented IP, aka ST II + | AF_CNT -- Computer Network Technology + | Psuedo_AF_RTIP -- Help Identify RTIP packets + | AF_IPX -- Novell Internet Protocol + | AF_INET6 -- IPv6 + | Pseudo_AF_PIP -- Help Identify PIP packets + | AF_ISDN -- Integrated Services Digital Network +--| AF_E164is the same as AF_ISDN + | AF_NATM-- native ATM access + | AF_ARP -- (rev.) addr. res. prot. (RFC 826) + | Pseudo_AF_KEY -- Internal key-management function + | Pseudo_AF_HDRCMPLT -- Used by BPF to not rewrite hdrs in iface output + | AF_MAX + deriving (Eq, Ord, Ix, Show) + +packFamily = index (AF_UNSPEC, AF_MAX) +unpackFamily family = (range (AF_UNSPEC, AF_MAX))!!family + +#endif + + -- Alpha running OSF or a SPARC with SunOS, rather than Solaris. #if osf1_TARGET_OS || osf3_TARGET_OS || sunos4_TARGET_OS || hpux_TARGET_OS || \ - aix_TARGET_OS || freebsd2_TARGET_OS || freebsd3_TARGET_OS + aix_TARGET_OS || freebsd2_TARGET_OS || freebsd3_TARGET_OS || \ + netbsd_TARGET_OS || netbsd_elf_TARGET_OS data SocketType = Stream | Datagram diff -u -r old/fptools/ghc/rts/MBlock.c work.i386/fptools/ghc/rts/MBlock.c $NetBSD$ --- ghc/rts/MBlock.cWed Sep 15 09:06:54 1999 +++ ghc/rts/MBlock.cTue Dec 14 10:27:15 1999 @@ -47,6 +47,10 @@ */ #define ASK_FOR_MEM_AT 0x5000 +#elif netbsd_TARGET_OS +/* NetBSD i386 shared libs are at 0x4000 + */ +#define ASK_FOR_MEM_AT 0x5000 #elif linux_TARGET_OS /* Any ideas? */ $NetBSD$ --- ghc/driver/ghc-asm.lprl Wed Sep 15 09:05:45 1999 +++ ghc/driver/ghc-asm.lprl Tue Dec 14 22:09:04 1999 @@ -104,7 +104,7 @@ $T_HDR_direct = "\t.SPACE \$TEXT\$\n\t.SUBSPA \$CODE\$\n\t\.align 4\n"; ## -} elsif ( $TargetPlatform =~ /^i386-.*-(linuxaout|freebsd2|nextstep3|cygwin32|mingw32)$/ ) { +} elsif ( $TargetPlatform =~ +/^i386-.*-(linuxaout|freebsd2|netbsd|nextstep3|cygwin32|mingw32)$/ ) { # NeXT added but not tested. CaS $T_STABBY = 1; # 1 iff .stab things (usually if a.out format) @@ -135,12 +135,12 @@ $T_HDR_direct = "\.text\n\t\.align 2,0x90\n"; ## -} elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd3)$/ ) { +} elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd3|netbsd_elf)$/ ) { $T_STABBY = 0; # 1 iff .stab things (usually if a.out format) $T_US = ''; # _ if symbols have an underscore on the front $T_PRE_APP = # regexp that says what comes before APP/NO_APP - ($TargetPlatform =~ /-(linux|freebsd3)$/) ? '#' : '/' ; + ($TargetPlatform =~ /-(linux|freebsd3|netbsd_elf)$/) ? '#' : '/' +; $T_CONST_LBL= '^\.LC(\d+):$'; # regexp for what such a lbl looks like $T_POST_LBL= ':'; $T_X86_PRE_LLBL_PAT = '\.L'; @@ -150,7 +150,7 @@ $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.Lfe.*\n\t\.size\s+.*|\.size\s+.*|\.ident.*)\n)'; $T_COPY_DIRVS = '\.(globl)'; -if ( $TargetPlatform =~ /freebsd3/ ) { +if ( $TargetPlatform =~ /freebsd3|netbsd_elf/ ) { $T_hsc_cc_PAT = '\.ascii.*\)(hsc|cc) (.*)\\\
RE: 4.04 posix/AF_UNIX lossage
> when attempting to bootstrap under netbsd-current: > > ==fptools== gmake all -r; > in /orb/s/netbsd/usr/pkgsrc/lang/ghc/work.i386/fptools/ghc/lib/misc > -- > -- > rm -f CString.o ; if [ ! -d CString ]; then mkdir CString; > else find CString -name '*.o' -print | xargs rm -f __rm_food ; fi ; > ../../../ghc/driver/ghc -i../concurrent:../posix -recomp -cpp > -fglasgow-exts -fvia-C -Rghc-timing -O -split-objs -odir > CString -static-c CString.lhs -o CString.o -osuf o > < residency (4 samples), 10M in use, 0.00 INIT (0.00 elapsed), > 2.22 MUT (2.51 elapsed), 0.97 GC (0.96 elapsed) :ghc>> > ghc: module version unchanged at 1 > touch CString.o ; > rm -f SocketPrim.o ; if [ ! -d SocketPrim ]; then mkdir > SocketPrim; else find SocketPrim -name '*.o' -print | xargs > rm -f __rm_food ; fi ; > ../../../ghc/driver/ghc -i../concurrent:../posix -recomp -cpp > -fglasgow-exts -fvia-C -Rghc-timing -O -split-objs -odir > SocketPrim -static -I../std/cbits -H12m > -optc-DNON_POSIX_SOURCE -c SocketPrim.lhs -o SocketPrim.o -osuf o > > SocketPrim.lhs:14: Variable not in scope: `packSocketType' [ etc. ] Thanks for the report. I haven't tried building GHC on a NetBSD box (and I don't have one to hand), so you'll have to help us debug this one. I assume you're trying to build lang/ghc from the FreeBSD ports tree? A good first approximation is probably to go through SocketPrim.lhs and add netbsd_TARGET_OS to all the #ifdefs with freebsd[23]_TARGET_OS in them. BTW, the ports tree version will only work with x86 at the moment. Cheers, Simon