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

Problems trying to build on Mac OSX 10.14 #727

Open
rusty-udemy opened this issue Apr 12, 2019 · 6 comments
Open

Problems trying to build on Mac OSX 10.14 #727

rusty-udemy opened this issue Apr 12, 2019 · 6 comments

Comments

@rusty-udemy
Copy link

I need the patch from #711, so I tried to build from head. However, I had several problems. I am still picking up go, so some of these could be just misunderstandings. I can open separate issues for each if they are actually problems, but wanted to see if I was doing something wrong.

@shlomi-noach
Copy link
Contributor

this is expected in the Go world

It is indeed, unfortunately. It is only being solved in very recent go versions.

However, if you build via ./script/cibuild this should be automatically sorted out.

The build scripts assume fpm is installed; again, undocumented, I had to find it via ruby

The above build does not require fpm, either.

Go 1.9 is incompatible with Mac OSX 10.14 (see golang/go#25908 )

Thank you. Yes, we need to upgrade to > 1.9

I got build constraints exclude all go files when cross-compiling the linux binaries due to go-mysql-org/go-mysql#347

Correct. This is the result of our recent update to the latest go-mysql library. Again, script/cibuild should solve that. Though, as it is it explicitly requires go1.9 at this time, which needs to change.

@rusty-udemy
Copy link
Author

rusty-udemy commented Apr 14, 2019

Would it be OK then to update the main README.md to direct people to ./script/cibuild instead of ./build.sh and delete ./build? I can open a PR with that, and another PR to update the requirements to the latest version of Go. Would you like separate issues for each of those?

@shlomi-noach
Copy link
Contributor

@rusty-udemy thank you! Yes and yes. One thing to note about upgrading to go 1.11 or 1.12 is that go fmt output has changed. One of the CI tests is to validate that code is formatted with go fmt so tests are expected to fail just for the upgrade reason.

Let's please do that in two PRs as the go version one is something I need to put to testing.

@zmoazeni
Copy link
Contributor

I got build constraints exclude all go files when cross-compiling the linux binaries due to go-mysql-org/go-mysql#347

Correct. This is the result of our recent update to the latest go-mysql library. Again, script/cibuild should solve that. Though, as it is it explicitly requires go1.9 at this time, which needs to change.

Do you know what the meat of this issue is? Does #736 change the scenario at all?

@shlomi-noach
Copy link
Contributor

@zmoazeni #736 is unrelated. The meat is import "C" in

Building linux from macos, or vice versa, fails:

gh-ost$ export CGO_ENABLED=1
gh-ost$ ./build.sh
Building macOS binary
Building GNU/Linux binary
# command-line-arguments
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/m2/jxhw5r550fbcj96cg_9j8xx40000gn/T/go-link-182793913/go.o, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /var/folders/m2/jxhw5r550fbcj96cg_9j8xx40000gn/T/go-link-182793913/go.o
Undefined symbols for architecture x86_64:
  "__cgo_topofstack", referenced from:
      __cgo_f7895c2c5a3a_C2func_getnameinfo in 000002.o
      __cgo_f7895c2c5a3a_Cfunc_getnameinfo in 000002.o
      __cgo_f7895c2c5a3a_C2func_getaddrinfo in 000004.o
      __cgo_f7895c2c5a3a_Cfunc_gai_strerror in 000004.o
      __cgo_f7895c2c5a3a_Cfunc_getaddrinfo in 000004.o
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Build failed for GNU/Linux

@zmoazeni
Copy link
Contributor

Ahh thanks. I didn't see that error before. export CGO_ENABLED=1 must have been the secret sauce.

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

3 participants