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

Undefined errors from CockroachDB when trying to build #41

Open
dalanmiller opened this issue Nov 19, 2018 · 5 comments
Open

Undefined errors from CockroachDB when trying to build #41

dalanmiller opened this issue Nov 19, 2018 · 5 comments

Comments

@dalanmiller
Copy link

dalanmiller commented Nov 19, 2018

I've definitely ran make in the $GOPATH/src/github.com/cockroachdb/cockroach dir, but still seem to be getting this undefined errors.

➜  sqlfmt git:(master) bash build.sh
+ IMG=gcr.io/hots-cockroach/sqlfmt:latest
+ go build -o sqlfmt
# github.com/cockroachdb/cockroach/pkg/sql/lex
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:10:32: undefined: ABORT
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:11:32: undefined: ACTION
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:12:32: undefined: ADD
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:13:32: undefined: ADMIN
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:14:32: undefined: AGGREGATE
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:15:32: undefined: ALL
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:16:32: undefined: ALTER
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:17:32: undefined: ANALYSE
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:18:32: undefined: ANALYZE
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:19:32: undefined: AND
../../cockroachdb/cockroach/pkg/sql/lex/keywords.go:19:32: too many errors
@maddyblue
Copy link
Owner

See the last line of the readme:

Requires having the master branch of https://github.com/cockroachdb/cockroach checked out at $GOPATH/src/github.com/cockroachdb/cockroach, and running make in that directory.

@dalanmiller
Copy link
Author

dalanmiller commented Nov 19, 2018

Apologies @mjibson, as a post-posting edit, I mentioned that I had done that! 🙇

@maddyblue
Copy link
Owner

Those identifiers should appear in a file called tokens.go. I'm not convinced make ran successfully because it would exist otherwise. Other option is to checkout https://github.com/cockroachdb/cockroach-gen at github.com/cockroachdb/cockroach which already has all of the files pregenerated.

@dalanmiller
Copy link
Author

That was it! I was getting really variable output when running make and assumed nothing went wrong. Blew everything away and then properly ensured I had cmake installed made everything go away.

Now I'm getting different undefined errors in a couple files when attempting to target WASM:

$ GOOS=js GOARCH=wasm go build -o main.wasm
# github.com/cockroachdb/cockroach/pkg/util/sysutil
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil.go:51:23: undefined: syscall.SIGHUP
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:32:3: undefined: unix.Getuid
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:32:18: undefined: unix.Geteuid
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:32:34: undefined: unix.Getgid
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:32:49: undefined: unix.Getegid
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:38:9: undefined: unix.Statfs_t
../../cockroachdb/cockroach/pkg/util/sysutil/sysutil_unix.go:39:12: undefined: unix.Statfs
# github.com/cockroachdb/cockroach/vendor/github.com/lib/pq
../../cockroachdb/cockroach/vendor/github.com/lib/pq/conn.go:321:13: undefined: userCurrent

@maddyblue
Copy link
Owner

Ah yeah. WASM isn't going to work because cockroach uses some unix-only stuff that's only been added for windows. I think I fixed all of them once and the output was still like a 50MB wasm file which is way too huge for any browser or serverless platform to accept.

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