Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: bind to macOS with google.golang.org/grpc would cause "framework 'CoreAudioTypes' not found" #67006

Open
honmaple opened this issue Apr 24, 2024 · 0 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@honmaple
Copy link

honmaple commented Apr 24, 2024

Go version

go version go1.22.2 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/xxx/Library/Caches/go-build'
GOENV='/Users/xxx/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/xxx/repo/golang/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/xxx/repo/golang'
GOPRIVATE=''
GOPROXY='https://proxy.golang.com.cn,direct'
GOROOT='/usr/local/Cellar/go/1.22.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.22.2/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/xxx/git/maple-app/wengu/server/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/44/hnrgfyfn0fsb8lqwk_0h2jvm0000gn/T/go-build642643784=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

package server

import (
	"fmt"
)

type Service struct {
}

func (srv *Service) Start(path string) error {
	fmt.Println("start")
	return nil
}
MACOSX_DEPLOYMENT_TARGET=10.14 gomobile bind -target macos -o server.xcframework

And add Server.framework to macOS project

What did you see happen?

Everything is working well.

But If add google.golang.org/grpc

import (
	"fmt"
	_ "google.golang.org/grpc"
)

It raise some error

──╼ flutter run -d macOS
Launching lib/main.dart on macOS in debug mode...
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
Undefined symbols for architecture x86_64:
  "_res_9_nclose", referenced from:
      _runtime.text in Server[x86_64][2](go.o)
  "_res_9_ninit", referenced from:
      _runtime.text in Server[x86_64][2](go.o)
  "_res_9_nsearch", referenced from:
      _runtime.text in Server[x86_64][2](go.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **

Building macOS application...                                           
Error: Build process failed

I don't know why, but it did.

What did you expect to see?

gomobile bind to macOS without errors happed

Xcode version: 15.3

└──╼ go install golang.org/x/mobile/cmd/gomobile@latest
└──╼ md5sum /Users/xxx/repo/golang/bin/gomobile
c3ae3df39ca098658b55d7a3f7677d82  /Users/xxx/repo/golang/bin/gomobile
└──╼ gomobile version
gomobile version unknown: binary is out of date, re-install it
└──╼ go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240404231514-09dbf07665ed
└──╼ md5sum /Users/xxx/repo/golang/bin/gomobile
c3ae3df39ca098658b55d7a3f7677d82  /Users/xxx/repo/golang/bin/gomobile
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Apr 24, 2024
@gopherbot gopherbot added this to the Unreleased milestone Apr 24, 2024
@joedian joedian added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants