golang/go

x/mobile: target maccatalyst cannot find OpenGLES header

Open

#70,664 opened on Dec 3, 2024

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationhelp wantedmobile

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Go version

go version go1.23.3 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/brien/Library/Caches/go-build'
GOENV='/Users/brien/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/brien/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/brien/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/brien/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/brien/bringyour/sdk/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r3/v_3z60rx2cxg0s1r9tl9fbmw0000gn/T/go-build1634776604=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Create a xcframework using the following gomobile bind command:

gomobile bind \
	-ldflags "-X client.Version=$WARP_VERSION" \
	-target ios,iossimulator,macos,maccatalyst -iosversion 16.0 \
	-bundleid com.bringyour \
	-trimpath \
	-gcflags "-dwarf=true" \
	-ldflags "-X client.Version=$WARP_VERSION -compressdwarf=false -B gobuildid" \
	-o "build/$BUILD_DIR/URnetworkSdk.xcframework" \
	github.com/urnetwork/sdk;

The command ends with an error:

gomobile: maccatalyst/amd64: go build -gcflags -dwarf=true -ldflags -X client.Version=2024.12.3-outerwerld -compressdwarf=false -B gobuildid -trimpath -buildmode=c-archive -o /var/folders/r3/v_3z60rx2cxg0s1r9tl9fbmw0000gn/T/gomobile-work-3462168386/URnetworkSdk-maccatalyst-amd64.a ./gobind failed: exit status 1
# golang.org/x/mobile/gl
In file included from /Users/brien/go/pkg/mod/golang.org/x/mobile@v0.0.0-20241108191957-fa514ef75a0f/gl/work.go:25:
./work.h:18:10: fatal error: 'OpenGLES/ES2/glext.h' file not found
   18 | #include <OpenGLES/ES2/glext.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

What did you see happen?

go build cannot find header file.

In file included from /Users/brien/go/pkg/mod/golang.org/x/mobile@v0.0.0-20241108191957-fa514ef75a0f/gl/work.go:25:
./work.h:18:10: fatal error: 'OpenGLES/ES2/glext.h' file not found
   18 | #include <OpenGLES/ES2/glext.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

What did you expect to see?

The maccatalyst libraries should be included in the built xcframework without error.

Contributor guide