golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124k stars 17.67k forks source link

x/mobile: clang: error: invalid version number in '-target arm64-apple-ios13.0-macabi' #54727

Open smartgolang opened 2 years ago

smartgolang commented 2 years ago

What version of Go are you using (go version)?

$ go version
go version go1.19 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Mac OS Monterey 12.4

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/<...>/Library/Caches/go-build"
GOENV="/Users/<...>/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<...>/go-mdb-projects/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/<...>/go-mdb-projects"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="0"
GOMOD="/Users/<...>/<...>/<...>/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w6/mmjtf28933l2_pkfr203rdwr0000gn/T/go-build2964995692=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

gomobile bind -target=ios,iossimulator,macos,maccatalyst -o My.xcframework .

What did you expect to see?

a library for Mac Catalyst

What did you see instead?

runtime/cgo

clang: error: invalid version number in '-target arm64-apple-ios13.0-macabi'

heschi commented 2 years ago

cc @hyangah

joshbuddy commented 2 years ago

@smartgolang I believe this needs to be run with -iosversion=14 at a minimum

David699 commented 2 years ago

run this ok: gomobile bind -v -a -target=ios,iossimulator,maccatalyst,macos -iosversion=15

constantinevassil commented 2 years ago

I tried again with your suggestion but now I get the following cgo: C compiler "2022-09-19" not found: exec: "2022-09-19": executable file not found in $PATH

rakuyoMo commented 1 year ago

If I use only CGO, not go-mobile, I also encounter this problem in the title. Does anyone know how to fix it please?

use -target x86_64-apple-ios14.0-macabi