Closed joeblew99 closed 6 years ago
I have not yet tried compiling on OS X, but it shouldn't be much different than Linux. I will try in the future to compile on Mac and post instructions on how to do so.
I tried to compile on OS X, but have an error:
MacBook-Pro-Yakud:pong yakud$ go build -v -buildmode=c-shared -o libgodot.so pong.go
github.com/shadowapex/godot-go/godot
# github.com/shadowapex/godot-go/godot
ld: unknown option: -unresolved-symbols=ignore-all
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What I'm doing wrong?
I try to remove -unresolved-symbols=ignore-all flag and have a that error: https://gist.github.com/Yakud/9da9e75f48ee5b6b4894b787fa55a3ed
I have a success instruction for a compile on Mac OS X. You should change line in file src/github.com/shadowapex/godot-go/godot/godot.go:
#cgo LDFLAGS: -Wl,-unresolved-symbols=ignore-all
To:
#cgo LDFLAGS: -Wl,-undefined,dynamic_lookup
ok, I'm can generate .so files by go build, but godot need a .dylib files for a run code. It is possible to build with go build? And may be I need set different CFLAGS or LDFLAGS in godot.go?
Ok, great. I have a successful for implement godot-go in gotod on os x:
My mistake is a build .go file with no main package. Now all works for me. You not need a compile .dylib file. Just use .so:
Hi @Yakud
Thanks for testing this out! I just committed the change that would allow you to build on Mac OS X. I have it set to the following so it will be correct for both Mac and Linux:
#cgo linux LDFLAGS: -Wl,-unresolved-symbols=ignore-all
#cgo darwin LDFLAGS: -Wl,-undefined,dynamic_lookup
@1l0 had actually submitted a pull request similar to this, but closed it before I could merge: https://github.com/ShadowApex/godot-go/pull/13/files
In regards to the .dylib
issue, you can actually just change the build command to this instead: go build -v -buildmode=c-shared -o libgodot.dylib example.go
Also, if you want to open a pull request to update the README with Mac instructions, I'd be happy to merge that in. Thanks!
I updated the README with Mac instructions and a tutorial on how to get started.
This looks very interesting.. golang and native script with godot is a pretty compelling solution.
Has anyone gotten an OSX make file ? Just trying to get going fast to try things out.