-
Notifications
You must be signed in to change notification settings - Fork 48
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
Installation issue: undefined: QueryBuilder #17
Comments
Hmm, just checked on a blank golang:1.13.3 docker image and it worked for me :/ I see you're using the manual installation for a project without go modules, i.e. you're installing objectbox-go globally into your $GOPATH. Is that what you intended? If so, have you had objectbox-go installed before so maybe there's some conflict with an old version? Maybe you could try removing the installed version like in the script below. This assumes a global installation, i.e. when you're not using go-modules. rm -r $GOPATH/src/github.com/objectbox/objectbox-go If you're using go modules, you should just import the package using |
Ok, thanks. Switched to using go-modules. Here is what I see now: go build ./src/services/calculation/ cat go.mod go 1.13 require ( ls -la /mnt/c/DEV/projects/go/src/github.com/objectbox/ |
Are you, by any chance, importing Also, I don't understand how your I hope that helps |
Ok, further cleanup of my GOPATH: go env Failing on: ~/go/src/bitbucket.org/rerosum/algotrader$ go build ./src/data where ./src/data has: import ( line 30 of model.go: import "github.com/objectbox/objectbox-go/internal/generator" we have this directory on the source path: ls -la ../../../../pkg/mod/github.com/objectbox/[email protected]/internal/generator/ |
Same issue when running the install script from the project root: :~/go/src/bitbucket.org/rerosum/algotrader$ bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-go/master/install.sh) Extracting into download/testing/libobjectbox-0.6.0-4db1be536558d833e52e862fd84d64d75c2b3656... |
from go help gopath:
the model.go file is rooted in: but the generator package is rooted in: github.com/objectbox/objectbox-go/internal/generator So if I read the help file correctly, model cannot import generator, hence the error message. Am I correct? |
I can't see anything wrong with your go env 👍
With go modules, your project should not be in the $GOPATH, IIRC I've had problems with such projects before. Not sure if it's the cause here, but could you try moving your project out of GOPATH, i.e. out of I can't imagine how the internal could be the culprit, in that case, the code wouldn't work for anyone, ever, not even in the library itself.
"The parent of "internal"" => Just an idea: if you're using "objectbox" as a package (directory) name inside your project, it might be messing with go package resolution as well (seen it in the past). If nothing else helps, maybe trying to narrow down the scope would help to find the problem, e.g. by trying to include objectbox in a minimal example project you could share. If that still doesn't work for you, and the example works in a docker image, then we at least know it's somehow related to the environment. |
Also, there was an issue #16 - giving the same error message - turned out to be due to cross-compilation. You aren't trying to do that, are you? |
Firstly, thank you for helping me work through my issue. I'm sure the problem is on my side, so I took your advice and started from a clean test project located outside of the GOPATH. Here is what I see when running the installer:
I have to say I'm baffled why my environment is behaving differently than yours. I'll try any ideas you might have, thank you. |
Looks like I figured it out. Here is what was wrong with my environment: I didn't have gcc installed and w/o it I was missing the *.h files typically found in the ../include system folder and which are needed for the imports of objectbox.h. This prevented querybuilder.go from compiling which is needed by condition.go. I'm all set for now, thanks for all the help! |
I'm glad to hear that you've figured it out. It's a pity the error is so cryptic/unrelated to the actual cause :/ I'll update the docs with the findings. Thanks for the feedback. |
@vaind can our setup script check for that and give advice how to install it? |
While following the installation steps: dependencies, an error occurs with this command:
go get -u github.com/objectbox/objectbox-go/...
github.com/objectbox/objectbox-go/objectbox
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:21:14: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:27:20: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:30:48: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:40:52: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/entity.go:21:5: undefined: TypeId
============
go version go1.13.3 linux/amd64
I can see that the QueryBuilder type is defined in: ../../../github.com/objectbox/objectbox-go/objectbox/querybuilder.go, however the file is not being included while building.
Thanks
The text was updated successfully, but these errors were encountered: