My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 39482: Enable Go support in the NDK toolchain
438 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  to...@android.com
Cc:  di...@android.com, andrewhs...@google.com

Restricted
  • Only users with Commit permission may comment.


Sign in to add a comment
 
Reported by paulo.jp...@gmail.com, Nov 10, 2012
Gccgo has been integrated into the GCC with the 4.6.0 release.

Since NDK revision 8b, it is now possible to make use of GCC 4.6 toolchain as the default C and C++ compiler toolchain for NDK based activities.

Having Go enabled in the standard NDK toolchain, will allow for development of NDK based activities with a safer native language, thus increasing the security level of the pure native based activities.

Additionally it has the benefit to increase Google's visibility in the language support.


Nov 10, 2012
#1 humh...@gmail.com
支持一下
Nov 10, 2012
#2 zhuang...@gmail.com
really want golang work at my galaxy nexus
Nov 10, 2012
#3 dcy.deng...@gmail.com
……
Nov 10, 2012
#4 Masterl...@gmail.com
really want golang work at my galaxy nexus
Nov 10, 2012
#5 whybenlee
cool! support!
Nov 10, 2012
#6 xeo...@gmail.com
cool
Nov 10, 2012
#7 iWinux
good idea!!
Nov 10, 2012
#8 chou.mar...@gmail.com
exactly! 
Nov 10, 2012
#9 yangweij...@gmail.com
very good, a bravy try
Nov 10, 2012
#10 xming.song@gmail.com
nice
Nov 10, 2012
#11 zhangchu...@gmail.com
great!
Nov 10, 2012
#12 cfmon...@gmail.com
顶!
Nov 10, 2012
#13 titrpp@gmail.com
Good idea!
Nov 10, 2012
#14 realh3@gmail.com
good
Nov 10, 2012
#15 jianfeng...@gmail.com
great
Nov 10, 2012
#16 griffin...@gmail.com
Seriously you guys... this is a bug tracker, not weibo.
Nov 10, 2012
#17 stephenh...@gmail.com
Android needs Go.
Nov 10, 2012
#20 oling...@gmail.com
支持~!Will Go add into the SDK?
Nov 10, 2012
#21 aminic.n...@gmail.com
need golang support andriod dev
Nov 10, 2012
#23 tion...@gmail.com
Good idea!!!
Nov 10, 2012
#24 yueyidi...@gmail.com
good
Nov 10, 2012
#25 yangliu9...@gmail.com
cool
Nov 10, 2012
#26 zx9597...@gmail.com
yes, please
Nov 10, 2012
#27 fantasy...@gmail.com
留名支持
Nov 10, 2012
#28 ruiyun....@gmail.com
凑热闹,打酱油,顺便支持。
Nov 10, 2012
#29 luisfurq...@gmail.com
If I could develop in Go for Android, I would start developing for Android. Please support it! Thank you!
Nov 10, 2012
#30 Roy.T.Bu...@gmail.com
cool
Nov 10, 2012
#31 sutay...@gmail.com
对自己的孩子重视一些吧,Google!这是一个好机会!
Nov 10, 2012
#32 stephen....@gmail.com
Go support for android would be VERY nice. I for one think this is a great idea and the android team should focus some efforts towards this.
Nov 10, 2012
#33 banxi1...@gmail.com
来自西一里网络科技。Go 好样的。
Come form XiYiLi Network Tech Ltd. Go come on!
Nov 11, 2012
#34 joe...@gmail.com
泪流满面顶楼主.
Nov 11, 2012
#35 518...@gmail.com
yes, please
Nov 11, 2012
#36 carensy...@gmail.com
Goooooooood!
Nov 11, 2012
#37 googolmo
it's cool
Nov 11, 2012
#38 g.magicool
really want golang work at my nexus s
Nov 11, 2012
#39 zhenbe...@gmail.com
Gooooooooooooood!
Nov 11, 2012
#40 m...@ungerik.net
want!!!
Nov 11, 2012
#41 gzchow...@gmail.com
good
Nov 11, 2012
#42 fred.gr...@gmail.com
Yes by all means..I wan to play with GO on andorid
Nov 11, 2012
#43 youri...@gmail.com
cool!
Nov 11, 2012
#44 tangyuc...@gmail.com
Great Choice!!!
Nov 11, 2012
#45 iamk...@gmail.com
cool

Nov 11, 2012
#46 zorrohun...@gmail.com
cool!
Nov 11, 2012
#47 polangha...@gmail.com
really want golang work at my galaxy nexus
Nov 11, 2012
#48 danyang.yi@beijingdynasty.com
That's Great~~~
Nov 11, 2012
#49 styl...@gmail.com
It's a cool idea!
Nov 11, 2012
#50 WDan1...@gmail.com
upvote
Nov 11, 2012
#51 leejun...@gmail.com
It's a Great idea! 
Nov 11, 2012
#52 wansonw...@gmail.com
expect it
Nov 11, 2012
#53 chaishus...@gmail.com
good
Nov 11, 2012
#54 shen0915...@gmail.com
expert it.
Nov 11, 2012
#55 ghi...@gmail.com
it is must!!
Nov 11, 2012
#56 jamesqi...@gmail.com
we really need a better language than Java to develop Android app
Nov 11, 2012
#57 ccx1...@gmail.com
super
Nov 11, 2012
#58 geyua...@gmail.com
Nice +1
Nov 11, 2012
#59 ldshuang@gmail.com
good 
Nov 12, 2012
#60 ljie...@gmail.com
Things should be like this!
Nov 12, 2012
#62 edse...@gmail.com
Would die for it =)
Nov 12, 2012
#63 jasm...@gmail.com
this would be fantastic
Nov 12, 2012
#64 ShangZha...@gmail.com
Guys stop commenting in an issue report please 
Nov 12, 2012
#65 chenjiee...@gmail.com
强烈支持!
Nov 12, 2012
#66 apaye....@gmail.com
android原生支持go趋势啊
Nov 12, 2012
#67 kangzj...@gmail.com
sounds fantastic
Nov 13, 2012
#68 creami...@gmail.com
Support
Nov 13, 2012
#69 rjmpmin...@gmail.com
Would be great!
Nov 13, 2012
#70 gongshen...@gmail.com
if go-lang is available for android, google surely will get big benefits from smart phone market of China :) 
Nov 13, 2012
#71 biergaiz...@gmail.com
Someone putted the URL of this bug report on Weibo (Chinese Micro Blog), then, this report became a Tweeter message...
Nov 14, 2012
#72 trba...@gmail.com
This would be useful
Nov 15, 2012
#73 ling...@carnival.com
Supported
Nov 15, 2012
Project Member #74 di...@android.com
Guys, if you want this feature, *star* the issue, i.e. don't add a "me too" / "would be great" message here, this makes reading it harder.

Apart from that, the current situation is that the Go compilers only generate static executables right now. Which means:

- Any such ARM binary will run on Android (or other Linux/ARM based devices).
- These programs *cannot* run in a Dalvik VM.

So there is little point in implementing this right now for the NDK. The go build system is much better than ndk-build when it comes to building Go sources, so if all you need is a static Go executable, you should already be able to do that, just not use the framework libraries though.

There are various efforts to allow one to start a GO program inside a different environment, including Dalvik. When these complete, we'll probably reconsider this bug, it's just too soon right now.

Cc: di...@android.com andrewhs...@google.com
Nov 15, 2012
#75 minux...@gmail.com
> Apart from that, the current situation is that the Go compilers only generate static executables right now.
this is only half-true. while it's true for the gc compiler, the gccgo toolchain could generated dynamic
linking executable now, so in theory, interworking with dalvik is possible with gccgo.

IIUC, the major difficulties for this issue is:
1. gccgo runtime needs {make,set,get}context from bionic (I do have plan to lift this by implementing
the required context switch in assembler directly; so i hope this will be non-issue soon).
2. for efficiency, goroutines need to use segmented stack. However atm, only the gold linker supports
that. But, even the gold linker atm doesn't support segmented stack on ARM.
3. NDK needs to use at least gcc 4.7.1 for reasonable Go 1-compatible libgo support, i guess this
will take more time than the previous two.
4. the most important of all, we will need proper (read: idiomatic) Go interface to Android API.

I'm not sure when gcc 4.7.1+ will be available for NDK. after that, probably I could come up with a POC
of using Go to write native Android App.
Nov 15, 2012
#76 bryantur...@gmail.com
Fairly certain the go community would have a number of contributors to 4.
Myself included.
Nov 15, 2012
Project Member #77 di...@android.com
Let me know if I can help with 1. I already wrote a getcontext() implementation for Breakpad, so the rest shouldn't be a stretch.

You should not rely on a Bionic implementation unless you want to limit your machine code to run on really really recent devices, so the best is to statically link the code to your runtime (what Breakpad does too).

I'm not too familiar with segmented stacks, and can't comment on 4.7 availability, though you can see that the sources are already at android.googlesource.com/toolchain/gcc.git :-)

As for platform interfaces, I'd recommend auto-generating wrapper code from the api.xml files

[1] https://code.google.com/p/google-breakpad/source/browse/trunk/src/common/android/breakpad_getcontext.S

Nov 15, 2012
#78 bryantur...@gmail.com
Not sure generating it from xml files would create idiomatic go.
Language differences mean it can't be a 1 to 1 translation.
It would be a start though.

Nov 15, 2012
Project Member #79 andrewhs...@google.com
I am not familiar with go runtime, and I too can't comment on GCC 4.7 availability in NDK.  The GCC 4.7 under android.googlesource.com/toolchain/gcc.git is only a handful patches behind FSF gcc-4_7-branch (ToT is 4.7.3) and it contains required patches for NDK as well as the binutils-2.22 under android.googlesource.com/toolchain/binutils.git.  In fact, it's the same source for $AOSP/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7 checked in 17 minutes ago , which is able to build correct ARM Android image with TARGET_GCC_VERSION=4.7.

So, I think the point #2 about segmented stack will take longer time :) Need someone familiar with that work on it.
Nov 20, 2012
#80 lxi...@gmail.com
支持一下
Nov 26, 2012
#81 LamCiuLo...@gmail.com
cool!!!
Dec 10, 2012
#82 g...@duzy.info
Greatly support!!
Dec 25, 2012
#83 Mortd...@gocos2d.org
Go on Android should be forked into a seperate project repo. That way it can have its own wiki, bug tracker, etc.   
Dec 25, 2012
#84 minux...@gmail.com
Re #83, do you mean to fork gc or gccgo implementation of Go for Go on Android?
Feb 6, 2013
#86 sail...@gmail.com
cool
Feb 6, 2013
#87 sail...@gmail.com
cool
Feb 14, 2013
#88 knift1...@gmail.com
cool ,support!
Feb 14, 2013
#89 g...@duzy.info
Want to support again!!

Request!!!!!!!!!!!
Feb 15, 2013
#90 peng1299...@gmail.com
do it, pls
Feb 15, 2013
#91 michael....@gmail.com
yes!
Mar 16, 2013
#92 herk...@gmail.com
Nice.
May 4, 2013
#93 ardeshir...@gmail.com
Go go NDK support!
May 4, 2013
#94 g...@duzy.info
The best chance would be GCCGO!!!
May 4, 2013
#95 martin.c...@gmail.com
Desearía que Android se pueda programar en Go.

¡Muchas gracias!
Sign in to add a comment

Powered by Google Project Hosting