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 "context" #65

Closed
179416326 opened this issue Dec 10, 2019 · 8 comments
Closed

Cannot find package "context" #65

179416326 opened this issue Dec 10, 2019 · 8 comments

Comments

@179416326
Copy link

Problem countered:
go install -tags libsqlite3 ./cmd/dqlite-demo
cmd/dqlite-demo/add.go:4:2: cannot find package "context" in any of:
/usr/lib/go-1.6/src/context (from $GOROOT)
/home/zz/go/src/context (from $GOPATH)
/home/zz/go/src/github.com/canonical/go-dqlite/src/context

Originally posted by @179416326 in #64 (comment)

@179416326
Copy link
Author

zz@zz-virtual-machine:~/go/src/github.com/canonical/go-dqlite$ go env
GOARCH="amd64"
GOBIN="/usr/lib/go-1.6/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/zz/go:/home/zz/go/src/github.com/canonical/go-dqlite"
GORACE=""
GOROOT="/usr/lib/go-1.6"
GOTOOLDIR="/usr/lib/go-1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

@179416326
Copy link
Author

179416326 commented Dec 10, 2019

After install go1.13, the "Cannot find package "context"" problem solved, but came new problems:

zz@zz-virtual-machine:~/go/src/github.com/canonical/go-dqlite$ go install -tags libsqlite3 ./cmd/dqlite-demo
import cycle not allowed
package github.com/canonical/go-dqlite/cmd/dqlite-demo
imports context
imports errors
imports internal/reflectlite
imports runtime
imports internal/bytealg
imports internal/cpu
imports runtime

@freeekanayaka
Copy link
Contributor

Please try to create a file called ~/main.go in your home directory, with this content:

package main

import (
	"context"
	"fmt"
)

func main() {
	fmt.Println(context.Background())
}

and then run go run main.go from your home directory.

If it fails in the same way, it probably means that you have mixed up your Go 1.6 and Go 1.13 installations.

@179416326
Copy link
Author

dqlite-demo binary is installed, but something wrong when start :

root@zz-virtual-machine:/home/zz/go/src/github.com/canonical/go-dqlite# dqlite-demo start 1
dqlite-demo: symbol lookup error: /usr/local/lib/libraft.so.0: undefined symbol: __asan_option_detect_stack_use_after_return

@freeekanayaka
Copy link
Contributor

You probably compiled the raft library using ./configure --enable-sanitize, which is not supported when using Go, and should only be used for development of raft itself. Please use just ./configure, or ./configure --enable-debug.

@179416326
Copy link
Author

Thanks a lot, now running dqlite-demo well.

@179416326
Copy link
Author

Consumed a lot of time on GO, if CLIENT written in C will be perfect!

@freeekanayaka
Copy link
Contributor

C client would be nice indeed, but at the moment I don't have the time to write it.

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

No branches or pull requests

2 participants