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 producing iOS frameworks without PIE compatibility? #25124

Closed
matti777 opened this issue Apr 27, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@matti777
Copy link

commented Apr 27, 2018

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

go version go1.10.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/matti/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/matti/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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/jw/jrh0fgfn42ndjty5zpbsv8p00000gn/T/go-build759436971=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I built a Cocoapod using the gomobile bind -generated framework and when lint:ing it, it will get built for all platforms.

What did you expect to see?

Expected to see no linker errors.

What did you see instead?

I get the following warning:

- NOTE | [iOS] [FooBarSDK/Go] xcodebuild: ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in sync/atomic.(*Value).Store from /Users/matti/src/foobar-sdk-ios/Frameworks/Client.framework/Client(go.o). To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie

There was also a linker error about this, but I got around suppressing that. This however cannot be the final solution as Apple probably will not like the non-PIE binary - but then, it would appear the problem might only exist for arch=i386.

I wrote to SO about the issue: https://stackoverflow.com/questions/50024087/gomobile-bind-producing-library-with-pie-disabled-i386-arch/50038396#50038396

@gopherbot gopherbot added this to the Unreleased milestone Apr 27, 2018

@gopherbot gopherbot added the mobile label Apr 27, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Apr 27, 2018

(CC: @eliasnaur)

@bcmills

This comment has been minimized.

Copy link
Member

commented Apr 27, 2018

I built a Cocoapod using the gomobile bind -generated framework and when lint:ing it, it will get built for all platforms.

Please provide more specific steps to reproduce the problem: exact commands, and links to repos if possible. (Ideally, it should be possible for someone reading this bug to obtain the same error using your steps; otherwise, how will they know if a candidate fix actually works?)

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2018

Perhaps we should disable binding for 386. Can you reproduce the problem with gomobile bind -target=ios/arm,ios/arm64,ios/amd64 <pkg> ?

@gopherbot

This comment has been minimized.

Copy link

commented May 27, 2018

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this May 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.