Getting Cabal 1.1.1 working on Windows 98

Toby Allsopp toby at mi6.gen.nz
Fri Aug 5 20:28:09 EDT 2005


The version of Cabal that comes with GHC (6.4 and 6.4.1) doesn't run
on Windows 98 because of a missing SHGetFolderPathA function, so I
thought I'd try to compile version 1.1.1 myself.  I see that some work
has been done in CVS for this problem, but I thought I'd post the
changes I had to make to get 1.1.1 to work incase this is helpful to
other people or to getting it fixed propoerly.

I'm using MinGW 4.1, MSYS 1.0.10 and MSYS Developer Tool Kit 1.0.1.

I've attached a patch against version 1.1.1.

First, I tried compiling setup without any changes:

  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ setup
  ...
  Compiling Main             ( Setup.lhs, dist/tmp/Main.o )
  Linking ...
  dist/tmp/Distribution/Simple/Configure.o(.text+0xe41):fake: undefined reference to `SHGetFolderPath at 20'
  make: *** [setup] Error 1

Ok, this seems to be because we need to pick either the A or W
version.  I'm not sure how to get this to happen automatically, but I
guess we want the A version:
  
  $ diff ../cabal-1.1.1.orig/Distribution/Simple/Configure.hs Distribution/Simple
  /Configure.hs 
  256c256
  < foreign import stdcall unsafe "SHGetFolderPath" 
  ---
  > foreign import stdcall unsafe "SHGetFolderPathA" 

Now, I try again:
  
  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ setup
  ...
  Skipping  Main             ( Setup.lhs, dist/tmp/Main.o )
  Linking ...

Yay, it compiled!  Now I try to run it:
  
  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ config
  "The SETUP.EXE file is linked to missing export SHELL32.DLL:SHGetFolderPathA"

(The message is GUI dialog box.)  Ah, this is because SHGetFolderPathA
is not in SHELL32.DLL on Windows 98, but in SHFOLDER.DLL.  It is also
in SHFOLDER.DLL on later versions, so this change should be safe:
  
  $ diff ../cabal-1.1.1.orig/GNUmakefile GNUmakefile 
  4c4
  < GHCFLAGS= --make -Wall -fno-warn-unused-matches -cpp
  ---
  > GHCFLAGS= --make -Wall -fno-warn-unused-matches -cpp -lshfolder

Try again:
  
  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ config
  ...
  Skipping  Main             ( Setup.lhs, dist/tmp/Main.o )
  Linking ...
  ./setup configure --ghc --prefix=/usr/local
  Configuring Cabal-1.1.1...
  configure: Using install prefix: C:/MSYS/1.0/local
  configure: Using compiler: c:\GHC\GHC-6.4.1\BIN\ghc.exe
  configure: Compiler flavor: GHC
  configure: Compiler version: 6.4.1
  configure: Using package tool: c:\GHC\GHC-6.4.1\BIN\ghc-pkg.exe
  configure: No haddock found
  configure: No happy found
  configure: No alex found
  configure: Using hsc2hs: c:\GHC\GHC-6.4.1\BIN\hsc2hs.exe
  configure: No c2hs found
  configure: No cpphs found
  configure: No greencard found
  configure: Dependency base-any: using base-1.0
  configure: Dependency util-any: using util-1.0

Yay!  Now to install it:

  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ install
  ...
  Installing: C:/MSYS/1.0/local\Haskell\Cabal-1.1.1\ghc-6.4.1 & C:/MSYS/1.0/local\Cabal-1.1.1\bin Cabal-1.1.1...
  Registering Cabal-1.1.1...

Ok, it all seems fine.  Now to try to use it:

  $ cd tests/HSQL
  $ runghc Setup.lhs configure
  ghc.exe: unable to load package `Cabal-1.1.1'
  <interactive>: 
  C:/MSYS/1.0/local\Haskell\Cabal-1.1.1\ghc-6.4.1/HSCabal-1.1.1.o: unknown symbol `_SHGetFolderPathA'

Bummer.  We need to link with SHFOLDER.DLL. So, we change Cabal's
cabal file (similarly to the comment that was in CVS recently):

  $ cd ../..
  $ diff -u ../cabal-1.1.1.orig/Cabal.cabal Cabal.cabal 
  --- ../cabal-1.1.1.orig/Cabal.cabal     Sat Aug  6 11:50:00 2005
  +++ Cabal.cabal Sat Aug  6 12:17:46 2005
  @@ -48,6 +48,7 @@
           Distribution.Compat.Exception,
           Distribution.Compat.RawSystem
   Extensions: CPP
  +Extra-Libraries: shfolder
   
   executable: cabal-setup
   main-is: DefaultSetup.lhs

Then, install again and try the test again:

  $ make HCBASE=/c/ghc/ghc-6.4.1/bin/ install
  ...
  Registering Cabal-1.1.1...

  $ cd tests/HSQL/
  $ runghc Setup.lhs configure
  -=-= Cabal executing: ./configure =-=-
  Bad command or file name
  Configure Succeeded.

Triple yay!  Using this version I have successfully installed the real
HSQL.

How, it seems wrong to have to specify the A or W version explicitly
because there is a #define for it that depends on whther UNICODE is
defined.  I don't know why that's not being picked up (it's in
shldobj.h and I see that that's been specified in CVS, but adding it
makes no difference for me.)

The patch follows:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cabal-1.1.1-win98.diff
Type: text/x-patch
Size: 1293 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/libraries/attachments/20050806/45d22df9/cabal-1.1.1-win98-0001.bin


More information about the Libraries mailing list