ruby - Use non-default sqlite3 executable from sqlite gem -


i have compiled custom sqlite3 executable enable support icu (collation rules: sorting accents, etc. utf-8).

i use rvm , ruby sqlite gem seems use:

~/.rvm/gems/ruby-1.9.3-p392@project/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.so 

my db creation code requires collation rules when use sqlite gem error:

/home/user/.rvm/gems/ruby-1.9.3-p392@project/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in `initialize': sqlite3::sqlexception: no such function: icu_load_collation (sequel::databaseerror) 

...which makes sense since default sqlite not have collation rules built-in.

when use custom sqlite3 executable directly works fine.

my questions following:

  1. is there way debian/ubundu package of sqlite3 icu support built-in? couldn't find any.

  2. if (1) not possible, need compile sqlite3 , create static library instead of executable?

  3. if (2) possible, how can make change properly? use bundler , deploy in machine.

  4. is there way make sqlite gem see native executable (or .so if (2) possible).

thank in advance,

k.

i have made work. install gem while compiling native extensions (like icu support sqlite) specific options 1 needs do:

$ gem install sqlite3 --verbose --                                      \     --with-opt-include=/home/user/local/lib/sqlite-autoconf-3071602/    \     --with-opt-lib=/home/user/local/lib/sqlite-autoconf-3071602/.libs   \     --with-cflags='-o3 -dsqlite_enable_icu'                             \     --with-cppflags=`icu-config --cppflags`                             \     --with-ldflags=`icu-config --ldflags` 

whatever goes after 2 'empty' dashes "--" parameters going build process of gem. assumes src distribution of sqlite3 uncompressed at: /home/user/local/lib/sqlite-autoconf-3071602/

now, since use bundler wanted automated. 1 can use following command:

bundle config build.sqlite3 --with-opt-include=/home/user/local/lib/sqlite-autoconf-3071602/ ... 

... means whenever sqlite3 gem installed pass following options in build process. creates ~/.bundle/config file entry gem, e.g. file have:

bundle_build__sqlite3: --with-opt-include=/home/karask/local/lib/sqlite-autoconf-3071602/  --with-opt-lib=/home/karask/local/lib/sqlite-autoconf-3071602/.libs  --with-cflags='-o3 -dsqlite_enable_icu' --with-cppflags=`icu-config --cppflags` --with-ldflags=`icu-config --ldflags` 

however, wasn't working me. reason entry in ~/.bundle/config wasn't correct. tried quoting , escaping in several combinations no luck. @ end create entry manually in deployment process (a shell script) adding following:

$ mkdir ~/.bundle $ echo "bundle_build__sqlite3: --with-opt-include=/home/user/local/lib/sqlite-autoconf-3071602/  --with-opt-lib=/home/user/local/lib/sqlite-autoconf-3071602/.libs  --with-cflags='-o3 -dsqlite_enable_icu' --with-cppflags=`icu-config --cppflags` --with-ldflags=`icu-config --ldflags`" > ~/.bundle/config 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -