Compiling instructions for SQLite ICU extension need update
(1) By Vedran (phidrho) on 2020-05-19 11:34:24 [source]
I just tried to compile ICU extension from source on Ubuntu 18.04 with command from
gcc -shared icu.c `icu-config --ldflags` -o libSqliteIcu.so
but newer versions of ICU don't use
icu-config anymore, it's been replaced with pkg-config.
I have managed to compile it with:
gcc -g -fPIC -shared icu.c `pkg-config --libs --cflags icu-uc icu-io` -o libicu.so
and it also worked without
-g option providing a much smaller library size:
gcc -fPIC -shared icu.c `pkg-config --libs --cflags icu-uc icu-io` -o libicu.so
Since I'm not a programmer, please check which of these two is correct way and please update README.txt.
(2.1) By Vedran (phidrho) on 2020-12-04 18:44:44 edited from 2.0 in reply to 1 [link] [source]
This readme file has been updated with:
gcc -fPIC -shared icu.c `pkg-config --libs --cflags icu-uc icu-io` \ -o libSqliteIcu.so
but if this name:
libSqliteIcu.so is used instead of
libicu.so as I noted in first post then autoloading of extension is not working.
Actually, the correct name for this extension is only
icu.so, because of the entry point function name, which is
sqlite3_icu_init in this case.
You will do well to customize the name of your entry point to correspond to the name of the shared library you will be generating, rather than using the generic "sqlite3_extension_init" name. Giving your extension a custom entry point name will enable you to statically link two or more extensions into the same program without a linker conflict, if you later decide to use static linking rather than run-time linking. If your shared library ends up being named "YourCode.so" or "YourCode.dll" or "YourCode.dylib" as shown in the compiler examples above, then the correct entry point name would be "sqlite3_yourcode_init".
See documentation for more details.
So it should be corrected again with different filename.