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: gomobile bind slow compilation #54770

Open
NightBlaze opened this issue Aug 30, 2022 · 5 comments
Open

x/mobile: gomobile bind slow compilation #54770

NightBlaze opened this issue Aug 30, 2022 · 5 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

@NightBlaze
Copy link

NightBlaze commented Aug 30, 2022

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

$ go version go1.19 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="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/user/go/pkg/mod"
GONOPROXY="gitlab.mycompany.com"
GONOSUMDB="gitlab.mycompany.com"
GOOS="darwin"
GOPATH="/Users/user/go"
GOPRIVATE="gitlab.mycompany.com"
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.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7v/1f7g4jw1337ggmqlxxgq74g00000gn/T/go-build1457147379=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

time gomobile bind -target=ios golang.org/x/mobile/example/bind/hello
30,61s user 16,19s system 118% cpu 39,495 total

What did you expect to see?

Faster compilation

What did you see instead?

30 s compilation time on default empty project. Working project compiles 2,5 minutes

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Aug 30, 2022
@gopherbot gopherbot added this to the Unreleased milestone Aug 30, 2022
@changkun
Copy link
Member

changkun commented Aug 30, 2022

It might be possible that the slow compilation is caused by cgo.

Have you tried rebuilding the project? What's the compilation time?

@heschi heschi added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 30, 2022
@heschi
Copy link
Contributor

heschi commented Aug 30, 2022

cc @hyangah

@NightBlaze
Copy link
Author

NightBlaze commented Sep 2, 2022

@changkun The time is the same for every compilation. It seems that cgo doesn't use any cache and rebuild everything every time.

The same issue (long time compilation of gomobile bind) have all my team members.

@changkun
Copy link
Member

changkun commented Sep 2, 2022

I think https://go-review.googlesource.com/c/mobile/+/426274 is currently speeding up the compilation process. Can this patch mitigate this issue?

@hajimehoshi
Copy link
Member

hajimehoshi commented Sep 28, 2022

I'll work on the same thing for iOS in another CL.

@changkun changkun removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 28, 2022
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

5 participants