How to install MINGW
- Download necessary files from http://sourceforge.net/project/showfiles.php?group_id=2435
At the moment these are:
MSYS-1.0.10.EXE
MinGW-5.0.0.EXE - Install MSYS ("minimal system" - some kind of unix emulator) to D:\MSYS (for example). If you see prompt to execute post install instructions you may say no, because you probably do not have MinGW or MSYS previously installed.
- Install MinGW (with GPP option necessary for SQLite) to D:\MSYS\mingw
Installator didn't work with my proxy, so each file used by MinGW-5.0.0.EXE was downloaded separately and placed into installator's directory. Some downloaded files with newer versions than installer could understand were renamed to make it happy. List of packages required by MinGW-5.0.0.exe installer:
binutils-2.15.91-20040904-1.tar.gz
gcc-core-3.4.2-20040916-1.tar.gz
mingw-runtime-3.9.tar.gz (renamed to mingw-runtime-3.8.tar.gz)
w32api-3.5.tar.gz (renamed to w32api-3.3.tar.gz)
gcc-g++-3.4.2-20040916-1.tar.gz (C++ preprocessor required by SQLite configure) - After installer finished your environment is ready. Launch MSYS to start working. Home directory in this case ("cd ~") is located at D:\MSYS\home\yourusername if you need to find out where to place you files from windows to be found in MSYS.
- Optionally if you will need to run additional developer tools such as autoconf or automake, these are available through separate msysDTK-1.0.1.exe installer from the sourceforge download page above.
- Download SQLite and upack it into subdirectory "sqlite" (for example) of your MSYS home directory (something like D:\MSYS\home\techtonik in my case)
- Launch MSYS
- cd sqlite
- mkdir bld; cd bld
- ../configure --disable-tcl
- This will create "tsrc" directory with all necessary files to compile SQLite
make target_source
cd tsrc - Since there is no TCL libraries, tclsqlite.c should be removed to avoid errors during compilation (this is purely optional)
mv tclsqlite.c tclsqlite.c.unused - Compile sources with a some optimization (-O2 flag).
gcc -O2 -DNDEBUG=1 -DTHREADSAFE=1 -c *.c - Link compiled object (*.o) files to make sqlite3.exe (-s tell gcc to strip additional info used for debug)
gcc -s -o sqlite3 *.o - Remove shell.o object file used as entry point for command line utility. Useless for DLL.
rm shell.o - Link compiled object (*.o) files to make .dll The command below tells GCC to link all object files into one shared library (for windows it is .dll) and make functions listed in .def available for use to external programs (export). sqlite3.def file can be found in official sqlitedll-x_x_x.zip distribution
gcc -shared -s -o sqlite3.dll *.o *.def - There is one more thing you may need in future if you would like to compile other programs with SQLite support. It is import library. To make one for MinGW (called libsqlite3.dll.a) link .dll with command
gcc -shared -s -o sqlite3.dll *.o *.def -Wl,--out-implib,libsqlite3.dll.a - Wrap release.
mkdir ../release
cp sqlite3.dll sqlite3.exe libsqlite3.dll.a sqlite3.h ../release
cd ../release
Ready to use files for SQLite 3.3.17 are available at http://rainforce.org/sqlite/
Why not just use "make all" and "make dll" instead of the manual compilation? Worked for me.
ReplyDeleteThree years ago it did not.
ReplyDeleteThanks excellant post- got me through first time. Apparently due to changes in the amalgamation I made the following changes:
ReplyDeletef SQLite is downloaded without the TCL files then skip and remove steps: 5, 6, 7
5. change this ../configure --disable-tcl to ../configure
Task, problem, action[
# 5 ../configure --disable-tcl
# 6 This will create "tsrc" directory with all necessary files to compile SQLite
make target_source
cd tsrc
# 7 Since there is no TCL libraries, tclsqlite.c should be removed to avoid errors during compilation (this is purely optional)
mv tclsqlite.c tclsqlite.c.unused
Step 11. def removed as sqlite-3_x_x_* contained no *.def file. Change gcc -shared -s -o sqlite3.dll *.o *.def to gcc -shared -s -o sqlite3.dll *.o
Useful article, thank you for sharing the article!!!
ReplyDeleteWebsite: blogcothebanchuabiet.com chia sẻ những câu nói mỉa mai người khác hay stt một mình vẫn ổn và giải thích hiện tượng chim sẻ bay vào nhà là điềm gì.