golang/go
cmd/go: go tool rejects #cgo LDFLAGS: -Wl,-rpath,@executable_path/../Frameworks
开放
#40,559 创建于 2020年8月3日
GoCommandNeedsInvestigationOS-Darwinhelp wanted
仓库指标
- 星标
- (133,883 个星标)
- PR 合并指标
- (30 天内没有已合并 PR)
描述
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
What did you do?
I tried to build a MacOS bundle using dynamically linked libraries. As per convention these are stored in MyApp.app/Contents/Frameworks which requires LC_RPATH to point there.
I added the following flag:
#cgo LDFLAGS: -Wl,-rpath,@executable_path/../Frameworks
What did you expect to see?
go build builds binary with LC_RPATH set to @executable_path/../Frameworks
What did you see instead?
I got an invalid flag error upon running go build.
I also tried replacing @executable_path for $ORIGIN as I would in Linux but then I got an image not found error when running the resulting binary (I assume this isn't supported on MacOS).