2011-04-22 87 views
3

現在我想連接db與haskell,我試圖使用cabal安裝HDBC-ODBC,HSQL-ODBC和HDBC-mysql,我可以配置sqlite3,我怎樣才能添加這些包?當我嘗試使用cabal進行安裝時出現此錯誤HDBC -odbc與haskell連接

Resolving dependencies... 
Configuring HDBC-odbc-2.2.3.2... 
Preprocessing library HDBC-odbc-2.2.3.2... 
Connection.hsc:47:17: error: sql.h: No such file or directory 
Connection.hsc:48:20: error: sqlext.h: No such file or directory 
Connection.hsc: In function ‘main’: 
Connection.hsc:95: error: ‘SQL_HANDLE_ENV’ undeclared (first use in this function) 
........................................... 
......................................... 
Connection.hsc:245: error: expected expression before ‘int’ 
Connection.hsc:245: error: expected ‘)’ before numeric constant 
Connection.hsc:245: error: expected ‘)’ before numeric constant 
compiling dist/build/Database/HDBC/ODBC/Connection_hsc_make.c failed 
command was: /usr/bin/gcc -c -D__GLASGOW_HASKELL__=612 -I. -I/usr/lib/ghc-6.12.1/time-1.1.4/include -I/usr/lib/ghc-6.12.1/old-time-1.0.0.3/include -I/usr/lib/ghc-6.12.1/bytestring-0.9.1.5/include -I/usr/lib/ghc-6.12.1/base-4.2.0.0/include -I/usr/lib/ghc-6.12.1/include -I/usr/lib/ghc-6.12.1/include -I/usr/lib/ghc-6.12.1/include/ dist/build/Database/HDBC/ODBC/Connection_hsc_make.c -o dist/build/Database/HDBC/ODBC/Connection_hsc_make.o 
cabal: Error: some packages failed to install: 
HDBC-odbc-2.2.3.2 failed during the building phase. The exception was: 
ExitFailure 1 

我能爲此做些什麼?

回答

5

您需要安裝該HDBC-odbc Haskell的包裝要進行鏈接,爲Ubuntu/Debian的,這是通過

sudo apt-get install unixodbc-dev 

對於YUM /基於RPM的Linux發行本應沿東西完成了unixodbc C語言庫

sudo yum install unixODBC-devel 
+0

非常感謝你的工作! – 123Ex 2011-04-22 10:43:35