SQLite Forum

Compiling sqlite3 on Windows with ICU enabled
Login

Compiling sqlite3 on Windows with ICU enabled

(1) By Banana on 2021-09-28 00:36:43 updated by 1.1 [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.

1) [The instructions](https://sqlite.org/howtocompile.html) 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](https://www.irontcl.com/), set up the PATH environmental variable and the `tclsh.exe` by copying the `tclsh86.exe` from the install so that command `tclsh` will work. 

2) Even so, it would not compile because it assumes the tcl includes will be in the `.\compat\tcl`. Thus I had to copy the `\include`, `\lib` and `\bin` from `IronTcl` root foolder and put it in `.\compat\tcl` of the source tree. 

3) Likewise, I had to set up the `.\compat\icu` folder, 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. 

4) 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 sqlite3.c -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 test TOP=..\ USE_ICU=1
```

The `USE_ICU` is necessary because it not only generates the `-DSQLITE_ENABLE_ICU` but also the necessary `/I` and `/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:

line 1786-1790:

```
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)
```

line 1807-1808:

```
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.

Compiling sqlite3 on Windows with ICU enabled

(1.1) By Banana on 2021-09-28 16:38:53 edited from 1.0 [link] [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.

  1. 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.exe by copying the tclsh86.exe from the install so that command tclsh will work.

  2. Even so, it would not compile because it assumes the tcl includes will be in the .\compat\tcl. Thus I had to copy the \include, \lib and \bin from IronTcl root foolder and put it in .\compat\tcl of the source tree.

  3. Likewise, I had to set up the .\compat\icu folder, 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.

  4. 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

The USE_ICU is necessary because it not only generates the -DSQLITE_ENABLE_ICU but also the necessary /I and /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:

line 1786-1790:

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)

line 1807-1808:

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.