HDBC-ODBC compile problem

Hello all, I'm having a problem compiling a HDBC-ODBC on Windows. I'm not sure if the problem is with hdbc-odbc or with the Windows GHC package or if I've done something stupid or what. Windows is not my native habitat, so forgive me if I've left out something obvious. I'm using a Cygwin shell, but I don't think that matters. As far as I can tell, the GHC package contains all the mingw stuff it needs. I'm using the GHC 6.4.2 package from http://www.haskell.org/ghc/ download_ghc_642.html on a pretty standard Windows XP setup. The compile is failing during preprocessing: it looks like hsc2hs isn't finding something. It generates a bunch of syntax errors for basic types like ULONG, etc. Any help is appreciated. Thanks. Here is the output from the attempted compile session: $ runhaskell.exe Setup.lhs configure -v Setup.lhs: Warning: No license-file field. Configuring HDBC-odbc-1.0.0.0... configure: searching for ghc in path. configure: found ghc at c:\ghc\ghc-6.4.2\bin\ghc.exe "c:\ghc\ghc-6.4.2\bin\ghc.exe" --version >tmp724 configure: looking for package tool: ghc-pkg near compiler in c:\ghc \ghc-6.4.2\b in\ghc.exe configure: found package tool in c:\ghc\ghc-6.4.2\bin\ghc-pkg.exe configure: Reading installed packages... "c:\ghc\ghc-6.4.2\bin\ghc-pkg.exe" --global list >tmp724 configure: Dependency base-any: using base-1.0 configure: Dependency mtl-any: using mtl-1.0 configure: Dependency HDBC>=1.0.0: using HDBC-1.0.0 configure: Dependency parsec-any: using parsec-1.0 configure: Using install prefix: C:\Program Files configure: Binaries installed in: C:\Program Files\HDBC-odbc-1.0.0.0 configure: Libraries installed in: C:\Program Files\Haskell\HDBC- odbc-1.0.0.0\gh c-6.4.2 configure: Private binaries installed in: C:\Program Files\HDBC- odbc-1.0.0.0 configure: Data files installed in: C:\Program Files\Common Files \HDBC-odbc-1.0. 0.0 configure: Using compiler: c:\ghc\ghc-6.4.2\bin\ghc.exe configure: Compiler flavor: GHC configure: Compiler version: 6.4.2 configure: Using package tool: c:\ghc\ghc-6.4.2\bin\ghc-pkg.exe configure: Using ar found on system at: C:\cygwin\bin\ar.exe configure: No haddock found configure: No pfesetup found configure: Using ranlib found on system at: C:\cygwin\bin\ranlib.exe configure: Using runghc found on system at: c:\ghc\ghc-6.4.2\bin \runghc.exe configure: No runhugs found configure: No happy found configure: No alex found configure: Using hsc2hs: c:\ghc\ghc-6.4.2\bin\hsc2hs.exe configure: No c2hs found configure: No cpphs found configure: No greencard found $ runhaskell.exe Setup.lhs build -v 2> log.txt Preprocessing library HDBC-odbc-1.0.0.0... c:\ghc\ghc-6.4.2\bin\hsc2hs.exe -D__GLASGOW_HASKELL__=604 -I. -o Database\HDBC\O DBC\Connection.hs Database\HDBC\ODBC\Connection.hsc ---------------------- log.txt ------------------------ In file included from c:/ghc/ghc-6.4.2/include/mingw/sql.h:13, from Database\HDBC\ODBC\Connection.hsc:41: c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:17: error: syntax error before "UDWORD" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:18: error: syntax error before "UWORD" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:24: error: syntax error before "PTR" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:25: error: syntax error before "HENV" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:26: error: syntax error before "HDBC" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:27: error: syntax error before "HSTMT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:29: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:34: error: syntax error before "SQLUINTEGER" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:36: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:37: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:50: error: syntax error before "SQLHWND" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:51: error: syntax error before "BOOKMARK" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:71: error: syntax error before "SQLTCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:90: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:94: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:96: error: syntax error before "second" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:100: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:102: error: syntax error before "hour" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:103: error: syntax error before "minute" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:104: error: syntax error before "second" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:105: error: syntax error before "fraction" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:108: error: syntax error before "SQL_DATE_STRUCT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:109: error: syntax error before "SQL_TIME_STRUCT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:110: error: syntax error before "SQL_TIMESTAMP_STRUCT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:118: error: syntax error before "SQLUINTEGER" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:122: error: syntax error before "SQLUINTEGER" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:124: error: syntax error before "minute" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:125: error: syntax error before "second" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:126: error: syntax error before "fraction" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:132: error: syntax error before "SQL_YEAR_MONTH_STRUCT" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:135: error: syntax error before '}' token c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:138: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:140: error: syntax error before "sign" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:141: error: syntax error before "val" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:142: error: syntax error before '}' token c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:154: error: syntax error before "DWORD" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:156: error: syntax error before "Data3" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:157: error: syntax error before "Data4" c:/ghc/ghc-6.4.2/include/mingw/sqltypes.h:158: error: syntax error before '}' token In file included from Database\HDBC\ODBC\Connection.hsc:41: c:/ghc/ghc-6.4.2/include/mingw/sql.h:346: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:348: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:349: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:351: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:352: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:357: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:358: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:360: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:362: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:363: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:364: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:365: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:366: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:367: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:368: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:369: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:370: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:372: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:373: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:374: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:375: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:376: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:377: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:378: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:379: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:382: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:384: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sql.h:389: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:390: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:391: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:393: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:394: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sql.h:395: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:396: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:397: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:398: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:400: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:401: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sql.h:402: error: syntax error before "SQLPOINTER" In file included from Database\HDBC\ODBC\Connection.hsc:42: c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1184: error: syntax error before "SQLHWND" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1185: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1186: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1187: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1188: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1189: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1190: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1192: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1194: error: syntax error before "SQLUINTEGER" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1195: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1196: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1197: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1198: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1199: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1200: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1201: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1202: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1203: error: syntax error before "ODBCGetTryWaitValue" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1204: error: syntax error before "ODBCSetTryWaitValue" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1207: error: syntax error before "TraceReturn" c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1208: error: syntax error before "TraceVersion" In file included from c:/ghc/ghc-6.4.2/include/mingw/sqlext.h:1214, from Database\HDBC\ODBC\Connection.hsc:42: c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:22: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:24: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:25: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:26: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:27: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:28: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:30: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:32: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:34: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:35: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:36: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:37: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:38: error: syntax error before "SQLHWND" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:39: error: syntax error before "SQLHWND" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:40: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:41: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:42: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:44: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:46: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:48: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:49: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:50: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:51: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:52: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:54: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:55: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:58: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:60: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:62: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:64: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:66: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:68: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:69: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:70: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:71: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:72: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:74: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:75: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:76: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:77: error: syntax error before "SQLUSMALLINT" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:78: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:80: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:83: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:84: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:85: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:86: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:87: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:89: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:90: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:91: error: syntax error before "SQLCHAR" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:93: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:94: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:95: error: syntax error before "SQLPOINTER" c:/ghc/ghc-6.4.2/include/mingw/sqlucode.h:96: error: syntax error before "SQLPOINTER" Database\HDBC\ODBC\Connection.hsc: In function `main': Database\HDBC\ODBC\Connection.hsc:134: error: syntax error before "int" Database\HDBC\ODBC\Connection.hsc:204: error: syntax error before "int" Database\HDBC\ODBC\Connection.hsc:212: error: syntax error before "int" Database\HDBC\ODBC\Connection.hsc:223: error: syntax error before "int" Setup.lhs: got error code while preprocessing: Database.HDBC.ODBC.Connection Rob Dockins Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG

Robert Dockins
Hello all,
I'm having a problem compiling a HDBC-ODBC on Windows. I'm not sure if the problem is with hdbc-odbc or with the Windows GHC package or if I've done something stupid or what. Windows is not my native habitat, so forgive me if I've left out something obvious.
I'm using a Cygwin shell, but I don't think that matters. As far as I can tell, the GHC package contains all the mingw stuff it needs. I'm using the GHC 6.4.2 package from http://www.haskell.org/ghc/ download_ghc_642.html on a pretty standard Windows XP setup.
The compile is failing during preprocessing: it looks like hsc2hs isn't finding something. It generates a bunch of syntax errors for basic types like ULONG, etc. Any help is appreciated. Thanks.
Here is the output from the attempted compile session:
[snip compiler output] I'm having the exact same build error on ghc-6.5 (visual haskell actually) on windows. I have no clue how to proceed which makes me sad because I was really looking forward to using HDBC. Maybe someone knows a work around? I'm not on this list, yet, (sending this via gmane) so if you could CC to me that would be great. Thanks, Jason

On Jul 17, 2006, at 12:57 PM, Jason Dagit wrote:
Robert Dockins
writes: Hello all,
I'm having a problem compiling a HDBC-ODBC on Windows. I'm not sure if the problem is with hdbc-odbc or with the Windows GHC package or if I've done something stupid or what. Windows is not my native habitat, so forgive me if I've left out something obvious.
I'm using a Cygwin shell, but I don't think that matters. As far as I can tell, the GHC package contains all the mingw stuff it needs. I'm using the GHC 6.4.2 package from http://www.haskell.org/ghc/ download_ghc_642.html on a pretty standard Windows XP setup.
The compile is failing during preprocessing: it looks like hsc2hs isn't finding something. It generates a bunch of syntax errors for basic types like ULONG, etc. Any help is appreciated. Thanks.
Here is the output from the attempted compile session:
[snip compiler output]
I'm having the exact same build error on ghc-6.5 (visual haskell actually) on windows. I have no clue how to proceed which makes me sad because I was really looking forward to using HDBC. Maybe someone knows a work around?
I'm not on this list, yet, (sending this via gmane) so if you could CC to me that would be great.
I got a resolution to this problem on a different mailing list: http://www.mail-archive.com/glasgow-haskell-users@haskell.org/ msg10063.html I've attached a patch that makes it work for me. It's not cross- platform happy, but it makes the Windows compile work. Darcs "get" from http://darcs.complete.org/hdbc-odbc/ and apply the patch. Rob Dockins Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG

On 7/17/06, Robert Dockins
On Jul 17, 2006, at 12:57 PM, Jason Dagit wrote:
Robert Dockins
writes: Hello all,
I'm having a problem compiling a HDBC-ODBC on Windows. I'm not sure if the problem is with hdbc-odbc or with the Windows GHC package or if I've done something stupid or what. Windows is not my native habitat, so forgive me if I've left out something obvious.
I'm using a Cygwin shell, but I don't think that matters. As far as I can tell, the GHC package contains all the mingw stuff it needs. I'm using the GHC 6.4.2 package from http://www.haskell.org/ghc/ download_ghc_642.html on a pretty standard Windows XP setup.
The compile is failing during preprocessing: it looks like hsc2hs isn't finding something. It generates a bunch of syntax errors for basic types like ULONG, etc. Any help is appreciated. Thanks.
Here is the output from the attempted compile session:
[snip compiler output]
I'm having the exact same build error on ghc-6.5 (visual haskell actually) on windows. I have no clue how to proceed which makes me sad because I was really looking forward to using HDBC. Maybe someone knows a work around?
I'm not on this list, yet, (sending this via gmane) so if you could CC to me that would be great.
I got a resolution to this problem on a different mailing list:
http://www.mail-archive.com/glasgow-haskell-users@haskell.org/ msg10063.html
I've attached a patch that makes it work for me. It's not cross- platform happy, but it makes the Windows compile work. Darcs "get" from http://darcs.complete.org/hdbc-odbc/ and apply the patch.
Your patch did the trick. Thank you very much. Jason

On 2006-07-17, Robert Dockins
I got a resolution to this problem on a different mailing list:
http://www.mail-archive.com/glasgow-haskell-users@haskell.org/ msg10063.html
I've attached a patch that makes it work for me. It's not cross- platform happy, but it makes the Windows compile work. Darcs "get" from http://darcs.complete.org/hdbc-odbc/ and apply the patch.
Hello Robert, First off, thanks for your work on this. I would appreciate getting patches e-mailed directly to me, BTW. As you noted, I can't apply this directly as-is because of not being cross-platform happy. That is easily enough fixed for the #includes. However, for the .cabal file, it's not so easy. Is it really not possible to link in odbc -- it has to be odbc32 on Windows?

Hello John, Monday, July 17, 2006, 11:40:18 PM, you wrote:
As you noted, I can't apply this directly as-is because of not being cross-platform happy. That is easily enough fixed for the #includes. However, for the .cabal file, it's not so easy. Is it really not possible to link in odbc -- it has to be odbc32 on Windows?
is not it possible to use the same trick as i used to include Win32 package only in windows builds of Streams library. here is the Setup.hs that does this trick: -- This custom Cabal build script adds "Win32" package to the list of -- dependencies if we build on the Windows platform import qualified System.Info import Data.List import Distribution.Simple import Distribution.Simple.Utils import Distribution.PackageDescription main = do pkg_descr_file <- defaultPackageDesc pkg_descr <- readPackageDescription pkg_descr_file let isWindows = "mingw" `isPrefixOf` System.Info.os config = if isWindows then pkg_descr { buildDepends = Dependency "Win32" AnyVersion : buildDepends pkg_descr } else pkg_descr defaultMainNoRead config -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On 7/17/06, Bulat Ziganshin
As you noted, I can't apply this directly as-is because of not being cross-platform happy. That is easily enough fixed for the #includes. However, for the .cabal file, it's not so easy. Is it really not possible to link in odbc -- it has to be odbc32 on Windows?
is not it possible to use the same trick as i used to include Win32 package only in windows builds of Streams library. here is the Setup.hs that does this trick:
That should work as well, but writing out a .buildinfo-file would be better, I think. I have used that, little diffrently: http://tamelambda.net/darcs/dx9/Setup.hs (I write buildinfo based on configure params) HTH, --Esa

On Jul 17, 2006, at 3:40 PM, John Goerzen wrote:
On 2006-07-17, Robert Dockins
wrote: I got a resolution to this problem on a different mailing list:
http://www.mail-archive.com/glasgow-haskell-users@haskell.org/ msg10063.html
I've attached a patch that makes it work for me. It's not cross- platform happy, but it makes the Windows compile work. Darcs "get" from http://darcs.complete.org/hdbc-odbc/ and apply the patch.
Hello Robert,
First off, thanks for your work on this.
I would appreciate getting patches e-mailed directly to me, BTW.
I was hoping to make it cross-platform before sending it in for possible inclusion, but...
As you noted, I can't apply this directly as-is because of not being cross-platform happy. That is easily enough fixed for the #includes. However, for the .cabal file, it's not so easy. Is it really not possible to link in odbc -- it has to be odbc32 on Windows?
this problem is why I haven't done so yet. I got link errors with -lodbc. With a little googling around I discovered that I could fix it by using -lodbc32. I don't know if that's because of my particular setup or if it is a problem in general; I stopped doing research as soon as I could compile and run my app. On the linked thread above, Esa indicated that using MSYS can sometimes make linking go funny. Unfortunately, I don't know enough about mingw to know if that's happening in this case. If it is the case that it needs to be odbc32 on Windows, I'm not sure how to handle that with cabal. Using, eg, autotools seems like overkill for something so trivial, but all the other ideas I had were pretty crufty. Rob Dockins Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG

On 2006-07-17, Robert Dockins
I've attached a patch that makes it work for me. It's not cross- platform happy, but it makes the Windows compile work. Darcs "get" from http://darcs.complete.org/hdbc-odbc/ and apply the patch.
Thanks to everyone for your feedback. I have fixed HDBC-odbc to be correctly cross-platform and have released 1.0.0.1 that should build out of the box on Unix and Windows. -- John
participants (5)
-
Bulat Ziganshin
-
Esa Ilari Vuokko
-
Jason Dagit
-
John Goerzen
-
Robert Dockins