What version of Go are you using (go version)?
$ go version
go version go1.17.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="**"
GOCACHE="**"
GOENV="**"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="**"
GONOPROXY="yes"
GONOSUMDB=""
GOOS="darwin"
GOPATH="**"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2 -std=c17"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2 -std=c++17"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fh/sxp5v53x66j5_p6_9rxtx6b80000gp/T/go-build2886836689=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
package my_cgo
//#cgo CFLAGS: -F /usr/local/my_framework/lib -framework MyFramework
//#cgo LDFLAGS: -F /usr/local/my_framework/lib -framework MyFramework
//
//#include <MyFramework/somefile.h>
import "C"
What did you expect to see?
Success
What did you see instead?
go build xxx/xxx/xxx: invalid flag in #cgo CFLAGS: -F
[Finished in 458ms with exit code 1]
The option -F is actually in clang
$ clang --help | grep '\-F'
-F <value> Add directory to framework include search path
$ clang++ --help | grep '\-F'
-F <value> Add directory to framework include search path
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)?go envOutputWhat did you do?
package my_cgo
//#cgo CFLAGS: -F /usr/local/my_framework/lib -framework MyFramework
//#cgo LDFLAGS: -F /usr/local/my_framework/lib -framework MyFramework
//
//#include <MyFramework/somefile.h>
import "C"
What did you expect to see?
Success
What did you see instead?
go build xxx/xxx/xxx: invalid flag in #cgo CFLAGS: -F
[Finished in 458ms with exit code 1]
The option
-Fis actually inclang