我有一個(gè)使用 libvirt-go v7.4.0 的項(xiàng)目。去.mod:github.com/libvirt/libvirt-go v7.4.0+incompatible // indirect它可以在 mac 和 linux 上編譯,但是在帶有標(biāo)志的 macos 上交叉編譯失敗。GOOS=Linux$ env GOOS=linux go build -o myapp .# gitlab.mycompany.io/mycompany-platform/myapp/command/agentcommand/agent/libvirt_listener.go:11:26: undefined: libvirt.DomainEventTypecommand/agent/libvirt_listener.go:23:14: undefined: libvirt.Connectcommand/agent/libvirt_listener.go:100:9: undefined: libvirt.EventRegisterDefaultImplcommand/agent/libvirt_listener.go:105:15: undefined: libvirt.NewConnectcommand/agent/libvirt_listener.go:115:4: undefined: libvirt.EventRunDefaultImplcommand/agent/libvirt_listener.go:121:22: undefined: libvirt.Connectcommand/agent/libvirt_listener.go:121:42: undefined: libvirt.Domaincommand/agent/libvirt_listener.go:121:65: undefined: libvirt.DomainEventLifecyclecommand/agent/libvirt_listener.go:149:63: undefined: libvirt.DomainStatecommand/agent/libvirt_listener.go:121:22: too many errors
1 回答

茅侃侃
TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超22個(gè)贊
該庫(kù)包是與本機(jī)庫(kù)的 CGo 綁定。因此,在構(gòu)建 CGO 時(shí)不可能禁用 CGO,反過(guò)來(lái)也不可能交叉編譯,因?yàn)檫@會(huì)隱式禁用 CGO。
- 1 回答
- 0 關(guān)注
- 239 瀏覽
添加回答
舉報(bào)
0/150
提交
取消