Skip to content

Instantly share code, notes, and snippets.

@zeljic
Last active April 10, 2024 09:19
Show Gist options
  • Star 44 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save zeljic/d8b542788b225b1bcb5fce169ee28c55 to your computer and use it in GitHub Desktop.
Save zeljic/d8b542788b225b1bcb5fce169ee28c55 to your computer and use it in GitHub Desktop.
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source

    For example: source https://www.sqlite.org/2023/sqlite-amalgamation-3430100.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2023/sqlite-dll-win64-x64-3430100.zip

  3. Extract both archives to the same directory

  4. Open Developer Command Prompt for VS 2017 by typing Developer Command in Windows Search

  5. Go to directory where you've extracted source code and binary files (via opened cmd)

  6. Run lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64

Blog post

@zeljic
Copy link
Author

zeljic commented Feb 17, 2020

Updated for latest version 3310100 and URLs are added.

@vladfaust
Copy link

Thank you!

@NickTsaizer
Copy link

NickTsaizer commented Nov 16, 2020

God bless you, kind sir.

@TelephoneTan
Copy link

Thank you! It works.

@DaviJam
Copy link

DaviJam commented Jan 30, 2021

Thank you!! Straight forward!

@tamdrea
Copy link

tamdrea commented Feb 2, 2021

thanks

@zeljic
Copy link
Author

zeljic commented Feb 4, 2021

Updated to current version 3.34.1 (3340100)

@sito8943
Copy link

Ty a lot

@OhmPopy
Copy link

OhmPopy commented Feb 25, 2022

thank

@H3d9
Copy link

H3d9 commented May 9, 2022

great

@lzw875
Copy link

lzw875 commented Oct 13, 2022

Thank you!

@lakeweb
Copy link

lakeweb commented Oct 27, 2022

Thanks! And this works on windows 11 VS2022.

@zeljic
Copy link
Author

zeljic commented Oct 27, 2022

Thanks! And this works on windows 11 VS2022.

Great!

@GlitchyCrafting
Copy link

this was a life saver

@vincefav
Copy link

Thank you!

@PierreBonnefoy
Copy link

Thank you ! You're my god now.

@TheUniKian
Copy link

TheUniKian commented Jun 9, 2023

I'm having an issue where, after following the final command, LINK : fatal error LNK1104: cannot open file 'sqlite3.def'

This is how the directory looks if it matters

This is how the command prompt looks

@zeljic
Copy link
Author

zeljic commented Jun 9, 2023

@TheUniKian You have to be inside sqlite directory.
So, you first have to do cd C:\Users\_USER_\Downloads\sqlite

@TheUniKian
Copy link

It never worked in CMD so I never thought to try it there. I'm so sorry

@heavenle
Copy link

nice, thank you!

@JohnnyTNguyen
Copy link

Thank you!

@zeljic
Copy link
Author

zeljic commented Sep 18, 2023

Updated to latest source and binary (version 3.43.1.)

@JulyIghor
Copy link

SQLITE_VERSION=$(echo $(curl -s 'https://www.sqlite.org/download.html') | awk '{ sub(".*sqlite-autoconf-",""); sub("\\.tar.*",""); sub("/.*",""); print; }')

DLL_URL="https://www.sqlite.org/`date +"%Y"`/sqlite-dll-win64-x64-${SQLITE_VERSION}.zip"
SOURCE_URL="https://www.sqlite.org/`date +"%Y"`/sqlite-amalgamation-${SQLITE_VERSION}.zip"

@Leow12487
Copy link

Hi Everyone, I have a issue about the final command , it says ### fatal error LNK1104: cannot open file 'sqlite3.def'
Here is the picture

Fatal Error 2023 - 12 - 19

@zeljic
Copy link
Author

zeljic commented Dec 19, 2023

You are in wrong directory, you are executing lib command in C:\Program Files\Microsoft Visual Studio\2022\Community but you should first move to D:\sqlite-amalgamation-3430100

@Leow12487
Copy link

Issue solved ,thank you @zeljic

@hunter2009pf
Copy link

thank you, sir~

@KerwinChina
Copy link

thank you

@thefox61
Copy link

thank you!

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