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: sudo gomobile init -ndk /Users/shang/Library/Android/sdk/ndk-bundle error #28406

Closed
helperShang opened this issue Oct 26, 2018 · 9 comments

Comments

Projects
None yet
4 participants
@helperShang
Copy link

commented Oct 26, 2018

sudo gomobile init -ndk /Users/shang/Library/Android/sdk/ndk-bundle
gomobile: go install -gcflags=-shared -ldflags=-shared -pkgdir=/Users/shang/go/pkg/gomobile/pkg_android_arm std failed: exit status 2
# runtime/cgo
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -llog
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'fprintf'
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'vfprintf'
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'fprintf'
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to '__android_log_vprint'
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'abort'
/tmp/go-build134805956/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to '__sF'
/tmp/go-build134805956/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_key_create'
/tmp/go-build134805956/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_setspecific'
/tmp/go-build134805956/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_setspecific'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'strerror'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'fprintf'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'abort'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to '__sF'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'pthread_create'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'pthread_detach'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'nanosleep'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_mutex_lock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_cond_wait'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_mutex_unlock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_mutex_lock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_cond_broadcast'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_mutex_unlock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_set_context_function: error: undefined reference to 'pthread_mutex_lock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function x_cgo_set_context_function: error: undefined reference to 'pthread_mutex_unlock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_get_context_function: error: undefined reference to 'pthread_mutex_lock'
/tmp/go-build134805956/b081/_x006.o:gcc_libinit.c:function _cgo_get_context_function: error: undefined reference to 'pthread_mutex_unlock'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_sigmask'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'memset'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_attr_init'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_attr_getstacksize'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_sigmask'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'strerror'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function sigfillset: error: undefined reference to '__errno'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function sigfillset: error: undefined reference to 'memset'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function threadentry: error: undefined reference to 'free'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_init'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_getstacksize'
/tmp/go-build134805956/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_destroy'
/tmp/go-build134805956/b081/_x008.o:gcc_setenv.c:function x_cgo_setenv: error: undefined reference to 'setenv'
/tmp/go-build134805956/b081/_x008.o:gcc_setenv.c:function x_cgo_unsetenv: error: undefined reference to 'unsetenv'
/tmp/go-build134805956/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'malloc'
/tmp/go-build134805956/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'fprintf'
/tmp/go-build134805956/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'abort'
/tmp/go-build134805956/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to '__sF'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@agnivade agnivade changed the title sudo gomobile init -ndk /Users/shang/Library/Android/sdk/ndk-bundle error x/mobile: sudo gomobile init -ndk /Users/shang/Library/Android/sdk/ndk-bundle error Oct 26, 2018

@gopherbot gopherbot added this to the Unreleased milestone Oct 26, 2018

@gopherbot gopherbot added the mobile label Oct 26, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Oct 26, 2018

Hi @helperShang - Kindly fill the complete issue template. Without that, it is very hard for us to debug the issue.

@helperShang

This comment has been minimized.

Copy link
Author

commented Oct 26, 2018

➜  ~ go version
go version go1.11.1 darwin/amd64
➜  ~ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/shang/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/shang/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
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/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build576755358=/tmp/go-build -gno-record-gcc-switches -fno-common"
@helperShang

This comment has been minimized.

Copy link
Author

commented Oct 26, 2018

   NDK 18.1.5063045 Installed
@helperShang

This comment has been minimized.

Copy link
Author

commented Oct 26, 2018

@agnivade any other need?

@helperShang

This comment has been minimized.

Copy link
Author

commented Oct 26, 2018

use -v

➜  ~ gomobile init -ndk /Users/shang/Library/Android/sdk/ndk-bundle -v            

# Installing golang.org/x/mobile/gl.

# Installing golang.org/x/mobile/app.

# Installing golang.org/x/mobile/exp/app/debug.

# Installing std for android/arm.
runtime/cgo
# runtime/cgo
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -llog
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/Users/shang/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'fprintf'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'vfprintf'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'fprintf'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to '__android_log_vprint'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to 'abort'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x003.o:gcc_android.c:function fatalf: error: undefined reference to '__sF'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_key_create'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_setspecific'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x004.o:gcc_android_arm.c:function inittls: error: undefined reference to 'pthread_setspecific'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'strerror'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'fprintf'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to 'abort'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_sys_thread_create: error: undefined reference to '__sF'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'pthread_create'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'pthread_detach'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_try_pthread_create: error: undefined reference to 'nanosleep'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_mutex_lock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_cond_wait'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_wait_runtime_init_done: error: undefined reference to 'pthread_mutex_unlock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_mutex_lock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_cond_broadcast'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_notify_runtime_init_done: error: undefined reference to 'pthread_mutex_unlock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_set_context_function: error: undefined reference to 'pthread_mutex_lock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function x_cgo_set_context_function: error: undefined reference to 'pthread_mutex_unlock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_get_context_function: error: undefined reference to 'pthread_mutex_lock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x006.o:gcc_libinit.c:function _cgo_get_context_function: error: undefined reference to 'pthread_mutex_unlock'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_sigmask'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'memset'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_attr_init'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_attr_getstacksize'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'pthread_sigmask'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function _cgo_sys_thread_start: error: undefined reference to 'strerror'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function sigfillset: error: undefined reference to '__errno'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function sigfillset: error: undefined reference to 'memset'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function threadentry: error: undefined reference to 'free'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_init'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_getstacksize'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x007.o:gcc_linux_arm.c:function x_cgo_init: error: undefined reference to 'pthread_attr_destroy'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x008.o:gcc_setenv.c:function x_cgo_setenv: error: undefined reference to 'setenv'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x008.o:gcc_setenv.c:function x_cgo_unsetenv: error: undefined reference to 'unsetenv'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'malloc'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'fprintf'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to 'abort'
/var/folders/ym/qdkvtyn16sx1b3b673hpp_0w0000gn/T/go-build479183972/b081/_x010.o:gcc_util.c:function x_cgo_thread_start: error: undefined reference to '__sF'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gomobile: go install -gcflags=-shared -ldflags=-shared -pkgdir=/Users/shang/go/pkg/gomobile/pkg_android_arm -v std failed: exit status 2
@agnivade

This comment has been minimized.

Copy link
Member

commented Oct 26, 2018

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2018

I can't reproduce the issue on my macOS 10.13. Do you have the latest version of the gomobile tool installed? Try to run go get -u golang.org/x/mobile/cmd/... before running gomobile init.

@helperShang

This comment has been minimized.

Copy link
Author

commented Oct 27, 2018

good ,ok ,thank you

go get -u golang.org/x/mobile/cmd/...
@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2018

Did it work? If so, please close this issue.

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.