LXD 3.18 - build from source issue on Centos 8

I have been trying to build LXD 3.18 from source on Centos 8 and make dep works fine, later make fails.Also, the error below came up after I solved this issue .(by entering _dist/src/github.com/lxc/lxd and then running make)

This is the error I get now:

Please set the following in your environment (possibly ~/.bashrc)
export CGO_CFLAGS="-I/home/alpha/lxd-3.18/_dist/deps/sqlite/ -I/home/alpha/lxd-3.18/_dist/deps/libco/ -I/home/alpha/lxd-3.18/_dist/deps/raft/include/ -I/home/alpha/lxd-3.18/_dist/deps/dqlite/include/"
export CGO_LDFLAGS="-L/home/alpha/lxd-3.18/_dist/deps/sqlite/.libs/ -L/home/alpha/lxd-3.18/_dist/deps/libco/ -L/home/alpha/lxd-3.18/_dist/deps/raft/.libs -L/home/alpha/lxd-3.18/_dist/deps/dqlite/.libs/"
export LD_LIBRARY_PATH="/home/alpha/lxd-3.18/_dist/deps/sqlite/.libs/:/home/alpha/lxd-3.18/_dist/deps/libco/:/home/alpha/lxd-3.18/_dist/deps/raft/.libs/:/home/alpha/lxd-3.18/_dist/deps/dqlite/.libs/"

$ make
go get -t -v -d ./...
CC=cc go install -v -tags "libsqlite3"  ./...
# github.com/lxc/lxd/shared/idmap
shared/idmap/shift_linux.go:28:10: fatal error: sys/capability.h: No such file or directory
 #include <sys/capability.h>
compilation terminated.
make: *** [Makefile:19: default] Error 2

Any help?
(I have the libpcap-devel installed)

I am okay with installing a newer version (in 3.X.X) if such issues are fixed later. I have been following the install from source guide given here.


You need libcap-dev, that may also be called something like libcap2-dev.
libpcap is a network library which is entirely unrelated to this.

Oops! I apologise. I did not realise I made a typo there :slight_smile:
Thanks for your quick help as always @stgraber

@stgraber, Sorry, but I have a follow up:

Can you also please explain what this part does? Is it interpositioning?

I am not able to make this last part work on my machine, so looking for some help.
I guess my GOPATH would still point at _dist?
I think the link describes the case if I install the latest version, not a release. :slight_smile:

If this helps:

$ whereis go
go: /usr/local/go /usr/local/go/bin/go

Do you have ~/go/bin/lxc and ~/go/bin/lxd? If so, then all you really need is the PATH and LD_LIBRARY_PATH to point to the right locations.

Although I have a go/ folder on my $HOME, but that did not have bin. I redirected it to ~/lxd-3.18/_dist because I downloaded a tarball and then installed it from there.

It seems to get the binaries from the right place, hope this is the right way to do it? TIA :slight_smile:

$ which lxc
$ which lxd