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

Open
hajimehoshi opened this issue Jan 21, 2020 · 3 comments
Open

Comments

@hajimehoshi
Copy link
Contributor

@hajimehoshi hajimehoshi commented Jan 21, 2020

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 label Jan 21, 2020
@hyangah

This comment has been minimized.

Copy link
Contributor

@hyangah 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

This comment has been minimized.

Copy link
Contributor Author

@hajimehoshi hajimehoshi commented Jan 24, 2020

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

This comment has been minimized.

Copy link
Contributor

@hyangah 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.