keystone
keystone copied to clipboard
Go bindings static library issues (can't compile static go binary with static library)
Hi, when I use the shared library and compile my golang binary dynamically, everything seems to work but I can't say the same for when I try to build it statically (using the static library).
Build command:
$ go build -a -ldflags '-s -w -extldflags "-static"' main.go
Output is very big, I included it here: https://paste.ee/p/heO51
OS: tried on Centos 7, Debian 9 and MacOS High Sierra
kstool works fine by the way (either with shared or static library).
At this point I'm not sure if I'm dumb or if there is anything wrong, so I appreciate if anyone could shed some light here.
Thanks!
Hi guitmz,
I've got the same output when trying to compile go keystone binding sample and I think I've managed to find out what the issue is here:
- the C sample uses
KEYSTONE_LDFLAGS = -lkeystone -lstdc++ -lmin the Makefile - the keystone go binding has
// #cgo LDFLAGS: -lkeystonein the keystone-binding.go
I've managed to resolve the issue by executing: export CGO_LDFLAGS="-lkeystone -lstdc++ -lm"
@turekt super! I will test it as soon as possible, thanks a lot, it makes sense