gomobile init.

393 views
Skip to first unread message

mikets...@gmail.com

unread,
Aug 27, 2015, 7:23:57 PM8/27/15
to golang-nuts
Hello Goers
Anytime I run "gomobile init" I get:

gomobile: go install -p=4 -pkgdir=/home/mike/Devel/work/go/pkg/gomobile/pkg_android_arm std failed: exit status 2
# runtime/cgo
In file included from /home/mike/Devel/work/go/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/errno.h:31:0,
                 from /usr/local/go/src/runtime/cgo/cgo.go:52:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:41:20: error: missing binary operator before token "("
 # if __GNUC_PREREQ (4, 6) && !defined _LIBC
                    ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:54:44: error: missing binary operator before token "("
 # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
                                            ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:59:44: error: missing binary operator before token "("
 #  if defined __cplusplus && __GNUC_PREREQ (2,8)
                                            ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:136:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (4,3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:149:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,97)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:211:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,96)
                   ^
......

Please let me know what I am doing wrong!
I tried it on two laptops, in Linux Mint, and Windows and I get the same result.

Thank you.
Mike.

Nigel Tao

unread,
Aug 31, 2015, 9:02:57 PM8/31/15
to mikets...@gmail.com, David Crawshaw, Hyang-Ah Hana Kim, golang-nuts
crawshaw, hana, any ideas?

David Crawshaw

unread,
Sep 1, 2015, 8:58:59 AM9/1/15
to Nigel Tao, mikets...@gmail.com, Hyang-Ah Hana Kim, golang-nuts
I have not had any luck replicating this. Could you provide some
details about your environment? Perhaps uname -a, go version, and
Go-related environment variables from env?

mikets...@gmail.com

unread,
Sep 1, 2015, 10:34:39 PM9/1/15
to golang-nuts, nige...@golang.org, mikets...@gmail.com, hya...@gmail.com


On Tuesday, September 1, 2015 at 10:28:59 PM UTC+9:30, David Crawshaw wrote:
I have not had any luck replicating this. Could you provide some
details about your environment? Perhaps uname -a, go version, and
Go-related environment variables from env?

 
 uname -a Linux aegean 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

go version devel +d497eeb Thu Aug 27 00:28:35 2015 +0000 linux/amd64

go env GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mike/Devel/work/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

I am running Linux Mint in two Asus laptops and I get the same result:

mike@aegean ~/Desktop $ gomobile init

gomobile: go install -p=4 -pkgdir=/home/mike/Devel/work/go/pkg/gomobile/pkg_android_arm std failed: exit status 2
# runtime/cgo
In file included from /home/mike/Devel/work/go/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/errno.h:31:0,
                 from /usr/local/go/src/runtime/cgo/cgo.go:52:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:41:20: error: missing binary operator before token "("
 # if __GNUC_PREREQ (4, 6) && !defined _LIBC
                    ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:54:44: error: missing binary operator before token "("
 # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
                                            ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:59:44: error: missing binary operator before token "("
 #  if defined __cplusplus && __GNUC_PREREQ (2,8)
                                            ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:136:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (4,3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:149:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,97)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:211:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,96)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:219:19: error: missing binary operator before token "("

 #if __GNUC_PREREQ (4, 3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:229:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,96)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:236:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,5)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:245:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,1)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:254:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,2)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:266:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,8)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:276:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (2,97)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:285:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:293:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,4)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:307:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,2)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:315:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (4,3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:341:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (4,3)
                   ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:350:20: error: missing binary operator before token "("
 #if !__GNUC_PREREQ (2,8)
                    ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:355:20: error: missing binary operator before token "("
 #if !__GNUC_PREREQ (2,92)
                    ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:362:19: error: missing binary operator before token "("
 #if __GNUC_PREREQ (3,1) && !defined __GNUG__
                   ^
In file included from /home/mike/Devel/work/go/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/string.h:33:0,
                 from /usr/local/go/src/runtime/cgo/cgo.go:53:
/home/mike/Devel/work/go/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/malloc.h:30:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
 extern __mallocfunc void*  malloc(size_t);
                     ^
/home/mike/Devel/work/go/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/malloc.h:31:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
 extern __mallocfunc void*  calloc(size_t, size_t);

That is the complete list of errors

Thank you for trying.

Mike
                     ^



Hyang-Ah Hana Kim

unread,
Sep 1, 2015, 11:04:30 PM9/1/15
to mikets...@gmail.com, golang-nuts, Nigel Tao
It seems /usr/include/x86_64-linux-gnu/sys/cdefs.h was picked instead of 
 $GOPATH/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/sys/cdefs.h.
Do you use any env variables that may affect gcc's include file search path?

  
--
__

mikets...@gmail.com

unread,
Sep 1, 2015, 11:41:05 PM9/1/15
to golang-nuts, mikets...@gmail.com, nige...@golang.org


On Wednesday, September 2, 2015 at 12:34:30 PM UTC+9:30, Hyang-Ah Hana Kim wrote:
It seems /usr/include/x86_64-linux-gnu/sys/cdefs.h was picked instead of 
 $GOPATH/pkg/gomobile/android-ndk-r10e/arm/sysroot/usr/include/sys/cdefs.h.
Do you use any env variables that may affect gcc's include file search path?

YES.. /usr/include/x86_64-linux-gnu  was in my profile.
Now everything is perfectly o.k.
I should have known better. Thank you and thanks the Go team for helping me.

Mike.
Reply all
Reply to author
Forward
0 new messages