пятница, 14 апреля 2017 г.

Linking HDBC/Sqlite3 on Haskell stack under Windows

To link your Haskell application with HDBC for Sqlite3 under Windows, you have to:

install sqlite3 dev C package (headers and libs)

  • go to your Haskell MSYS2 installation (for example, D:\apps\haskell\8.0.2\msys\) and run msys2.exe
  • in opened terminal run
pacman -Syu
# if needed - close terminal and run again
pacman -Su
pacman -S libsqlite-devel
pacman -S sqlite # to have CLI tool

modify cabal and stack.yaml files

  • add to stack.yaml:
...
extra-deps: [HDBC-sqlite3-2.3.3.1]
...
extra-include-dirs: ["d:/apps/haskell/8.0.2/msys/usr/include"]
extra-lib-dirs: ["d:/apps/haskell/8.0.2/msys/usr/lib"]
...
  • add to cabal file:
  build-depends:       base >= 4.7 && < 5
                     , HDBC
                     , HDBC-sqlite3
  • now you can import modules:
import Database.HDBC
import Database.HDBC.Sqlite3
...

Комментариев нет:

Отправить комментарий

Thanks for your posting!