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: build fails when %go_import is used in SWIG interfaces #36636

Open
i96751414 opened this issue Jan 18, 2020 · 3 comments
Open

cmd/go: build fails when %go_import is used in SWIG interfaces #36636

i96751414 opened this issue Jan 18, 2020 · 3 comments

Comments

@i96751414
Copy link

@i96751414 i96751414 commented Jan 18, 2020

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

go version go1.13.5 linux/amd64

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build083237116=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I have created an empty package and a SWIG interface for it containing only %go_import(_ "time").

What did you expect to see?

A successful build (by doing go build).

What did you see instead?

The build failed with the following error:
/tmp/go-build220377569/b001/_dummy_swig.go:40:8: can't find import: "time"

@i96751414
Copy link
Author

@i96751414 i96751414 commented Jan 19, 2020

Files to reproduce this issue: dummy_test.zip

I believe this can be explained by

// TODO: The .swig and .swigcxx files can use

A workaround for this is to add import _ "time" on the go file.

@ALTree ALTree changed the title go build fails when %go_import is used in SWIG interfaces cmd/go: build fails when %go_import is used in SWIG interfaces Jan 20, 2020
@bcmills bcmills added this to the Unplanned milestone Jan 22, 2020
@bcmills bcmills added the help wanted label Jan 22, 2020
@bcmills
Copy link
Member

@bcmills bcmills commented Jan 22, 2020

If someone would like to do that TODO, please send a CL.

1 similar comment
@bcmills
Copy link
Member

@bcmills bcmills commented Jan 22, 2020

If someone would like to do that TODO, please send a CL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.