dqlite
dqlite copied to clipboard
Incorrect pkg-config path on CentOS
My team is having some trouble trying to install dqlite on our centos7 environment. The errors are rather out of my usual area of expertise, so rather than trying to do any interpretation where I could introduce new confusion, the following is my colleague's report. Please let me know if I can clarify anything to help!
git clone --depth 100 https://github.com/canonical/sqlite.git cd sqlite
./configure --enable-replication
make sudo make install
cd ..
git clone https://github.com/canonical/libco.git
cd libco
make
sudo make install
cd ..
git clone https://github.com/canonical/raft.git
cd raft autoreconf -i
./configure
make
sudo make install
cd ..
cd /opt/dqlite/dqlite/
autoreconf -i
ldconfig -p | grep sqlite3
export SQLITE_LIBS=/lib64/libsqlite3.so.0
export SQLITE_CFLAGS=/lib64/libsqlite3.so.0
sudo yum install libuv
sudo yum install libuv-devel libuv-static
export UV_CFLAGS=/usr/lib64/libuv.so.1
export UV_LIBS=/usr/lib64/libuv.so.1
export RAFT_CFLAGS=/usr/local/lib/libraft.so.0.0.7
export RAFT_LIBS=/usr/local/lib/libraft.so.0.0.7
export CO_CFLAGS=/lib/libco.so
export CO_LIBS=/lib/libco.so
./configure
make
I'm having to manually declare those libraries because the installer can't find them, which frankly, is hugely problematic. I'm getting errors for libuv now during the make:
pboyle@ami-nfs-04:/opt/dqlite/dqlite$ make
CC src/bind.lo
gcc: warning: /lib64/libsqlite3.so.0: linker input file unused because linking not done
gcc: warning: /usr/lib64/libuv.so.1: linker input file unused because linking not done
gcc: warning: /lib/libco.so: linker input file unused because linking not done
gcc: warning: /usr/local/lib/libraft.so.0.0.7: linker input file unused because linking not done
CC src/client.lo
gcc: warning: /lib64/libsqlite3.so.0: linker input file unused because linking not done
gcc: warning: /usr/lib64/libuv.so.1: linker input file unused because linking not done
gcc: warning: /lib/libco.so: linker input file unused because linking not done
gcc: warning: /usr/local/lib/libraft.so.0.0.7: linker input file unused because linking not done
CC src/command.lo
gcc: warning: /lib64/libsqlite3.so.0: linker input file unused because linking not done
gcc: warning: /usr/lib64/libuv.so.1: linker input file unused because linking not done
gcc: warning: /lib/libco.so: linker input file unused because linking not done
gcc: warning: /usr/local/lib/libraft.so.0.0.7: linker input file unused because linking not done
CC src/conn.lo
In file included from src/conn.c:1:0:
src/conn.h:8:21: fatal error: raft/uv.h: No such file or directory
#include <raft/uv.h>
Thoughts? Any ideas where the correct libraries are, or what's missing?
Do you have pkg-config
installed? (which pkg-config
should tell)
Yes, I do have pkg-config.
You might want to try again and pass --prefix=/usr
as parameter to ./configure
.
This error:
src/conn.h:8:21: fatal error: raft/uv.h: No such file or directory
#include <raft/uv.h>
suggests that the raft headers where not installed in a directory belonging to the include path. Perhaps your system does not have /usr/local/include
has default include path.
(you'll need to re-run ./configure --prefix=/usr
for all dependencies)
Worked fine for me, steps that I took for centos7, these are all as root, not ideal, but just to give you an idea. centos7's packages are a bit old and the library, includes, etc. layout is a bit different so it's not as simple as ubuntu:
yum install -y git autoconf automake libtool make
cd /tmp
curl -LO https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
tar xf sqlite-autoconf-3330000.tar.gz
cd sqlite-autoconf-3330000
./configure --prefix=/usr
make -j4
make install
cd ..
curl -LO https://github.com/libuv/libuv/archive/v1.40.0.tar.gz
tar xf v1.40.0.tar.gz
cd libuv-1.40.0
./autogen.sh
./configure --prefix=/usr
make -j4
make install
export SQLITE_LIBS=/usr/lib/libsqlite3.so
export SQLITE_CFLAGS=$SQLITE_LIBS
export UV_LIBS=/usr/lib/libuv.so
export UV_CFLAGS=$UV_LIBS
export RAFT_LIBS=/usr/lib/libraft.so
export RAFT_CFLAGS=$RAFT_LIBS
cd ..
git clone --depth=1 https://github.com/canonical/raft.git
cd raft
autoreconf -i
./configure --prefix=/usr
make -j4
make install
cd ..
git clone --depth=1 https://github.com/canonical/dqlite.git
cd dqlite
autoreconf -i
./configure --prefix=/usr
make -j4
make install
I could add these to the readme in the repo if required?
The README already mentions that libuv
should be at least at version v1.8.0. Not sure what else we should add. Or are you referring to the --prefix=/usr
setting? It's also very surprising that you need to set --prefix=/usr
at all since that would mean that the traditional ./configure; make; make install
dance does not work on centos without adding --prefix=/usr
, which if true should be considered a bug of centos imo.
I guess you are right. It would be hand-holding. Ah I was just thinking to highlight the:
export SQLITE_LIBS=/usr/lib/libsqlite3.so
export SQLITE_CFLAGS=$SQLITE_LIBS
export UV_LIBS=/usr/lib/libuv.so
export UV_CFLAGS=$UV_LIBS
export RAFT_LIBS=/usr/lib/libraft.so
export RAFT_CFLAGS=$RAFT_LIBS
environment variables and such. The --prefix=/usr
option is reasonably well known alright. Too much hand-holding.
Those env vars shouldn't be needed, it should all be taken care by pkgconfig
.
If we leave out the env vars in the above you get this:
configure: error: Package requirements (sqlite3 >= 3.22.0) were not met:
No package 'sqlite3' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables SQLITE_CFLAGS
and SQLITE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
with the .pc files in
find / -name "*.pc"
/usr/share/pkgconfig/dracut.pc
/usr/share/pkgconfig/shared-mime-info.pc
/usr/share/pkgconfig/udev.pc
/usr/lib64/pkgconfig/systemd.pc
/usr/lib/pkgconfig/sqlite3.pc
/usr/lib/pkgconfig/raft.pc
/usr/lib/pkgconfig/libuv.pc
/tmp/libuv-1.40.0/libuv.pc
/tmp/raft/raft.pc
/tmp/sqlite-autoconf-3330000/sqlite3.pc
But pkg-config shows:
pkg-config --list-all
udev udev - udev
dracut dracut - dracut
systemd systemd - systemd System and Service Manager
shared-mime-info shared-mime-info - Freedesktop common MIME database
pkg-config seems to ignore the .pc files installed in /usr/lib
on centos7. export LD_LIBRARY_PATH
seems to have no effect on pkg-config either. /usr/lib64
and /usr/share
seem to be fine for pkg-config of centos7 though.
Simply doing this:
mv /usr/lib/pkgconfig/*.pc /usr/lib64/pkgconfig/
gets you past the configure
part but you fail at the make
step of dqlite:
In file included from src/conn.c:1:0:
src/conn.h:8:21: fatal error: raft/uv.h: No such file or directory
#include <raft/uv.h>
The env vars just work.
This works as an alternative to the env vars. The two mv
commands at the right time make the difference:
yum install -y git autoconf automake libtool make
cd /tmp
curl -LO https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
tar xf sqlite-autoconf-3330000.tar.gz
cd sqlite-autoconf-3330000
./configure --prefix=/usr
make -j4
make install
cd ..
curl -LO https://github.com/libuv/libuv/archive/v1.40.0.tar.gz
tar xf v1.40.0.tar.gz
cd libuv-1.40.0
./autogen.sh
./configure --prefix=/usr
make -j4
make install
cd ..
mv -f /usr/lib/pkgconfig/*.pc /usr/lib64/pkgconfig/
git clone --depth=1 https://github.com/canonical/raft.git
cd raft
autoreconf -i
./configure --prefix=/usr
make -j4
make install
cd ..
mv -f /usr/lib/pkgconfig/*.pc /usr/lib64/pkgconfig/
git clone --depth=1 https://github.com/canonical/dqlite.git
cd dqlite
autoreconf -i
./configure --prefix=/usr
make -j4
make install
I'm going to close this since it's really the responsibility of Autotools and pkg-config on each system to coordinate on where .pc files are installed.