Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go mod vendor and cgo preambles #29479

Closed
wondratsch opened this issue Dec 31, 2018 · 2 comments
Closed

cmd/go: go mod vendor and cgo preambles #29479

wondratsch opened this issue Dec 31, 2018 · 2 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@wondratsch
Copy link

wondratsch commented Dec 31, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.4 openbsd/amd64
go version go1.11.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/wondratsch/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/wondratsch/golang"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/wondratsch/Downloads/hugo-0.53/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build939105182=/tmp/go-build -gno-record-gcc-switches"

What did you do?

wget https://github.com/gohugoio/hugo/archive/v0.53.tar.gz
tar -xzf v0.53.tar.gz
cd hugo-0.53
go mod vendor
CGO_ENABLED=1 go build -mod=vendor -a -v -tags extended

What did you expect to see?

A successful build

What did you see instead?

github.com/wellington/go-libsass/libs

vendor/github.com/wellington/go-libsass/libs/encoding.go:4:11: fatal error: sass/context.h: No such file or directory
// #include "sass/context.h"
^~~~~~~~~~~~~~~~
compilation terminated.

What do you think happened?

cgo can't find it's preamble, I think "go mod vendor" doesn't look for cgo dependencies of build tags. If I run "go build" without the vendor only flag, it works fine.

@katiehockman katiehockman changed the title go mod vendor and cgo preambles cmd/go: go mod vendor and cgo preambles Jan 2, 2019
@katiehockman katiehockman added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jan 2, 2019
@katiehockman katiehockman added this to the Go1.13 milestone Jan 2, 2019
@katiehockman
Copy link
Contributor

/cc @bcmills

@bcmills
Copy link
Contributor

bcmills commented Jan 8, 2019

Dup of #26366.

TL;DR: The go tool only considers source files in the same directory as a Go package, for both vendoring and cache invalidation.

@bcmills bcmills closed this as completed Jan 8, 2019
@golang golang locked and limited conversation to collaborators Jan 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants