Why is @ needed? OS X does not use $ORIGIN in its rpath for indicating that binaries should look in the binary's directory for their shared libraries; instead, it uses the special name @executable_path. There area number of these special names provided by Apple's loader (and more in other links I can't find right now).
I don't know what the consequences of adding @ to the list of safe cgo runes would be, or why @ was omitted, so I am submitting a bug instead of a patch.
After this fix, Go packages that use -rpath @executable_path in its #cgo LDFLAGS line should be able to build. Furthemore, TestCgoHandlesWlORIGIN in src/cmd/go/go_test.go could also be adjusted to work on OS X as well.
I am running
go version devel +49065cb Fri Sep 18 18:09:15 2015 +0000 linux/amd64
but manually confirmed the issue will still happen on master. Here is an issue where someone else runs into it in my code using stable go1.5.2.
The text was updated successfully, but these errors were encountered: