Hello! I’ve upgraded the dependencies of my proje...
# golang
Hello! I’ve upgraded the dependencies of my project and running
pulumi up
after that, I got the following error:
Copy code
# <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:
Copy code
❯ 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>
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
. What’s the reason why
is not used?
Hi Yann, Can you run
pulumi about
and maybe share your project (or parts of it, as possible)?
Sure, here is a sample project https://github.com/yann-soubeyrand/pulumi-cgo and `pulumi about`:
Copy code
Version      3.48.0
Go Version   go1.19.2
Go Compiler  gc

go    unknown

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

Name           toolbox
URL            file://.
User           yann

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.
The problem with github.com/pjbgf/sha1cd has been fixed. However, my question remains: is there a reason why Pulumi doesn't use
Hi Yann, best thing would be to open an issue in the Pulumi repo! The engineers can than engage with your suggestion better
Thanks for the suggestion @many-telephone-49025. I’ve open this discussion: https://github.com/pulumi/pulumi/discussions/11526