Repository: go
Issue: x/mobile: reverse binding testdata  build failed
Labels: NeedsInvestigation,mobile

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.21.0 darwin/amd64
</pre>

### Does this issue reproduce with the latest release?
yes


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/builder/Library/Caches/go-build'
GOENV='/Users/builder/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/builder/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/builder/go'
GOPRIVATE=''
GOPROXY='https://goproxy.io'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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/mn/7czq6y1x1v17_xhp8bbkgjj40000gn/T/go-build2139566021=/tmp/go-build -gno-record-gcc-switches -fno-common'
➜  android-33 go version
go version go1.21.0 darwin/amd64
➜  android-33 go env
GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/builder/Library/Caches/go-build'
GOENV='/Users/builder/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/builder/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/builder/go'
GOPRIVATE=''
GOPROXY='https://goproxy.io'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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/mn/7czq6y1x1v17_xhp8bbkgjj40000gn/T/go-build3360756410=/tmp/go-build -gno-record-gcc-switches -fno-common'
</pre></details>

### What did you do?

<details><summary><code>gomobile bind golang.org/x/mobile/bind/testdata/testpkg/javapkg</code> Output</summary><br><pre>
gomobile: go build -buildmode=c-shared -o=/var/folders/mn/7czq6y1x1v17_xhp8bbkgjj40000gn/T/gomobile-work-2014316781/android/src/main/jniLibs/arm64-v8a/libgojni.so ./gobind failed: exit status 1
gobind/classes_android.go:15:2: package Java is not in std (/usr/local/go/src/Java)
gobind/classes_android.go:25:8: package Java/java/beans/PropertyChangeEvent is not in std (/usr/local/go/src/Java/java/beans/PropertyChangeEvent)
gobind/classes_android.go:22:8: package Java/java/io/IOException is not in std (/usr/local/go/src/Java/java/io/IOException)
gobind/classes_android.go:21:8: package Java/java/io/InputStream is not in std (/usr/local/go/src/Java/java/io/InputStream)
gobind/classes_android.go:49:8: package Java/java/lang/CharSequence is not in std (/usr/local/go/src/Java/java/lang/CharSequence)
gobind/classes_android.go:27:8: package Java/java/lang/Character is not in std (/usr/local/go/src/Java/java/lang/Character)
gobind/classes_android.go:28:8: package Java/java/lang/Character/Subset is not in std (/usr/local/go/src/Java/java/lang/Character/Subset)
gobind/classes_android.go:36:8: package Java/java/lang/Float is not in std (/usr/local/go/src/Java/java/lang/Float)
gobind/classes_android.go:29:8: package Java/java/lang/Integer is not in std (/usr/local/go/src/Java/java/lang/Integer)
gobind/classes_android.go:19:8: package Java/java/lang/Object is not in std (/usr/local/go/src/Java/java/lang/Object)
gobind/classes_android.go:20:8: package Java/java/lang/Runnable is not in std (/usr/local/go/src/Java/java/lang/Runnable)
gobind/classes_android.go:35:8: package Java/java/lang/System is not in std (/usr/local/go/src/Java/java/lang/System)
gobind/classes_android.go:48:8: package Java/java/lang/Throwable is not in std (/usr/local/go/src/Java/java/lang/Throwable)
gobind/classes_android.go:32:8: package Java/java/net/Socket is not in std (/usr/local/go/src/Java/java/net/Socket)
gobind/classes_android.go:51:8: package Java/java/net/URL is not in std (/usr/local/go/src/Java/java/net/URL)
gobind/classes_android.go:34:8: package Java/java/nio/IntBuffer is not in std (/usr/local/go/src/Java/java/nio/IntBuffer)
gobind/classes_android.go:26:8: package Java/java/util/ArrayList is not in std (/usr/local/go/src/Java/java/util/ArrayList)
gobind/classes_android.go:30:8: package Java/java/util/BitSet is not in std (/usr/local/go/src/Java/java/util/BitSet)
gobind/classes_android.go:38:8: package Java/java/util/Collections is not in std (/usr/local/go/src/Java/java/util/Collections)
gobind/classes_android.go:50:8: package Java/java/util/List is not in std (/usr/local/go/src/Java/java/util/List)
gobind/classes_android.go:31:8: package Java/java/util/Random is not in std (/usr/local/go/src/Java/java/util/Random)
gobind/classes_android.go:23:8: package Java/java/util/concurrent/Future is not in std (/usr/local/go/src/Java/java/util/concurrent/Future)
gobind/classes_android.go:24:8: package Java/java/util/concurrent/TimeUnit is not in std (/usr/local/go/src/Java/java/util/concurrent/TimeUnit)
gobind/classes_android.go:37:8: package Java/java/util/jar/JarFile is not in std (/usr/local/go/src/Java/java/util/jar/JarFile)
gobind/classes_android.go:39:8: package Java/javapkg/GoArrayList is not in std (/usr/local/go/src/Java/javapkg/GoArrayList)
gobind/classes_android.go:40:8: package Java/javapkg/GoFuture is not in std (/usr/local/go/src/Java/javapkg/GoFuture)
gobind/classes_android.go:41:8: package Java/javapkg/GoInputStream is not in std (/usr/local/go/src/Java/javapkg/GoInputStream)
gobind/classes_android.go:42:8: package Java/javapkg/GoObject is not in std (/usr/local/go/src/Java/javapkg/GoObject)
gobind/classes_android.go:43:8: package Java/javapkg/GoPCE is not in std (/usr/local/go/src/Java/javapkg/GoPCE)
gobind/classes_android.go:44:8: package Java/javapkg/GoRand is not in std (/usr/local/go/src/Java/javapkg/GoRand)
gobind/classes_android.go:45:8: package Java/javapkg/GoRunnable is not in std (/usr/local/go/src/Java/javapkg/GoRunnable)
gobind/classes_android.go:46:8: package Java/javapkg/GoSubset is not in std (/usr/local/go/src/Java/javapkg/GoSubset)
gobind/classes_android.go:47:8: package Java/javapkg/NoargConstructor is not in std (/usr/local/go/src/Java/javapkg/NoargConstructor)
gobind/classes_android.go:33:8: package Java/javax/net/SocketFactory is not in std (/usr/local/go/src/Java/javax/net/SocketFactory)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:8:2: package Java/java/beans is not in std (/usr/local/go/src/Java/java/beans)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:9:2: package Java/java/io is not in std (/usr/local/go/src/Java/java/io)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:11:2: package Java/java/lang is not in std (/usr/local/go/src/Java/java/lang)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:16:2: package Java/java/net is not in std (/usr/local/go/src/Java/java/net)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:17:2: package Java/java/nio is not in std (/usr/local/go/src/Java/java/nio)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:18:2: package Java/java/util is not in std (/usr/local/go/src/Java/java/util)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:19:2: package Java/java/util/concurrent is not in std (/usr/local/go/src/Java/java/util/concurrent)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:20:2: package Java/javapkg is not in std (/usr/local/go/src/Java/javapkg)
/Users/builder/go/pkg/mod/golang.org/x/mobile@v0.0.0-20230531173138-3c911d8e3eda/bind/testdata/testpkg/javapkg/classes.go:21:2: package Java/javax/net is not in std (/usr/local/go/src/Java/javax/net)


</pre></details>


<details><summary><code>gomobile bind golang.org/x/mobile/bind/testdata/testpkg/objcpkg</code> Output</summary><br><pre>


  |   `-IntegerLiteral 0x7f82da2a1150 <col:103> 'int' 4608
  |-EnumConstantDecl 0x7f82da2a1220 <line:87:5, col:111> col:5 NSUserActivityConnectionUnavailableError 'int'
  | `-ConstantExpr 0x7f82da2a1200 <col:111> 'int'
  |   |-value: Int 4609
  |   `-IntegerLiteral 0x7f82da2a11e0 <col:111> 'int' 4609
  |-EnumConstantDecl 0x7f82da2a12b0 <line:88:5, col:115> col:5 NSUserActivityRemoteApplicationTimedOutError 'int'
  | `-ConstantExpr 0x7f82da2a1290 <col:115> 'int'
  |   |-value: Int 4610
  |   `-IntegerLiteral 0x7f82da2a1270 <col:115> 'int' 4610
  |-EnumConstantDecl 0x7f82da2a1340 <line:89:5, col:113> col:5 NSUserActivityHandoffUserInfoTooLargeError 'int'
  | `-ConstantExpr 0x7f82da2a1320 <col:113> 'int'
  |   |-value: Int 4611
  |   `-IntegerLiteral 0x7f82da2a1300 <col:113> 'int' 4611
  |-EnumConstantDecl 0x7f82da2a13d0 <line:91:5, col:97> col:5 NSUserActivityErrorMinimum 'int'
  | `-ConstantExpr 0x7f82da2a13b0 <col:97> 'int'
  |   |-value: Int 4608
  |   `-IntegerLiteral 0x7f82da2a1390 <col:97> 'int' 4608
  |-EnumConstantDecl 0x7f82da2a1460 <line:92:5, col:97> col:5 NSUserActivityErrorMaximum 'int'
  | `-ConstantExpr 0x7f82da2a1440 <col:97> 'int'
  |   |-value: Int 4863
  |   `-IntegerLiteral 0x7f82da2a1420 <col:97> 'int' 4863
  |-EnumConstantDecl 0x7f82da2a14f0 <line:94:5, col:94> col:5 NSCoderReadCorruptError 'int'
  | `-ConstantExpr 0x7f82da2a14d0 <col:94> 'int'
  |   |-value: Int 4864
  |   `-IntegerLiteral 0x7f82da2a14b0 <col:94> 'int' 4864
  |-EnumConstantDecl 0x7f82da2a1580 <line:95:5, col:96> col:5 NSCoderValueNotFoundError 'int'
  | `-ConstantExpr 0x7f82da2a1560 <col:96> 'int'
  |   |-value: Int 4865
  |   `-IntegerLiteral 0x7f82da2a1540 <col:96> 'int' 4865
  |-EnumConstantDecl 0x7f82da2a1610 <line:96:5, col:97> col:5 NSCoderInvalidValueError 'int'
  | `-ConstantExpr 0x7f82da2a15f0 <col:97> 'int'
  |   |-value: Int 4866
  |   `-IntegerLiteral 0x7f82da2a15d0 <col:97> 'int' 4866
  |-EnumConstantDecl 0x7f82da2a16a0 <line:97:5, col:90> col:5 NSCoderErrorMinimum 'int'
  | `-ConstantExpr 0x7f82da2a1680 <col:90> 'int'
  |   |-value: Int 4864
  |   `-IntegerLiteral 0x7f82da2a1660 <col:90> 'int' 4864
  |-EnumConstantDecl 0x7f82da2a1730 <line:98:5, col:90> col:5 NSCoderErrorMaximum 'int'
  | `-ConstantExpr 0x7f82da2a1710 <col:90> 'int'
  |   |-value: Int 4991
  |   `-IntegerLiteral 0x7f82da2a16f0 <col:90> 'int' 4991
  |-EnumConstantDecl 0x7f82da2a17c0 <line:100:5, col:91> col:5 NSBundleErrorMinimum 'int'
  | `-ConstantExpr 0x7f82da2a17a0 <col:91> 'int'
  |   |-value: Int 4992
  |   `-IntegerLiteral 0x7f82da2a1780 <col:91> 'int' 4992
  |-EnumConstantDecl 0x7f82da2a1850 <line:101:5, col:91> col:5 NSBundleErrorMaximum 'int'
  | `-ConstantExpr 0x7f82da2a1830 <col:91> 'int'
  |   |-value: Int 5119
  |   `-IntegerLiteral 0x7f82da2a1810 <col:91> 'int' 5119
  |-EnumConstantDecl 0x7f82da2a18e0 <line:103:5, col:110> col:5 NSBundleOnDemandResourceOutOfSpaceError 'int'
  | `-ConstantExpr 0x7f82da2a18c0 <col:110> 'int'
  |   |-value: Int 4992
  |   `-IntegerLiteral 0x7f82da2a18a0 <col:110> 'int' 4992
  |-EnumConstantDecl 0x7f82da2a1970 <line:104:5, col:119> col:5 NSBundleOnDemandResourceExceededMaximumSizeError 'int'
  | `-ConstantExpr 0x7f82da2a1950 <col:119> 'int'
  |   |-value: Int 4993
  |   `-IntegerLiteral 0x7f82da2a1930 <col:119> 'int' 4993
  |-EnumConstantDecl 0x7f82da2aaa00 <line:105:5, col:110> col:5 NSBundleOnDemandResourceInvalidTagError 'int'
  | `-ConstantExpr 0x7f82da2a19e0 <col:110> 'int'
  |   |-value: Int 4994
  |   `-IntegerLiteral 0x7f82da2a19c0 <col:110> 'int' 4994
  |-EnumConstantDecl 0x7f82da2aaa90 <line:107:5, col:112> col:5 NSCloudSharingNetworkFailureError 'int'
  | `-ConstantExpr 0x7f82da2aaa70 <col:112> 'int'
  |   |-value: Int 5120
  |   `-IntegerLiteral 0x7f82da2aaa50 <col:112> 'int' 5120
  |-EnumConstantDecl 0x7f82da2aab20 <line:108:5, col:111> col:5 NSCloudSharingQuotaExceededError 'int'
  | `-ConstantExpr 0x7f82da2aab00 <col:111> 'int'
  |   |-value: Int 5121
  |   `-IntegerLiteral 0x7f82da2aaae0 <col:111> 'int' 5121
  |-EnumConstantDecl 0x7f82da2aabb0 <line:109:5, col:117> col:5 NSCloudSharingTooManyParticipantsError 'int'
  | `-ConstantExpr 0x7f82da2aab90 <col:117> 'int'
  |   |-value: Int 5122
  |   `-IntegerLiteral 0x7f82da2aab70 <col:117> 'int' 5122
  |-EnumConstantDecl 0x7f82da2aac40 <line:110:5, col:106> col:5 NSCloudSharingConflictError 'int'
  | `-ConstantExpr 0x7f82da2aac20 <col:106> 'int'
  |   |-value: Int 5123
  |   `-IntegerLiteral 0x7f82da2aac00 <col:106> 'int' 5123
  |-EnumConstantDecl 0x7f82da2aacd0 <line:111:5, col:110> col:5 NSCloudSharingNoPermissionError 'int'
  | `-ConstantExpr 0x7f82da2aacb0 <col:110> 'int'
  |   |-value: Int 5124
  |   `-IntegerLiteral 0x7f82da2aac90 <col:110> 'int' 5124
  |-EnumConstantDecl 0x7f82da2aad60 <line:112:5, col:103> col:5 NSCloudSharingOtherError 'int'
  | `-ConstantExpr 0x7f82da2aad40 <col:103> 'int'
  |   |-value: Int 5375
  |   `-IntegerLiteral 0x7f82da2aad20 <col:103> 'int' 5375
  |-EnumConstantDecl 0x7f82da2aadf0 <line:114:5, col:105> col:5 NSCloudSharingErrorMinimum 'int'
  | `-ConstantExpr 0x7f82da2aadd0 <col:105> 'int'
  |   |-value: Int 5120
  |   `-IntegerLiteral 0x7f82da2aadb0 <col:105> 'int' 5120
  |-EnumConstantDecl 0x7f82da2aae80 <line:115:5, col:105> col:5 NSCloudSharingErrorMaximum 'int'
  | `-ConstantExpr 0x7f82da2aae60 <col:105> 'int'
  |   |-value: Int 5375
  |   `-IntegerLiteral 0x7f82da2aae40 <col:105> 'int' 5375
  |-EnumConstantDecl 0x7f82da2aaf10 <line:117:5, col:97> col:5 NSCompressionFailedError 'int'
  | `-ConstantExpr 0x7f82da2aaef0 <col:97> 'int'
  |   |-value: Int 5376
  |   `-IntegerLiteral 0x7f82da2aaed0 <col:97> 'int' 5376
  |-EnumConstantDecl 0x7f82da2aafa0 <line:118:5, col:99> col:5 NSDecompressionFailedError 'int'
  | `-ConstantExpr 0x7f82da2aaf80 <col:99> 'int'
  |   |-value: Int 5377
  |   `-IntegerLiteral 0x7f82da2aaf60 <col:99> 'int' 5377
  |-EnumConstantDecl 0x7f82da2ab030 <line:120:5, col:98> col:5 NSCompressionErrorMinimum 'int'
  | `-ConstantExpr 0x7f82da2ab010 <col:98> 'int'
  |   |-value: Int 5376
  |   `-IntegerLiteral 0x7f82da2aaff0 <col:98> 'int' 5376
  `-EnumConstantDecl 0x7f82da2ab0c0 <line:121:5, col:98> col:5 NSCompressionErrorMaximum 'int'
    `-ConstantExpr 0x7f82da2ab0a0 <col:98> 'int'
      |-value: Int 5503
      `-IntegerLiteral 0x7f82da2ab080 <col:98> 'int' 5503



</pre></details>

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->



### What did you expect to see?

build success


### What did you see instead?

android and ios both failed