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: stdlibc++ deprecation building issue: flags set but still shows error: clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7 [-Wdeprecated] #29969

Closed
imWildCat opened this issue Jan 29, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@imWildCat
Copy link

commented Jan 29, 2019

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

$ go version
go version go1.11.2 darwin/amd64

Other version info:

  • Xcode: Version 10.1 (10B61)
  • macOS: 10.14.2 (18C54)

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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/wildcat/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/wildcat/golang"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS="-stdlib=libc++"
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/4q/nqwtcbqx7kl9pp0dllbqx4qc0000gn/T/go-build198858859=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Background: I was trying to build a Go library (with C++ source) into objective-c bindings (as .framework).

$ export CGO_CPPFLAGS="-stdlib=libc++"
$ gomobile bind -target ios github.com/yanyiwu/gojieba
gomobile: darwin-arm: go build -tags ios -buildmode=c-archive -o /var/folders/4q/nqwtcbqx7kl9pp0dllbqx4qc0000gn/T/gomobile-work-251366135/gojieba-arm.a gobind failed: exit status 2
# github.com/yanyiwu/gojieba
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What did you expect to see?

The library can be built as an iOS framework.

What did you see instead?

The build failed due to libstdc++ is used even if I set export CGO_CPPFLAGS="-stdlib=libc++".

Without export CGO_CPPFLAGS="-stdlib=libc++", it shows:

$ export CGO_CPPFLAGS=""
$ gomobile bind -target ios github.com/yanyiwu/gojieba
gomobile: darwin-arm: go build -tags ios -buildmode=c-archive -o /var/folders/4q/nqwtcbqx7kl9pp0dllbqx4qc0000gn/T/gomobile-work-275429029/gojieba-arm.a gobind failed: exit status 2
# github.com/yanyiwu/gojieba
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from jieba.cpp:5:
In file included from ../../../../golang/src/github.com/yanyiwu/gojieba/deps/cppjieba/Jieba.hpp:4:
../../../../golang/src/github.com/yanyiwu/gojieba/deps/cppjieba/QuerySegment.hpp:4:10: fatal error: 'algorithm' file not found

@gopherbot gopherbot added this to the Unreleased milestone Jan 29, 2019

@gopherbot gopherbot added the mobile label Jan 29, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Mar 1, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Mar 1, 2019

Change https://golang.org/cl/164800 mentions this issue: cmd/gomobile: bump default iOS minimum version to 7.0

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2019

@imWildCat you can use the latest version of gomobile or the -iosversion flag to set a minimum iOS version >= 7.

@imWildCat

This comment has been minimized.

Copy link
Author

commented Mar 2, 2019

Thank you, @eliasnaur ! It works perfectly!

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.