cgosymbolizer
cgosymbolizer copied to clipboard
Undefined _cgoTraceback in MacOS
Trying to build this (imported by some other package) on MacOS 11.2 Beta, with Xcode 12.3 / Apple clang version 12.0.0 (clang-1200.0.32.28), go version go1.15.5 darwin/amd64
I am getting:
# github.com/ianlancetaylor/cgosymbolizer
Undefined symbols for architecture x86_64:
"_cgoTraceback", referenced from:
__cgohack_cgoTraceback in _cgo_main.o
(maybe you meant: __cgohack_cgoTraceback)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am not sure of where "cgohack" is coming from (I am assuming the missing symbol is the one defined in traceback.c).
The package is only tested on GNU/Linux. You could try removing the +build linux
line from traceback.c. I don't know whether it will work on Darwin or not. I've never tried it.
Removing +build linux
(or adding +build darwin
) does solve the undefined. Not sure if it works, but it allows me to build the original package. Thanks!
Adding +build linux darwin
solves the linker problem but does not seem to resolve the symbol (function name), file, or line where a crash occurs.
My guess is that the build links to Apple's unwind.h, which perhaps doesn't function the same way. But maybe it will work if linked against a Mac build of LLVM's libunwind.
https://github.com/benesch/cgosymbolizer includes an implementation that mostly works on Mac OS X.