bored-spoon-83710
12/02/2022, 6:11 PMpulumi up
after that, I got the following error:
# <http://github.com/pjbgf/sha1cd/cgo|github.com/pjbgf/sha1cd/cgo>
vendor/github.com/pjbgf/sha1cd/cgo/sha1.go:3:11: fatal error: lib/sha1.h: No such file or directory
3 | // #include <lib/sha1.h>
| ^~~~~~~~~~~~
compilation terminated.
error: error in compiling Go: unable to run `go build`: exit status 2
The concerned package is an indirect dependency of the Go Pulumi SDK:
❯ go mod why <http://github.com/pjbgf/sha1cd/cgo|github.com/pjbgf/sha1cd/cgo>
# <http://github.com/pjbgf/sha1cd/cgo|github.com/pjbgf/sha1cd/cgo>
<my-pulumi-go-project>
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>
<http://github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin|github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin>
<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>
<http://github.com/go-git/go-git/v5/plumbing|github.com/go-git/go-git/v5/plumbing>
<http://github.com/go-git/go-git/v5/plumbing/hash|github.com/go-git/go-git/v5/plumbing/hash>
<http://github.com/pjbgf/sha1cd/cgo|github.com/pjbgf/sha1cd/cgo>
I did some search and I came across this pull request which should have solved the problem: https://github.com/pjbgf/sha1cd/pull/5.
However, this is not the case because Pulumi doesn’t seem to build Go programs using CGO_ENABLED=0
.
What’s the reason why CGO_ENABLED=0
is not used?many-telephone-49025
12/02/2022, 7:15 PMpulumi about
and maybe share your project (or parts of it, as possible)?bored-spoon-83710
12/02/2022, 9:31 PMCLI
Version 3.48.0
Go Version go1.19.2
Go Compiler gc
Plugins
NAME VERSION
go unknown
Host
OS fedora
Version 37
Arch x86_64
This project is written in go: executable='/usr/bin/go' version='go version go1.19.1 linux/amd64'
Current Stack: test
TYPE URN
pulumi:pulumi:Stack urn:pulumi:test::cgo::pulumi:pulumi:Stack::cgo-test
Found no pending operations associated with test
Backend
Name toolbox
URL file://.
User yann
Organizations
Pulumi locates its logs in /tmp by default
warning: Failed to get information about the Pulumi program's dependencies: failed to get modules: exit status 1
The root cause seems to be the vendoring: github.com/pjbgf/sha1cd/cgo includes C files in github.com/pjbgf/sha1cd/cgo/lib and vendoring of a package doesn’t include subfolders. However, using export CGO_ENABLED=0
before running pulumi up
makes it work.CGO_ENABLED=0
?many-telephone-49025
12/04/2022, 1:27 PMbored-spoon-83710
12/04/2022, 1:39 PM