Lxd 4.1 build relies on non-archived personal github repos

Hello LXD community/devs,

I think there is an issue with the build process, specifically GOlang build, of lxd (<=4.1) relying on personal github repos as dependencies.

For example, the repo github.com/mdlayher/eui64 is a dependency of lxd golang build, but the owner of the repo has moved it to another repo, thus breaking the build.

I think it should be that if personal github repos are used for the builds as dependencies, they should be required to be archived and read-only. A build could pass CI today and fail tomorrow depending on this.

– ps. it would be ideal to remove golang entirely from lxd as it is heavy/bloating.

Thank you for your support,
e

_dist/MANIFEST:./src/github.com/mdlayher/eui64: 300b7bde793cddc7eba4de654a5cc99b34a81f04

PS. TP looks like a **ggit Z

That’s why our release tarballs include all our dependencies at release time. Use those and LXD will always build fine.

1 Like

OK. Are you referring to the lxd-4.x/_dist/deps/* directory ?

How would I exactly get the make deps compilation to utilize those sources for deps, instead of pulling down from github everytime?

Another way to phrase this is, is it possible to build lxd without an active internet connection via the release tarball ?

I think I found the answer in the docs:

cd lxd-3.18
export GOPATH=$(pwd)/_dist

Please correct me if I am wrong :slight_smile:

Thank you,
e

Yep, it’s supposed to work fine of you use _dist as your GOPATH. Even ‘make deps’ should work and just build the libraries directly from there.

1 Like

:hugs: the below built the bins/deps fine

- name: build deps for lxd via make
    shell: |
      mkdir -p {{tmp_lxd_path}}  &&\
      export GOPATH={{tmp_gobuild_path}}  &&\
      export GOROOT={{tmp_golang_path}}/go  &&\
      export PATH={{tmp_golang_path}}/go/bin:$PATH  &&\
      make deps
    args:
      chdir: "{{tmp_lxd_path}}/{{lxd_release_version}}"

  - name: build lxd via make
    shell: |
      export GOBIN={{tmp_lxd_path}}/bin  &&\
      export GOPATH={{tmp_gobuild_path}}  &&\
      export GOROOT={{tmp_golang_path}}/go  &&\
      export PATH={{tmp_golang_path}}/go/bin:$PATH  &&\
      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}"  &&\
      export CGO_LDFLAGS_ALLOW="-Wl,-wrap,pthread_create"
      make
    args:
      chdir: "{{tmp_lxd_path}}/{{lxd_release_version}}"
      executable: /bin/bash

here are the prebuilt lxd-4.2 binaries/deps for amd64-linux debian buster:

via www.numbersro.org