[Haskell-cafe] RE: hdbc-mysql on windows

Roderick Ford developer at live.com
Fri Mar 19 19:44:54 EDT 2010


For those interested, the patch for parsing the paths that contain spaces (windows installs of mysql), I passed along the changes for Setup.lhs so that the split skips spaces inside quotes:

 

mysqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
mysqlBuildInfo lbi = do
  let mysqlConfig = rawSystemProgramStdoutConf verbosity mysqlConfigProgram (withPrograms lbi)
  includeDirs <- return . map (dropWhile (\x -> elem x "-I") ) . split =<< mysqlConfig ["--include"]
  ldOptions   <- return . split =<< mysqlConfig ["--libs"]

  return emptyBuildInfo {
    ldOptions   = ldOptions,
    includeDirs = includeDirs
  }
  where
    verbosity = normal -- honestly, this is a hack

 

split :: [Char] -> [[Char]]
split xs@(l:lx) = if (elem '\"' xs)
             then let x = dropWhile (== '"') xs
                      y = takeWhile (/= '"') x
                  in  y : split ( dropWhile (\n -> elem n "\" \r\n\t") (drop (length y) x))
             else let x = takeWhile (\n -> not (elem n " \r\n\t") ) xs
                  in x : split ( dropWhile (\n -> elem n " \r\n\t") (drop (length x) xs))
split [] = []


 

This hasn't fixed everything, such that I have a complete install of HDBC-mysql on Windows, but it is a step.

 

Roderick

 


Subject: Re: hdbc-mysql on windows
From: waterson at maubi.net
Date: Fri, 19 Mar 2010 11:18:20 -0700
CC: haskell-cafe at haskell.org
To: developer at live.com

Roderick, thanks for passing this along.  To be honest, I haven't tried to build this on Windows yet.  I have an old PC that I keep meaning to get things going on.  If you're able to get things working, I'd be more than happy to integrate any changes that you want to send along... patches are very much appreciated! :)


thanks!
chris



On Mar 18, 2010, at 1:46 PM, Roderick Ford wrote:

Hello,
In order to build (cabal install HDBC-mysql) the HDBC-mysql package, I am having to make the following changes:
 
(1) I had to change the mysql (5.1.45 community distrib msi) to use a wrapper exe on the mysql_config.pl and put this in c:\program files\mysql\bin since although the c:\program files\mysql\scripts\, where mysql_config.pl resides, was in the path, even the commandline call to it was not finding or using it...very strange.  This of course doesn't directly have to do with the HDBC-mysql package.  
--The quick wrapper was:
import System.Environment(getArgs)
import System.Process(readProcessWithExitCode)
import System.Exit(exitWith,ExitCode(ExitSuccess))
main = do
 args <- getArgs
 (ecode,out,err) <- readProcessWithExitCode "c:\\Perl64\\bin\\perl.exe" ("C:\\Program Files\\MySQL\\scripts\\mysql_config.pl" : args) ""
 if ecode == ExitSuccess
  then mapM_ putStrLn (lines out)
  else mapM_ putStrLn (lines err)
        exitWith ecode
 
-- so now the output is: 
"C:\Program Files\MySQL\lib\mysqlclient.lib" "wsock32.lib" "advapi32.lib" "user3
2.lib"

 
(2) Once that was done, the "cabal install HDBC-mysql" call was able to find the mysql_config. However, it was splitting the values returned by mysql_config on space, and thus failed to find mysql.h, as the resulting command was:
 
C:\Program Files (x86)\Haskell Platform\2009.2.0.2\gcc.exe -c -BC:\
Program Files (x86)\Haskell Platform\2009.2.0.2\gcc-lib -IC:\Program Files (x86)
\Haskell Platform\2009.2.0.2\include\mingw -D__GLASGOW_HASKELL__=610 -IIC:\Program -Iles\MySQL\include\mysql" ...
 
-- then I tried taking the -I out of the mysql_config.pl script and got the following from the "cabal install HDBC-mysql"
command was: C:\Program Files (x86)\Haskell Platform\2009.2.0.2\gcc.exe -c -BC:\
Program Files (x86)\Haskell Platform\2009.2.0.2\gcc-lib -IC:\Program Files (x86)
\Haskell Platform\2009.2.0.2\include\mingw -D__GLASGOW_HASKELL__=610 -I:\Program -Iles\MySQL\include\mysql" ... blah blah blah
cabal: Error: some packages failed to install:
HDBC-mysql-0.6.1 failed during the building phase. The exception was:
exit: ExitFailure 1
 
 
... so finally I am downloading your package to see if I can figure out a fix for windows boxes.  Just thought I would give you a heads up on this windows-related bug.
 
Thanks,
Roderick
 

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100319/4f41290d/attachment.html


More information about the Haskell-Cafe mailing list