Skip to content

Commit

Permalink
Update dqlite and deps (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
louiseschmidtgen authored Aug 8, 2024
1 parent 97d1db8 commit 7d34ca4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/k8s/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/canonical/k8s
go 1.22.5

require (
github.com/canonical/go-dqlite v1.21.0
github.com/canonical/go-dqlite v1.22.0
github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac
github.com/canonical/microcluster v0.0.0-20240725000112-da36ecbd845e
github.com/go-logr/logr v1.4.2
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b h1:otBG+dV+YK+Soembj
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50=
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o=
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/canonical/go-dqlite v1.21.0 h1:4gLDdV2GF+vg0yv9Ff+mfZZNQ1JGhnQ3GnS2GeZPHfA=
github.com/canonical/go-dqlite v1.21.0/go.mod h1:Uvy943N8R4CFUAs59A1NVaziWY9nJ686lScY7ywurfg=
github.com/canonical/go-dqlite v1.22.0 h1:DuJmfcREl4gkQJyvZzjl2GHFZROhbPyfdjDRQXpkOyw=
github.com/canonical/go-dqlite v1.22.0/go.mod h1:Uvy943N8R4CFUAs59A1NVaziWY9nJ686lScY7ywurfg=
github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac h1:WqXeS0uyAAmFB9aflCucb/pPZzIdivO9uG4tWw7CEAw=
github.com/canonical/lxd v0.0.0-20240709081608-9df996e36bac/go.mod h1:S2MXobHv9Wh6cpr3biLo2Kq0vqK2/PxpFuE/8ZsNDic=
github.com/canonical/microcluster v0.0.0-20240725000112-da36ecbd845e h1:a/YDYYSWFO/Z1AJAKnfkVLBunLLSauuCBRU23Jzd/Do=
Expand Down
35 changes: 6 additions & 29 deletions src/k8s/hack/dynamic-dqlite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,6 @@ if [ ! -f "${BUILD_DIR}/lz4/lib/liblz4.a" ] || [ ! -f "${BUILD_DIR}/lz4/lib/libl
)
fi

# build raft
if [ ! -f "${BUILD_DIR}/raft/libraft.la" ]; then
(
cd "${BUILD_DIR}"
rm -rf raft
git clone "${REPO_RAFT}" --depth 1 --branch "${TAG_RAFT}" > /dev/null
cd raft
autoreconf -i > /dev/null
./configure \
CFLAGS="-I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib" \
LDFLAGS="-L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib" \
UV_CFLAGS="-I${BUILD_DIR}/libuv/include" \
UV_LIBS="-L${BUILD_DIR}/libuv/.libs" \
LZ4_CFLAGS="-I${BUILD_DIR}/lz4/lib" \
LZ4_LIBS="-L${BUILD_DIR}/lz4/lib" \
> /dev/null

make -j > /dev/null
)
fi

# build sqlite3
if [ ! -f "${BUILD_DIR}/sqlite/libsqlite3.la" ]; then
(
Expand All @@ -112,14 +91,14 @@ if [ ! -f "${BUILD_DIR}/dqlite/libdqlite.la" ]; then
git clone "${REPO_DQLITE}" --depth 1 --branch "${TAG_DQLITE}" > /dev/null
cd dqlite
autoreconf -i > /dev/null
./configure \
CFLAGS="-I${BUILD_DIR}/raft/include -I${BUILD_DIR}/sqlite -I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib -Werror=implicit-function-declaration" \
LDFLAGS="-L${BUILD_DIR}/raft/.libs -L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib -L${BUILD_DIR}/libnsl/src" \
RAFT_CFLAGS="-I${BUILD_DIR}/raft/include" \
RAFT_LIBS="-L${BUILD_DIR}/raft/.libs" \
./configure --enable-build-raft \
CFLAGS="-I${BUILD_DIR}/sqlite -I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib -Werror=implicit-function-declaration" \
LDFLAGS=" -L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib -L${BUILD_DIR}/libnsl/src" \
UV_CFLAGS="-I${BUILD_DIR}/libuv/include" \
UV_LIBS="-L${BUILD_DIR}/libuv/.libs" \
SQLITE_CFLAGS="-I${BUILD_DIR}/sqlite" \
LZ4_CFLAGS="-I${BUILD_DIR}/lz4/lib" \
LZ4_LIBS="-L${BUILD_DIR}/lz4/lib" \
> /dev/null

make -j > /dev/null
Expand All @@ -131,7 +110,6 @@ fi
cd "${BUILD_DIR}"
cp libuv/.libs/* "${INSTALL_DIR}/lib"
cp lz4/lib/*.so* "${INSTALL_DIR}/lib"
cp raft/.libs/* "${INSTALL_DIR}/lib"
cp sqlite/.libs/* "${INSTALL_DIR}/lib"
cp dqlite/.libs/* "${INSTALL_DIR}/lib"
)
Expand All @@ -140,13 +118,12 @@ fi
(
cd "${BUILD_DIR}"
cp -r libuv/include/* "${INSTALL_DIR}/include"
cp -r raft/include/* "${INSTALL_DIR}/include"
cp -r sqlite/*.h "${INSTALL_DIR}/include"
cp -r dqlite/include/* "${INSTALL_DIR}/include"
)

export CGO_CFLAGS="-I${INSTALL_DIR}/include"
export CGO_LDFLAGS="-L${INSTALL_DIR}/lib -ldqlite -lraft -luv -llz4 -lsqlite3"
export CGO_LDFLAGS="-L${INSTALL_DIR}/lib -ldqlite -luv -llz4 -lsqlite3 -Wl,-z,stack-size=1048576"
export LD_LIBRARY_PATH="${INSTALL_DIR}/lib"

echo "Libraries are in '${INSTALL_DIR}/lib'"
10 changes: 4 additions & 6 deletions src/k8s/hack/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ REPO_LIBTIRPC="https://salsa.debian.org/debian/libtirpc.git"
REPO_LIBNSL="https://github.com/thkukuk/libnsl.git"
REPO_LIBUV="https://github.com/libuv/libuv.git"
REPO_LIBLZ4="https://github.com/lz4/lz4.git"
REPO_RAFT="https://github.com/canonical/raft.git"
REPO_SQLITE="https://github.com/sqlite/sqlite.git"
REPO_DQLITE="https://github.com/canonical/dqlite.git"

## Component versions
TAG_MUSL="v1.2.3"
TAG_MUSL="v1.2.4"
TAG_LIBTIRPC="upstream/1.3.3"
TAG_LIBNSL="v2.0.0"
TAG_LIBNSL="v2.0.1"
TAG_LIBUV="v1.48.0"
TAG_LIBLZ4="v1.9.4"
TAG_RAFT="v0.18.0"
TAG_SQLITE="version-3.40.0"
TAG_DQLITE="v1.15.1"
TAG_SQLITE="version-3.45.1"
TAG_DQLITE="v1.16.7"
35 changes: 6 additions & 29 deletions src/k8s/hack/static-dqlite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,6 @@ if [ ! -f "${BUILD_DIR}/lz4/lib/liblz4.a" ] || [ ! -f "${BUILD_DIR}/lz4/lib/libl
)
fi

# build raft
if [ ! -f "${BUILD_DIR}/raft/libraft.la" ]; then
(
cd "${BUILD_DIR}"
rm -rf raft
git clone "${REPO_RAFT}" --depth 1 --branch "${TAG_RAFT}" > /dev/null
cd raft
autoreconf -i > /dev/null
./configure --disable-shared \
CFLAGS="${CFLAGS} -I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib" \
LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib" \
UV_CFLAGS="-I${BUILD_DIR}/libuv/include" \
UV_LIBS="-L${BUILD_DIR}/libuv/.libs" \
LZ4_CFLAGS="-I${BUILD_DIR}/lz4/lib" \
LZ4_LIBS="-L${BUILD_DIR}/lz4/lib" \
> /dev/null

make -j > /dev/null
)
fi

# build sqlite3
if [ ! -f "${BUILD_DIR}/sqlite/libsqlite3.la" ]; then
(
Expand All @@ -143,14 +122,14 @@ if [ ! -f "${BUILD_DIR}/dqlite/libdqlite.la" ]; then
git clone "${REPO_DQLITE}" --depth 1 --branch "${TAG_DQLITE}" > /dev/null
cd dqlite
autoreconf -i > /dev/null
./configure --disable-shared \
CFLAGS="${CFLAGS} -I${BUILD_DIR}/raft/include -I${BUILD_DIR}/sqlite -I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib -I${INSTALL_DIR}/musl/include -Werror=implicit-function-declaration" \
LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/raft/.libs -L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib -L${BUILD_DIR}/libnsl/src" \
RAFT_CFLAGS="-I${BUILD_DIR}/raft/include" \
RAFT_LIBS="-L${BUILD_DIR}/raft/.libs" \
./configure --disable-shared --enable-build-raft \
CFLAGS="${CFLAGS} -I${BUILD_DIR}/sqlite -I${BUILD_DIR}/libuv/include -I${BUILD_DIR}/lz4/lib -I${INSTALL_DIR}/musl/include -Werror=implicit-function-declaration" \
LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libuv/.libs -L${BUILD_DIR}/lz4/lib -L${BUILD_DIR}/libnsl/src" \
UV_CFLAGS="-I${BUILD_DIR}/libuv/include" \
UV_LIBS="-L${BUILD_DIR}/libuv/.libs" \
SQLITE_CFLAGS="-I${BUILD_DIR}/sqlite" \
LZ4_CFLAGS="-I${BUILD_DIR}/lz4/lib" \
LZ4_LIBS="-L${BUILD_DIR}/lz4/lib" \
> /dev/null

make -j > /dev/null
Expand All @@ -163,7 +142,6 @@ fi
cp libuv/.libs/* "${INSTALL_DIR}/lib"
cp lz4/lib/*.a "${INSTALL_DIR}/lib"
cp lz4/lib/*.so* "${INSTALL_DIR}/lib"
cp raft/.libs/*.a "${INSTALL_DIR}/lib"
cp sqlite/.libs/*.a "${INSTALL_DIR}/lib"
cp dqlite/.libs/*.a "${INSTALL_DIR}/lib"
)
Expand All @@ -172,10 +150,9 @@ fi
(
cd "${BUILD_DIR}"
cp -r libuv/include/* "${INSTALL_DIR}/include"
cp -r raft/include/* "${INSTALL_DIR}/include"
cp -r sqlite/*.h "${INSTALL_DIR}/include"
cp -r dqlite/include/* "${INSTALL_DIR}/include"
)

export CGO_CFLAGS="-I${INSTALL_DIR}/include"
export CGO_LDFLAGS="-L${INSTALL_DIR}/lib -luv -lraft -ldqlite -llz4 -lsqlite3"
export CGO_LDFLAGS="-L${INSTALL_DIR}/lib -luv -ldqlite -llz4 -lsqlite3 -Wl,-z,stack-size=1048576"

0 comments on commit 7d34ca4

Please sign in to comment.