Skip to content

Instantly share code, notes, and snippets.

@burningTyger
Created August 4, 2019 18:54
Show Gist options
  • Save burningTyger/073ee3d81c5629fa9373edcdedca4645 to your computer and use it in GitHub Desktop.
Save burningTyger/073ee3d81c5629fa9373edcdedca4645 to your computer and use it in GitHub Desktop.
sqlite with icu support
# in order to have icu support in sqlite you need to enable it via compile options.
# install the icu dev package on your system and download the source files from sqlite
# unpack and enter the source dir
# on a mac I had to do this to compile:
brew install icu4c
CFLAGS=`-I/usr/local/opt/icu4c/include -O3 -DSQLITE_ENABLE_ICU` CPPFLAGS=`icu-config --cppflags` LDFLAGS=`-L/usr/local/opt/icu4c/lib icu-config --ldflags` ./configure
# I had to add the path to the icu libs
# on linux the paths were added automatically to path
# so this would suffice on . ubuntu and arch where I also compiled:
CFLAGS='-O3 -DSQLITE_ENABLE_ICU' CPPFLAGS='icu-config --cppflags' LDFLAGS='icu-config --ldflags' ./configure
# then continue with
make
This will build your sqlite for you
# I wanted to use better-sqlite3 with icu so I had to use this:
npm i --sqlite3=/path/to/src/
@grugani
Copy link

grugani commented Jun 20, 2023

Hi, there are some changes after 4 years ?
icu-config is deprecated and is not installed in last ubuntu version.

@hmt
Copy link

hmt commented Jun 20, 2023

good question. I recently googled this because I was thinking about updating too. There is the following repository for this: https://github.com/nalgeon/sqlean/blob/main/docs/unicode.md

I think it does exactly what icu4sqlite did before. I used it for comparing strings with local character sets.

@hmt
Copy link

hmt commented Jun 20, 2023

fotgot to @grugani you :)

@grugani
Copy link

grugani commented Jun 20, 2023

Thanks :)
Sadly I need it to customize sqlite build for Android. I can't load an extension at runtime.
I'm not sure, but seems ICU extension is the only way

@hmt
Copy link

hmt commented Jun 20, 2023

ok, feel free to update your findings here. It's always useful to have as much information as possible on this topic.

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