golang/go
cmd/go: go tool rejects #cgo LDFLAGS: -Wl,-rpath,@executable_path/../Frameworks
オープン
#40,559 opened on 2020/08/03
GoCommandNeedsInvestigationOS-Darwinhelp wanted
Repository metrics
- Stars
- (133,883 個のスター)
- PR merge metrics
- (30d に merged 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).