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: "runtime/cgo: chdir" error appears in debug log on startup on iOS #41156

Open
curyous opened this issue Sep 1, 2020 · 5 comments
Open
Labels
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

@curyous
Copy link

curyous commented Sep 1, 2020

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

1.15

Does this issue reproduce with the latest release?

Yes

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

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<username>/Library/Caches/go-build"
GOENV="/Users/<username>/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<username>/dev/gowksp/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/<username>/dev/gowksp"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<username>/dev/gowksp/src/github.com/curyous/adder/go.mod"
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/z8/x3j7np6x1cjbm_44396n2f680000gn/T/go-build960861663=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  • Made a tiny Go package with 1 function.
  • Built it into a framework using gomobile
  • Imported the framework and called the package within Swift code.
  • Debugged the app on on iPhone.

Here is an example project that produces the error:
https://github.com/curyous/gomobile-bug

What did you expect to see?

No problems logged on startup.

What did you see instead?

In debug log:

runtime/cgo: chdir(/private/var/containers/Bundle/Application/3CB0E6B1-721E-45F6-9C38-CA0EB8D971E6/GoMobile%20Bug.app) failed

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Sep 1, 2020
@gopherbot gopherbot added this to the Unreleased milestone Sep 1, 2020
@dmitshur dmitshur changed the title x/mobile: Error appears in debug log on startup on iOS. runtime/cgo: chdir x/mobile: "runtime/cgo: chdir" error appears in debug log on startup on iOS Sep 3, 2020
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 3, 2020
@dmitshur
Copy link
Contributor

dmitshur commented Sep 3, 2020

/cc @hyangah per owners.

@duyleekun
Copy link

This also happens with go1.14.5 on ios 14.1

@nathan-fiscaletti
Copy link
Contributor

It looks like the responsible piece of code can be found here:

if (chdir(dir) != 0) {

@zzzlazy
Copy link

zzzlazy commented Apr 14, 2021

Deleting the spaces in "Product Name" in "Build Settings" worked for me

@Toyking10
Copy link

Deleting the spaces in "Product Name" in "Build Settings" worked for me

This fixed it for me too. For anyone seeing this, make your project name have no spaces. You can make the display app name that people actually see have spaces later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

7 participants