0

I have a server running centos7 with sqlite3 installed using Yum/rpm. By default the sqlite package is not compiled with the extension JSON1 which I need. The extension can be enabled when the package is compiled using the flag -DSQLITE_ENABLE_JSON1 After working at it for a full day I've managed to find the RPM source files, updated the spec so it compiles with the flag, and recompiled it into a new package. Now I can run rpm -U current-sqlite-package.rpm custom-sqlite-package.rpm and upgrade to my custom package. Both yum and rpm say that the package but when I run /user/bin/sqlite3 --version it is still the old version.

How do I upgrade to my custom package? How does yum/rpm packages tie to the software in /user/bin?

user2863274
  • 13
  • 1
  • 3
  • What's the output from `rpm -qa |grep sqlite*` – user3788685 May 19 '17 at 07:43
  • `rpm -qa | grep sqlite` outputs `sqlite-3.7.17-8.el7.centos+json1.x86_64` which is my new custom package. `yum list sqlite` outputs `sqlite.x86_64 3.7.17-8.el7.centos+json1 installed` confirming that the new package has been installed. – user2863274 May 19 '17 at 11:34
  • If it is important `rpm -qa | grep sqlite*` with the asterisk produces no output. – user2863274 May 19 '17 at 11:58
  • New attempt. I've downloaded the C source code directly and recompiled with the flag: `wget "https://sqlite.org/2017/sqlite-autoconf-3170000.tar.gz";` `tar zxvf "sqlite-autoconf-3170000.tar.gz";` `cd "sqlite-autoconf-3170000";` `CFLAGS='-DSQLITE_ENABLE_JSON1' ./configure;` `sudo make install;` Now I have a working version of sqlite3 at `usr/local/bin/sqlite3` but I still don't know how to point the system at it instead of the old software in `/usr/bin/sqlite3` – user2863274 May 19 '17 at 12:29
  • if it won't break anything you could remove all the versions you have installed and start over. `yum erase ` if that won't remove it do `rpm -e ` then do `yum clean all` and reinstall from the rpm. It sounds like you have bits left over from other attempts and non standard builds... – user3788685 May 19 '17 at 12:33
  • Unfortunately I have other packages like cPanel that rely on the package so I can only replace it, not remove it. I've reinstalled the original package and ran `yum clean all` to return the system to where it was. – user2863274 May 19 '17 at 12:45
  • I took at look at my PATH and found that executing `sqlite3` is actually running the new version of sqlite. However, runing queries in a php script still attempts to use the old version. – user2863274 May 19 '17 at 13:57
  • ahh then try a httpd restart and see if it picks up the new/correct path – user3788685 May 19 '17 at 14:08
  • No luck, after restart php still points to old version of sqlite3. If I run `/usr/local/bin/php --ri pdo_sqlite` I get the following: `pdo_sqlite PDO Driver for SQLite 3.x => enabled SQLite Library => 3.8.10.2` which confuses me more as I don't know where or how the such an old library version has been installed (yum has sqlite v3.17 installed and the version I recompiled and installed in `usr/local/bin` is v3.17) – user2863274 May 19 '17 at 14:26

1 Answers1

0

Current versions of SQLite3 support runtime extension loading. So you can just download and compile the JSON1 extension as a separate .so file and load it via .load ~/path/to/json1.so

This will allow you to receive updates for SQLite via the default package manager and no need to rebuild it yourself.

Falco
  • 3,287
  • 23
  • 26