Compiling sqlite3 on Windows with ICU enabled
(1.1) By Banana on 2021-09-28 16:38:53 edited from 1.0 [source]
I've found that the instructions seems to be missing some crucial pieces of data and there may be some errors in the MakeFile.msc when one wants to compile the sqlite3 with ICU options enabled. There are also difference references on using ICU.
The instructions fails to mention to set up the Tcl. I had made the mistake of skipping over the section #3 and going directly to section #5, thinking previous sections were POSIX-specific and not applicable. I had to install IronTcl, set up the PATH environmental variable and the
tclsh.exeby copying the
tclsh86.exefrom the install so that command
Even so, it would not compile because it assumes the tcl includes will be in the
.\compat\tcl. Thus I had to copy the
IronTclroot foolder and put it in
.\compat\tclof the source tree.
Likewise, I had to set up the
.\compat\icufolder, unzipping all the files from the ICU. Otherwise, I get a linker error about unresolved external references. I think it is possible to not have to do that by adding the ICU (and Tcl) to the PATH environment variable but at that point I was just wanting to get it to work.
The instruction also is not very clear on how to use the options. From the page, I thought I would be doing something like:
nmake /f Makefile.msc -DSQLITE_ENABLE_ICU
However that will not work correctly. Reviewing the
MakeFile.msc and other people's notes on web, this seems to be necessary:
nmake /f ..\Makefile.msc TOP=..\ USE_ICU=1
USE_ICU is necessary because it not only generates the
-DSQLITE_ENABLE_ICU but also the necessary
/LIBPATH: that will correctly include the ICU files.
But this still will fail to compile the test suites because those are missing the necessary includes for some of the test codes:
sqldiff.exe: $(TOP)\tool\sqldiff.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) dbhash.exe: $(TOP)\tool\dbhash.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) $(TOP)\tool\dbhash.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
fuzzcheck.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) $(FUZZCHECK_OPTS) $(FUZZCHECK_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
To resolve those errors, I added
$(LTLIBPATHS) $(LTLIBS) to end of each line which then will successfully compile the test suite with ICU enabled.
It might be possible that my modifications are not correct but I wanted to share because the instructions, especially for enabling optional features, were not very clear. Even after the above, I still get a single failing test on symlink tests so naturally I wonder if I'm still doing something wrong.