Closed maybe32 closed 1 year ago
What version/git SHA of libvirt are you generating against?
I'm not experiencing your specific error, but a different error after upgrading my version of c-for-go.
c-for-go cef5ec7833f3274488b3edd519f46ddfb57d5735 is the last version of c-for-go that works for me:
$ LIBVIRT_SOURCE=/home/ckuehl/src/libvirt go generate ./...
processing libvirt.yml done.
protocol file processing
processing src/remote/remote_protocol.x
processing src/remote/qemu_protocol.x
$ echo $?
0
Starting at c-for-go c95ebd03aba931e7248a6011f86d822ab878d00c, this is the error I get:
$ LIBVIRT_SOURCE=/home/ckuehl/src/libvirt go generate ./...
processing libvirt.yml ⠋[ERR] lv_source/include/libvirt/libvirt.h:34:11: include file not found: <libvirt/libvirt-common.h>
lv_source/include/libvirt/libvirt.h:35:11: include file not found: <libvirt/libvirt-host.h>
lv_source/include/libvirt/libvirt.h:36:11: include file not found: <libvirt/libvirt-domain.h>
lv_source/include/libvirt/libvirt.h:37:11: include file not found: <libvirt/libvirt-domain-checkpoint.h>
lv_source/include/libvirt/libvirt.h:38:11: include file not found: <libvirt/libvirt-domain-snapshot.h>
lv_source/include/libvirt/libvirt.h:39:11: include file not found: <libvirt/libvirt-event.h>
lv_source/include/libvirt/libvirt.h:40:11: include file not found: <libvirt/libvirt-interface.h>
lv_source/include/libvirt/libvirt.h:41:11: include file not found: <libvirt/libvirt-network.h>
lv_source/include/libvirt/libvirt.h:42:11: include file not found: <libvirt/libvirt-nodedev.h>
lv_source/include/libvirt/libvirt.h:43:11: include file not found: <libvirt/libvirt-nwfilter.h>
lv_source/include/libvirt/libvirt.h:44:11: include file not found: <libvirt/libvirt-secret.h>
lv_source/include/libvirt/libvirt.h:45:11: include file not found: <libvirt/libvirt-storage.h>
lv_source/include/libvirt/libvirt.h:46:11: include file not found: <libvirt/libvirt-stream.h>
c-for-go failed
libvirt.go:19: running "scripts/gen-consts.sh": exit status 1
protocol file processing
processing src/remote/remote_protocol.x
processing src/remote/qemu_protocol.x
$ echo $?
1
Hi connorkuehl, Thank you so much for your reply! c-for-go cef5ec7833f3274488b3edd519f46ddfb57d5735 works for me and version/git SHA of libvirt on my environment is d427102fbd690cb2f43dbf33751cc5194a5b16ce.
My working environment is below:
ubuntu:20.04
go version go1.20.1 linux/amd64
c-for-go@cef5ec7833f3274488b3edd519f46ddfb57d5735
goyacc@c6776771dde7a49828feb54fd8be11695a32b558
libvirt d427102fbd690cb2f43dbf33751cc5194a5b16ce
$ LIBVIRT_SOURCE=/home/ckuehl/src/libvirt go generate ./... processing libvirt.yml ⠋[ERR] lv_source/include/libvirt/libvirt.h:34:11: include file not found: <libvirt/libvirt-common.h> lv_source/include/libvirt/libvirt.h:35:11: include file not found: <libvirt/libvirt-host.h> lv_source/include/libvirt/libvirt.h:36:11: include file not found: <libvirt/libvirt-domain.h> lv_source/include/libvirt/libvirt.h:37:11: include file not found: <libvirt/libvirt-domain-checkpoint.h> lv_source/include/libvirt/libvirt.h:38:11: include file not found: <libvirt/libvirt-domain-snapshot.h> lv_source/include/libvirt/libvirt.h:39:11: include file not found: <libvirt/libvirt-event.h> lv_source/include/libvirt/libvirt.h:40:11: include file not found: <libvirt/libvirt-interface.h> lv_source/include/libvirt/libvirt.h:41:11: include file not found: <libvirt/libvirt-network.h> lv_source/include/libvirt/libvirt.h:42:11: include file not found: <libvirt/libvirt-nodedev.h> lv_source/include/libvirt/libvirt.h:43:11: include file not found: <libvirt/libvirt-nwfilter.h> lv_source/include/libvirt/libvirt.h:44:11: include file not found: <libvirt/libvirt-secret.h> lv_source/include/libvirt/libvirt.h:45:11: include file not found: <libvirt/libvirt-storage.h> lv_source/include/libvirt/libvirt.h:46:11: include file not found: <libvirt/libvirt-stream.h> c-for-go failed libvirt.go:19: running "scripts/gen-consts.sh": exit status 1 protocol file processing processing src/remote/remote_protocol.x processing src/remote/qemu_protocol.x $ echo $? 1
I also meet this error and resolve this by building libvirt and install as following:
meson setup build
ninja -C build install
I run code generators through docker and my steps are below. Hope this can be helpful for others.
sudo docker run -it ubuntu:20.04 bash
apt-get update
apt-get install git python3 python3-pip python3-setuptools python3-wheel ninja-build libxml2-utils xsltproc libglib2.0 libgnutls28-dev libxml2-dev wget -y
pip3 install meson docutils
cd /root
git clone https://github.com/libvirt/libvirt.git
cd /root/libvirt
meson setup build
ninja -C build install
wget https://go.dev/dl/go1.20.1.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.1.linux-amd64.tar.gz
export GOPATH=/root/go
export PATH=$PATH:/root/go/bin:/usr/local/go/bin
export LIBVIRT_SOURCE=/root/libvirt/
cd /root
git clone https://github.com/digitalocean/go-libvirt.git
cd /root/go-libvirt
go install github.com/xlab/c-for-go@cef5ec7833f3274488b3edd519f46ddfb57d5735
go install golang.org/x/tools/cmd/goyacc@c6776771dde7a49828feb54fd8be11695a32b558
go generate ./...
My environment:
After running "go generate ./...", libvirt.yaml is processed successfully but failing for processing protocol file. 2147483648 is larger than MAX_INT32 which is 2147483647. I have following questions:
The log is below: