30 January 2017

Network-NineP

System: Microsoft Windows XP Home Edition
CPUs: Intel(R) Atom(TM) CPU N270 @1.60GHz
Deps: HaskellPlatform-2014.2.0.0-i386-setup.exe

I am suspending further work on this project after initially
patching the hackage download to compile on GNU/Linux,
basically because I don't like the [MSYS2] toolchain that's
shipped with the current HaskellPlatform.

The GitHub network-ninep-0.0.1 download contains code using withSocketsDo,
purportedly needed to be able to use Winsock - I believe binary >0.6.0.0 might be
a dependency for that download, however withSocketsDo is not appearing in the
hackage Network-NineP downloads, of which incidentally, though I admit I have
not researched it thouroughly, if the GitHub release preceded those from hackage,
some of the former's code might appear to have been split off into separate NineP
downloads: https://github.com/Elemir/network-ninep

The Network-NineP-0.4.1 package compiled on Slackware-14.0 after
adding this line following the comments at the top of Error.hs. If you are
installing into '--prefix=/usr' you might want to change the executable's
name in the cabal file, so it does not conflict with Slackware's /bin/test,
/usr/bin contains a symbolic link to /bin/test.

{-# LANGUAGE DeriveDataTypeable #-}

On Windows XP the compile fails on the 8th of a total of 9 files,
the same occurs on HaskellPlatform-7.10.2-a-i386-setup.exe.

HaskellPlatform-7.10.3-i386-setup.exe installed on XP fails to
load time-1.5.0.1.

HaskellPlatform-8.0.2-full-i386-setup.exe requires at minimum
Windows 7, as that version's ghc.exe uses the procedure entry
point _wsplitpath_s, introduced in the Windows 7 msvcrt.dll.

After importing Network (from network-2.4.2.3) in ghci.exe
the 'Not in scope' error occurs.

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Eric>ghci
GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
ghci> import Network
ghci> :t UnixSocket

<interactive>:1:1: Not in scope: data constructor `UnixSocket'
ghci> :q
Leaving GHCi.

C:\Documents and Settings\Eric>EXIT

This however doesn't occur on Slackware-14.0 using network-2.6.0.2.

sh-4.2$ ghci
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
ghci> import Network
ghci> :t UnixSocket
UnixSocket :: String -> PortID
ghci> :q
Leaving GHCi.

sh-4.2$ exit

https://downloads.haskell.org/~platform/2014.2.0.0/
HaskellPlatform-2014.2.0.0-i386-setup.exe

The parsec version (accompanying the above download) and convertible-1.1.1.0
need to use the identical version of the text package.

C:\Documents and Settings\Eric>CD \

C:\>cabal update
Config file path source is default config file.
Config file C:\Documents and Settings\Eric\Application Data\cabal\config not
found.
Writing default configuration to C:\Documents and Settings\Eric\Application
Data\cabal\config
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install

C:\>cabal install NineP-0.0.2.1 transformers-compat-0.4.0.3
Resolving dependencies...
Downloading NineP-0.0.2.1...
Downloading transformers-compat-0.4.0.3...
Configuring NineP-0.0.2.1...
Configuring transformers-compat-0.4.0.3...
Building NineP-0.0.2.1...
Building transformers-compat-0.4.0.3...
Installed transformers-compat-0.4.0.3
Installed NineP-0.0.2.1

C:\>cabal install exceptions-0.8.0.2 hslogger-1.2.10 monad-loops-0.4.3
Resolving dependencies...
Downloading exceptions-0.8.0.2...
Downloading monad-loops-0.4.3...
Downloading hslogger-1.2.10...
Configuring monad-loops-0.4.3...
Configuring exceptions-0.8.0.2...
Building monad-loops-0.4.3...
Building exceptions-0.8.0.2...
Installed monad-loops-0.4.3
Configuring hslogger-1.2.10...
Installed exceptions-0.8.0.2
Building hslogger-1.2.10...
Installed hslogger-1.2.10

C:\>cabal install convertible-1.1.1.0 extensible-exceptions-0.1.1.4
Resolving dependencies...
Downloading convertible-1.1.1.0...
Downloading extensible-exceptions-0.1.1.4...
Configuring extensible-exceptions-0.1.1.4...
Configuring convertible-1.1.1.0...
Building extensible-exceptions-0.1.1.4...
Building convertible-1.1.1.0...
Installed extensible-exceptions-0.1.1.4
Installed convertible-1.1.1.0

C:\>cabal install monad-peel-0.2.1.1 mstate-0.2.7 stateref-0.3
Resolving dependencies...
Downloading monad-peel-0.2.1.1...
Downloading stateref-0.3...
Configuring stateref-0.3...
Configuring monad-peel-0.2.1.1...
Building stateref-0.3...
Building monad-peel-0.2.1.1...
Installed monad-peel-0.2.1.1
Downloading mstate-0.2.7...
Configuring mstate-0.2.7...
Installed stateref-0.3
Building mstate-0.2.7...
Installed mstate-0.2.7

C:\>

https://hackage.haskell.org/package/Network-NineP
Network-NineP-0.4.1.tar.gz

Download and extract Network-NineP-0.4.1.tar.gz, adding
this line following the comments at the top of Error.hs.

{-# LANGUAGE DeriveDataTypeable #-}

Then run the commands.

C:\Network-NineP-0.4.1>runhaskell Setup configure --user
Configuring Network-NineP-0.4.1...

C:\Network-NineP-0.4.1>runhaskell Setup build
Building Network-NineP-0.4.1...
Preprocessing library Network-NineP-0.4.1...
[1 of 9] Compiling Network.NineP.Error ( Network\NineP\Error.hs, dist\build\Netw
ork\NineP\Error.o )
[2 of 9] Compiling Control.Monad.EmbedIO ( Control\Monad\EmbedIO.hs, dist\build\
Control\Monad\EmbedIO.o )
[3 of 9] Compiling Network.NineP.Internal.File ( Network\NineP\Internal\File.hs,
 dist\build\Network\NineP\Internal\File.o )
[4 of 9] Compiling Network.NineP.File ( Network\NineP\File.hs, dist\build\Networ
k\NineP\File.o )
[5 of 9] Compiling Network.NineP.File.Instances ( Network\NineP\File\Instances.h
s, dist\build\Network\NineP\File\Instances.o )
[6 of 9] Compiling Network.NineP.Internal.State ( Network\NineP\Internal\State.h
s, dist\build\Network\NineP\Internal\State.o )
[7 of 9] Compiling Network.NineP.Internal.Msg ( Network\NineP\Internal\Msg.hs, d
ist\build\Network\NineP\Internal\Msg.o )
[8 of 9] Compiling Network.NineP.Server ( Network\NineP\Server.hs, dist\build\Ne
twork\NineP\Server.o )

Network\NineP\Server.hs:56:55:
    Not in scope: data constructor `UnixSocket'

C:\Network-NineP-0.4.1>

Here's the code block in Server.hs where the compile failed.

connection :: String -> IO Socket
connection s = let pat = "tcp!(.*)!([0-9]*)|unix!(.*)" :: ByteString
wrongAddr = ioError $ userError $ "wrong 9p connection address: " ++ s
(bef, _, aft, grps) = s =~ pat :: (String, String, String, [String])
in if (bef /= "" || aft /= "" || grps == [])
then wrongAddr
else case grps of
[addr, port, ""] -> listen' addr $ toEnum $ (fromMaybe 2358 $ maybeRead port :: Int)
["", "", addr]  -> listenOn $ UnixSocket addr
_ -> wrongAddr

NB: The package version numbers above were selected so one could install yi-0.10.1 on
top of this without breaking any packages.

06 January 2017

es

System: Microsoft Windows 2K, XP, Vista, 7, 8.0
CPUs: Intel(R) Atom(TM) CPU N270 @1.60GHz.

Installation of es-0.9.1 in SFU/SUA Interix.

https://wryun.github.io/es-shell/
es-0.9.1.tar.gz

In the SUA Interix 6.0 download for MS® Vista (Ultimate and Enterprise Editions) there's a file
'gcc_fullbuild' - found after extracting gcc4.2.tgz - which contains these prerequisite programs
with version numbers, for compiling gcc-4.2.0; this file is available on this log, as the download
is 473 MB; I've added indent (a flex dependency) and omitted gettext-0.16 in the below.

make-3.81
m4-1.4.9
sed-4.1.5
bison-2.3
indent-2.2.10
flex-2.5.33

These compile favourably utilising CFLAGS="-O2 -march=i586", and the configure script
arguments as '--prefix=/usr --build=i586-pc-interix3 --host=i586-pc-interix3'.

The following command run in the source directories - if one builds within the source tree -
will strip to external PDB the compiled executables and libraries.

$ find . | xargs file | grep "executable" | grep PE | cut -f 1 -d : | \
> xargs strip --strip-unneeded 2> /dev/null
$

Remove or rename /bin/make and move GNU make to /bin, then add a symbolic link as
gmake, remove or rename /bin/m4 and move GNU m4 to /bin, remove or rename /bin/sed
and move GNU sed to /bin, before running 'gmake install' on bison-2.3 rename or remove
/bin/yacc and rename or remove /usr/lib/liby.a, which can be replaced by the bison version,
and before running 'gmake install' on flex rename or remove /bin/lex; the file /usr/lib/libl.a
(the lex library) can likewise be removed or renamed.

The shell es-0.9.1.tar.gz will then compile on gcc-3.3 after deleting
the '-Wno-missing-field-initializers' and '-Wno-clobbered' CFLAGS
from the configure script's generated Makefile.

$ echo $CC
/opt/gcc.3.3/bin/gcc
$ cd es-0.9.1
$ CFLAGS="-O2 -march=i586" \
> ./configure --prefix=/usr \
> --build=i586-pc-interix3 \
> --host=i586-pc-interix3

...

$

Edit your Makefile (as above).

$ gmake

...

$ find . | xargs file | grep "executable" | grep PE | cut -f 1 -d : | \
> xargs strip --strip-unneeded 2> /dev/null

$ mv es /bin
$ exit

NB: These installation instructions don't allocate for a line-editing library;
for some reason compiling with readline-6.1 results in dead Æ, Ø and Å
keys. Haahr's .esrc in the examples directory in part pertains to a NeXT
machine, and Jamesh's .esrc file likely won't work without a line-editing
library. However, starting SFU/SUA's Korn shell inside GNU emacs and
then switching to es is satisfactory.

(setq explicit-shell-file-name "C:\\WINDOWS\\system32\\posix.exe")
(setq explicit-posix.exe-args '("/u" "/c" "/bin/ksh" "-l"))