Skip to content

Instantly share code, notes, and snippets.

@nurpax
Created October 17, 2012 18:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nurpax/3907344 to your computer and use it in GitHub Desktop.

Compiling direct-sqlite 2.2 on Windows

Many Windows 7 hosts with only Haskell Platform do not have a C compiler installed. This makes it painful to install direct-sqlite as it compiles sqlite3.c as part of its build.

Here's how to install this package so that it links against a prebuilt sqlite3.dll:

$ cabal install direct-sqlite -fsystemlib --extra-include-dirs=/c/Users/$USER/include \
    --extra-lib-dirs=/c/Users/$USER/bin

The example needs to be modified to point --extra-include-dirs and --extra-lib-dirs to the right path on your system that contains a) sqlite3.h and b) sqlite3.dll.

When running your application linking against direct-sqlite, make sure your sqlite3.dll is in the PATH.

@joeyadams
Copy link

I'm pretty sure the Haskell Platform bundles GCC. For me (on Windows XP), it's in C:\Program Files\Haskell Platform\2012.2.0.0\mingw\bin. See if you have a similar directory, and add it to your PATH. Let me know if this works.

cabal-install should know to call this GCC on its own. If it doesn't, perhaps we should send them a bug report.

@nurpax
Copy link
Author

nurpax commented Oct 18, 2012

@joeyadams You're right, mingw + gcc comes with Haskell Platform and I can see the files under the directory you mentioned. I see mingw\bin is not in my PATH though. I don't think I did any manual editing of my PATH after installing HP so perhaps the issue is that PATH setup in the HP installer is not complete. I'll file a bug against the Haskell Platform.

Thanks for catching this!

@nurpax
Copy link
Author

nurpax commented Oct 18, 2012

Opened http://trac.haskell.org/haskell-platform/ticket/212 just in case this is not a known issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment