Git Product home page Git Product logo

Comments (7)

jgallagher avatar jgallagher commented on May 24, 2024 2

This is now available as the bundled feature (see #176 / #197).

from rusqlite.

majkcramer avatar majkcramer commented on May 24, 2024 1

I have no perfect solution for now. Only figured out the essential and it works for me.

Part #a: compile sqlite.dll.a

  • Download mingw32 or mingw64
  • Download the sqlite amalgamation source code from https://www.sqlite.org/download.html
  • Install mingw
  • Decompress amalgamation source
  • "Start Terminal" from mingw Startmenu entry (cmd.exe with env path to mingw/bin/ folder). Do the following 2 steps within the cmd Terminal
  • cd to you decompresses amalgamation source
  • compile sqlite.a: "dlltool --def sqlite3.def --dllname sqlite3.dll --output-lib sqlite3.a"
  • now there should be a sqlite3.a within that folder
  • optional: check the sqlite.a does not contain debugger symbols: "nm --debug-syms sqlite.a" (For debugger symbols the second column indicates N.)

Part #b: download and setup pkg-config

Hint: Do yourself a favor und download the gtk+ bundle instead only "pkg-config" and trying to fulfill required dependency

  • Download gtk+ bundle from http://www.gtk.org/download/index.php
  • Decompress the gtk+ bundle
  • Copy "sqlite3.def" from amalgamtion source to {gtk+ folder}/lib/
  • Copy your compiled "sqlite3.a" to {gtk+ folder}/lib/ as "sqlite3.dll.a"
  • Within {gtk+ folder}/lib/pkgconfig/ create a "sqlite3.pc" file with following contents:
# Package Information for pkg-config

prefix=/srv/win32builder/fixed_364/build/win32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: sqlite3
Description: SQL database engine lib
Version: 3.7.7.1
Libs: -L${libdir} -lsqlite3
Libs.private: -ldl -lpthread 
Cflags: -I${includedir}
  • Open cmd shell and cd to {gtk+ folder}/bin/ folder and type "pkc-config --list-all". The list should contain you "sqlite3" entry.

Part #c: cargo build rusqlite

  • Open your Rust Shell
  • Append your mingw/bin/ folder to env path (for example: 'set PATH=%PATH%;"C:\Program Files\mingw-w64\x86_64-4.9.2-posix-seh-rt_v4-rev2\mingw64\bin"') to prevent yourself from 'bug' time-rs/time#78
  • Append your gtk+ bundle /bin folder to env path
  • cargo build
    -> should compile without errors now

Part d#: cargo test rusqlite

  • Download sqlite (32 Bit) precompiled dll from sqlite.org. If you need 64 Bit i have not figured out how to compile by myself. Possible you could find a 64 Bit Dll to Download anywhere else. Be warned: Dont mix 32/64 bit sqlite.a and sqlite.dll together. Your result will be a "application error" of Type 0xc00007b
  • Copy dll to rusqlite/target/debug/ Folder
  • cargo test
    -> should compile without errors now

Final thoughts [updated]

First i had self compiled 64Bit sqlite.a with 32Bit sqlite.dll from sqlite.org and i got a 'application error 0x00007b' on cargo test.. After then I downloaded a (older) 64Bit sqlite.dll and cargo test went succesfully. Now i dont know how to compile a matching sqlite.dll for myself.
So far ...

Needs Review

Anyone more experienced could review these steps, please?

Thanks for your patience about my bad english ;-)

from rusqlite.

gwenn avatar gwenn commented on May 24, 2024 1

It may interest you to know that there is an appveyor script that only uses:

  • rust stable (gnu version)
  • mingw
  • official pre-compiled dll

See https://github.com/jgallagher/rusqlite/pull/121

from rusqlite.

photex avatar photex commented on May 24, 2024 1

@gwenn, a dll is undesirable for almost any use of sqlite that I have personally. I'd still cast the vote to fetch the amalgam instead.
For others that might be fine tho. I suppose it could be a cargo feature. ?

from rusqlite.

jgallagher avatar jgallagher commented on May 24, 2024

Sorry, I don't have access to a Windows box for development at the moment. I know Rust's support on Windows is evolving too. Have you tried asking in the #rust IRC channel? There might be folks there who can help.

from rusqlite.

jgallagher avatar jgallagher commented on May 24, 2024

Oh! If you do figure something out, please reply; I'd love to document this.

from rusqlite.

photex avatar photex commented on May 24, 2024

I was able to get this going just using msys2.

Using pacman I installed the following: mingw64/mingw-w64-x86_64-pkg-config and mingw64/mingw-w64-x86_64-sqlite3

Also generally speaking, I've had to be sure I've installed GCC in order to actually compile most foo-sys packages: mingw64/mingw-w64-x86_64-gcc

For those who may not know, you install packages with pacman like so: pacman -Ss <package name>
And you can update everything using pacman -Syu.

I'm just using powershell (for no particular reason honestly) but I've added the relevant msys and mingw paths to my system environment. On my system it's the following:
C:\msys64\mingw64\bin;c:\msys64\usr\bin
The order here is important because I want the mingw64 stuff to be used first.

If the Rust installer for windows ever defaults to the MSVC version all of this will change! :)

Personally I'd have preferred rusqlite just used the sqlite amalgam and maybe that'll be the path of most awesome if Rust on windows ever requires MSVC by default instead of MingW.

from rusqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.