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/cmd/gomobile: gomobile build fails for iOS targets with Go 1.14 #36665

Closed
hajimehoshi opened this issue Jan 21, 2020 · 6 comments
Closed
Labels
FrozenDueToAge 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

@hajimehoshi
Copy link
Member

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

$ go1.14beta1 version
go version go1.14beta1 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
$ go1.14beta1 env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOENV="/Users/hajimehoshi/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/hajimehoshi/sdk/go1.14beta1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/hajimehoshi/sdk/go1.14beta1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ht/ky_bwgzs4bd5z1hh02k34x_h0000gn/T/go-build919849864=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to use gomobile-build for iOS with Go 1.14 (beta1).

See https://go-review.googlesource.com/c/mobile/+/214957

What did you expect to see?

Building succeeded.

What did you see instead?

$ go1.14beta1 test ./cmd/gomobile/
--- FAIL: TestBuildWithGoModules (12.86s)
    --- FAIL: TestBuildWithGoModules/ios (8.03s)
        --- FAIL: TestBuildWithGoModules/ios/Absolute_Path (4.16s)
            build_test.go:261: gomobile build failed: exit status 1
                /var/folders/ht/ky_bwgzs4bd5z1hh02k34x_h0000gn/T/gomobile-test856059692/gomobile: golang.org/x/mobile/example/basic does not import "golang.org/x/mobile/app"
        --- FAIL: TestBuildWithGoModules/ios/Relative_Path (3.80s)
            build_test.go:261: gomobile build failed: exit status 1
                /var/folders/ht/ky_bwgzs4bd5z1hh02k34x_h0000gn/T/gomobile-test856059692/gomobile: golang.org/x/mobile/example/basic does not import "golang.org/x/mobile/app"
FAIL
FAIL    golang.org/x/mobile/cmd/gomobile        78.062s
FAIL

The symbol analyzing depends on as command. I think we should replace it with go/packages or something instead.

CC @hyangah @eliasnaur

@gopherbot gopherbot added this to the Unreleased milestone Jan 21, 2020
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jan 21, 2020
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 21, 2020
@hyangah
Copy link
Contributor

hyangah commented Jan 23, 2020

Sorry that I couldn't follow up - my mac was completely busted at this moment.
The error message does not make sense at all - is it possible to add more logging in the gomobile build invocation (-x -v first and whatever env vars necessary) to see what's going on? Also, not sure which version of go is being picked up by the gomobile build when it's invoked by go1.14beta1 test.

@hajimehoshi
Copy link
Member Author

As I commented at https://go-review.googlesource.com/c/mobile/+/214957/2#message-aa227544df399d0338b67b6718f00754497c6d33, the use of 'nm' command is suspicious. I thought the binary format was changed as of Go 1.14 (@eliasnaur, is that correct?). To check the import, could we use go-list or go/packages instead?

@hyangah
Copy link
Contributor

hyangah commented Jan 24, 2020

there is a mention of changes in symbol name in the release note, but not sure if that's relevant. I couldn't reproduce the problem and nmpkgs includes the app package in my case. maybe I am calling a wrong go command? What's in the nmpkgs map in your run? (print out or debug)

The use of nm predates the powerful go list and the intention was to check the package is imported, so in theory it's ok to replace it with go list or go/packages. But, I fear if this missing symbol is a symptom of another issue. If you build the basic app (by bypassing this failed nm check), can you still see the app working?

@dmitshur
Copy link
Contributor

Go 1.14 is not supported by now. Does this issue apply to newer Go versions too? If it's just 1.14, we can close it, otherwise update it accordingly.

@dmitshur dmitshur added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 28, 2021
@hajimehoshi
Copy link
Member Author

I think so. I'll test this later.

@hajimehoshi
Copy link
Member Author

Oh, apparently this issue doesn't happen with Go 1.16 and newer. Let me close this.

@hajimehoshi hajimehoshi removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 1, 2021
@golang golang locked and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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