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

cannot find package runtime/cgo (using -importcfg) #40505

Closed
xijiz opened this issue Jul 31, 2020 · 2 comments
Closed

cannot find package runtime/cgo (using -importcfg) #40505

xijiz opened this issue Jul 31, 2020 · 2 comments

Comments

@xijiz
Copy link

@xijiz xijiz commented Jul 31, 2020

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

$ go version
go version go1.12.17 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/xijiz/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/xijiz/repohub/bowen/backend"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build930370573=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When I run go run main.go, I encountered the following problem:

# command-line-arguments
cannot find package runtime/cgo (using -importcfg)
cannot find package encoding/binary (using -importcfg)
/usr/local/go/pkg/tool/linux_amd64/link: cannot open file : open : no such file or directory

I have imported a binary-package named gotvm.a which calls C APIs.

I also checked the directory ls /usr/local/go/pkg/linux_amd64/runtime:

cgo.a debug.a internal pprof pprof.a race.a trace.a

What did you expect to see?

I want to run this program without error.

What did you see instead?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 31, 2020

I have imported a binary-package named gotvm.a which calls C APIs.

What does this look like? BInary-only packages required a Go file that lists the package imports; does that Go file include import "C"?

Note that Go 1.12 is no longer supported. And it was also the last release to support binary packages.

@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Aug 3, 2020

For asking questions about learning the language, see one of our forums: https://golang.org/wiki/Questions. We only use this issue tracker for tracking bugs. People in the forums can explain what is happening here.

@cagedmantis cagedmantis closed this Aug 3, 2020
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.