The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6583

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Adding some more detail on building from source (latest version) vs. building a release. Also adding information on installing required libraries.
From 7666df6f44ec920f49f36dc006359c3aae960dad Mon Sep 17 00:00:00 2001
From: Daniel Robbins <drobb...@funtoo.org>
Date: Mon, 9 Dec 2019 21:14:40 -0700
Subject: [PATCH 1/2] Improve build from source instructions

The instructions for building from source are very minimal and didn't mention 
how to build official releases of LXD. This attempts to fix this.
---
 doc/index.md | 42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/doc/index.md b/doc/index.md
index d47730bd9b..650c583ddd 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -68,22 +68,32 @@ To run the testsuite, you'll also need:
 sudo apt install curl gettext jq sqlite3 uuid-runtime bzr socat
 ```
 
-
-### Building the tools
-LXD consists of two binaries, a client called `lxc` and a server called `lxd`.
-These live in the source tree in the `lxc/` and `lxd/` dirs, respectively.
-To get the code, set up your go environment:
+### From Source: Building the latest version
+To build the latest version of the code, perform the following steps:
 
 ```bash
 mkdir -p ~/go
 export GOPATH=~/go
+go get -d -v github.com/lxc/lxd/lxd
+cd $GOPATH/src/github.com/lxc/lxd
+make deps
+export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ 
-I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ 
-I${GOPATH}/deps/libco/"
+export CGO_LDFLAGS="${CGO_LDFLAGS} -L${GOPATH}/deps/sqlite/.libs/ 
-L${GOPATH}/deps/dqlite/.libs/ -L${GOPATH}/deps/raft/.libs 
-L${GOPATH}/deps/libco/"
+export 
LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}"
+make
 ```
 
-And then download it as usual:
+The build process will use `go get` and `git clone` to grab all necessary 
dependencies needed for building.
+
+### From Source: Building a Release
+
+To build an official release of LXD, download and extract a release tarball, 
and then set up GOPATH to point to the
+`_dist` directory inside it, which is configured to be used as a GOPATH and 
contains snapshots of all necessary sources. LXD
+will then build using these snapshots rather than grabbing 'live' sources 
using `go get` and `git clone`:
 
 ```bash
-go get -d -v github.com/lxc/lxd/lxd
-cd $GOPATH/src/github.com/lxc/lxd
+cd lxd-3.18
+export GOPATH=$(pwd)/_dist
 make deps
 export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ 
-I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ 
-I${GOPATH}/deps/libco/"
 export CGO_LDFLAGS="${CGO_LDFLAGS} -L${GOPATH}/deps/sqlite/.libs/ 
-L${GOPATH}/deps/dqlite/.libs/ -L${GOPATH}/deps/raft/.libs 
-L${GOPATH}/deps/libco/"
@@ -91,8 +101,20 @@ export 
LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs
 make
 ```
 
-...which will give you two binaries in `$GOPATH/bin`, `lxd` the daemon binary,
-and `lxc` a command line client to that daemon.
+### From Source: Installing
+
+When the build process completes,`$GOPATH/bin` will contain the `lxd` daemon, 
the `lxc` binary, as well as other tools.
+Binaries can be copied to appropriate locations in your path. The 
`$GOPATH/deps` directory will contain versions of
+requisite libraries that will also need to be installed in order for LXD to 
function. These libraries can be installed
+using the following commands:
+
+```bash
+cd "${GOPATH}/deps/sqlite" && make DESTDIR=/ libdir=/usr/lib install
+cd "${GOPATH}/deps/raft" && make DESTDIR=/ libdir=/usr/lib install
+cd "${GOPATH}/deps/libco" && make DESTDIR=/ LIBDIR=/usr/lib install
+cd "${GOPATH}/deps/dqlite" && make DESTDIR=/ libdir=/usr/lib install
+```
+`DESTDIR` and/or `libdir`/`LIBDIR` can be adjusted as necessary to install the 
libraries to a suitable library path.
 
 ### Machine Setup
 You'll need sub{u,g}ids for root, so that LXD can create the unprivileged

From 0966984cfa0942445741ed64839ec1d23a45063b Mon Sep 17 00:00:00 2001
From: Daniel Robbins <drobb...@funtoo.org>
Date: Tue, 10 Dec 2019 08:48:46 -0700
Subject: [PATCH 2/2] A small fix for libco install -- there is an implicit
 /usr

---
 doc/index.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/index.md b/doc/index.md
index 650c583ddd..fb2ff43864 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -111,8 +111,9 @@ using the following commands:
 ```bash
 cd "${GOPATH}/deps/sqlite" && make DESTDIR=/ libdir=/usr/lib install
 cd "${GOPATH}/deps/raft" && make DESTDIR=/ libdir=/usr/lib install
-cd "${GOPATH}/deps/libco" && make DESTDIR=/ LIBDIR=/usr/lib install
 cd "${GOPATH}/deps/dqlite" && make DESTDIR=/ libdir=/usr/lib install
+# Note that the libco make file is a bit different than the rest:
+cd "${GOPATH}/deps/libco" && make DESTDIR=/ LIBDIR=lib install
 ```
 `DESTDIR` and/or `libdir`/`LIBDIR` can be adjusted as necessary to install the 
libraries to a suitable library path.
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to