x/mobile: gomobile bind producing iOS frameworks without PIE compatibility? #25124
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.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
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
The text was updated successfully, but these errors were encountered: