Skip to content

cmd/go/internal/work/security.go: invalid flag in #cgo LDFLAGS: -Wl,-rpath,. #70924

@t0rr3sp3dr0

Description

@t0rr3sp3dr0

Go version

go version go1.23.3 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/pedro/Library/Caches/go-build'
GOENV='/Users/pedro/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/pedro/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/pedro/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/pedro/sdk/go1.23.3'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/pedro/sdk/go1.23.3/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/pedro/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/pedro/Documents/git/sapsigner/impl/emu/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/_3/sh8y1_5d07q_5xhk9k8mncs80000gn/T/go-build4238436678=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Run go build main.go in macOS with the following program.


  • main.go
package main

// #cgo LDFLAGS: -Wl,-rpath,.
import "C"

func main() {}

### What did you see happen?

```console
% go build -v main.go
command-line-arguments
command-line-arguments: invalid flag in #cgo LDFLAGS: -Wl,-rpath,.

What did you expect to see?

% go build -v main.go
command-line-arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions