Lxd-4.2 compile upstream changes

Hello LXD community,

I was able to successfully build lxd-4.2 w/ golang-13.1.3 on debian buster. I believe there were some upstream changes to the deps that broke the build when built again in the evening.

It seems to be that the .Connect function definition has changed for qemu lib.

     "# lxd-4.2/lxd/instance/drivers",
        "lxd/instance/drivers/driver_qemu.go:470:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:532:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:871:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:2004:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:2051:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:3422:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:3793:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd/instance/drivers/driver_qemu.go:3910:29: not enough arguments in call to \"github.com/lxc/lxd/lxd/instance/drivers/qmp\".Connect",
        "\thave (string, func(string, map[string]interface {}))",
        "\twant (string, string, func(string, map[string]interface {}))",
        "lxd-4.2/lxd/instance/drivers/qmp",

I will try the suggestion by @stgraber to utilize the prebuilt deps in the relase tarballs.

Thank you for the support,
e

** correction from the previous post, not prebuilt deps but sources supplied in _dist for the deps.

utilizing such via export GOPATH={{lxd_4.2_path}}/_dist before the make deps command and make ushered these errors. I was able to build the binaries and deps just fine last night, so I suspect there was an upstream change with qmp go library.

below are the build commands i am utilizing :slight_smile:

      mkdir -p {{tmp_lxd_path}}  &&\
      cd "{{tmp_lxd_path}}/src/{{lxd_release_version}}"  &&\
      export GOBIN={{tmp_lxd_path}}/bin  &&\
      export GOPATH={{tmp_lxd_path}}/_dist  &&\
      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

here is the directory structure for the build:

r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7
$ ls
_tmp_go_build
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7
$ cd _tmp_go_build/
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build
$ ls
_dist  lxd-4.2.tar.gz  src
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build
$ cd _dist/
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build/_dist
$ ls
deps  src
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build/_dist
$ cd src/
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build/_dist/src
$ ls
github.com  go.etcd.io  golang.org  google.golang.org  gopkg.in  vbom.ml
r0s3@a1y:/tmp/347ce04c-7c3a-50bb-b9b7-835632ba5ff7/_tmp_go_build/_dist/src
$ 

i seemed to made a mistake in the GOPATH for the build by utilizing {{tmp_lxd_path}} instead of {{tmp_gobuild_path}}.

here is the updated code: :slight_smile:
tmp_gobuild_path: "{{tmp_lxd_path}}/{{lxd_release_version}}/_dist"

  - name: build lxd via make
    shell: |
      mkdir -p {{tmp_lxd_path}}  &&\
      export GOBIN={{tmp_lxd_path}}/bin  &&\
      export GOPATH={{tmp_gobuild_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}}/src/{{lxd_release_version}}"
      executable: /bin/bash

i will share the results :heart_eyes:

i am still getting the same error during compile time regarding not enough arguments for qmp.Connect() function.

any guidance would be much appreciated

That’s odd as that would suggest you’re not actually using the bundled dependencies in dist…

1 Like

im not sure what deps were being used for the compile before, which is strange. i did not verify the build works without an active internet connection.

:hugs: the below built the bins/deps fine. thank you for the help @stgraber !

- 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
lxd_release_version: lxd-4.2
lxd_tar_gz_url: "https://linuxcontainers.org/downloads/lxd/{{lxd_release_version}}.tar.gz"
lxd_tar_gz_md5: md5:5ee8a54e42dacb41e713a8c2f9b9c770
tmp_lxd_path:  "/tmp/{{ ansible_date_time.iso8601_micro | to_uuid }}/_tmp_lxd_build" #"/tmp/{{ ansible_date_time.iso8601_micro | to_uuid }}-lxd"
opt_lxd_path: "/opt/lxd"
bin_lxd_path: "{{opt_lxd_path}}/bin"

tmp_gobuild_path: "{{tmp_lxd_path}}/{{lxd_release_version}}/_dist"
tmp_golang_path: "/tmp/golang"

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

via www.numbersro.org