Re: [9fans] Go on Plan 9?

2016-04-12 Thread Chris McGee
I see now that there is plan9/arm in tip (1.7), but not 1.6.

I tried a bootstrapped version on my RPi but it fails with a "fork/exec ... 
virtual memory allocation failed” error when I try to compile anything. 
According to stats I have plenty of memory left when it runs. I’m not sure what 
to make of it. Any idea if the port is complete or if there are additional 
commits in progress?

For linux/s390x you can run it fairly easily (if slowly) in a Hercules emulator 
on Linux/Mac. I believe that there is at least one tutorial out there that I 
have successfully followed to get it working.

Chris

> On Apr 12, 2016, at 10:50 PM, Skip Tavakkolian  
> wrote:
> 
> I think Richards' CL's were submitted to main Go repo before Go 1.6 and are 
> now in 1.7 dev branch (tip). I believe I first saw the announcement on godev 
> list. as a Go user, it is a good way of keeping up with the fast-paced 
> development; e.g. IBM's linux/s390x port went in today!
> 
> I usually keep one environment in sync with the latest sources and try out 
> the new features that affect me the most, but I don't think there's anything 
> special about that.
> 
> Next to try on Plan 9: build a linux/s390x binary and find a machine to run 
> it on :)
> 
> 
> 
> On Tue, Apr 12, 2016 at 2:44 PM, > 
> wrote:
> Skip, isn't the point here that being able to run go binaries
> in Plan 9 on an arm machine is news to most Plan 9 users?
> 
> Perhaps even news to those who regularly use go on Plan 9.
> 
> sl
> 
> 



Re: [9fans] Go on Plan 9?

2016-04-12 Thread Skip Tavakkolian
I think Richards' CL's were submitted to main Go repo before Go 1.6 and are
now in 1.7 dev branch (tip). I believe I first saw the announcement on
godev list. as a Go user, it is a good way of keeping up with the
fast-paced development; e.g. IBM's linux/s390x port went in today!

I usually keep one environment in sync with the latest sources and try out
the new features that affect me the most, but I don't think there's
anything special about that.

Next to try on Plan 9: build a linux/s390x binary and find a machine to run
it on :)



On Tue, Apr 12, 2016 at 2:44 PM,  wrote:

> Skip, isn't the point here that being able to run go binaries
> in Plan 9 on an arm machine is news to most Plan 9 users?
>
> Perhaps even news to those who regularly use go on Plan 9.
>
> sl
>
>


Re: [9fans] Go on Plan 9?

2016-04-12 Thread sl
Skip, isn't the point here that being able to run go binaries
in Plan 9 on an arm machine is news to most Plan 9 users?

Perhaps even news to those who regularly use go on Plan 9.

sl



Re: [9fans] Go on Plan 9?

2016-04-12 Thread Chris McGee
Thanks,

I'll give it a shot.

I noticed that there are some assembly files in golang for plan9/386 and no 
equivalent for plan9/arm so I assumed that it wouldn't work with that 
combination.

Chris

> On Apr 12, 2016, at 5:26 PM, Skip Tavakkolian  
> wrote:
> 
> i've not built Go under plan9/arm.  however, in practice (in a real Plan 9 
> environment) this is not an issue. the way authentication and namespaces 
> (including file server) work in a Plan 9 envrionment, it is natural to use 
> the fastest cpu available to (cross) compile apps. typical sessions are like 
> this:
> 
> supermic% ls -l
> d-rwxrwxr-x M 5543 fst fst   0 Jul 21  2015 .hg
> --rw-rw-r-- M 5543 fst fst1071 Feb 10  2013 LICENSE
> --rw-rw-r-- M 5543 fst fst 206 Feb 10  2013 README
> --rw-rw-r-- M 5543 fst fst   12477 Feb 10  2013 admui.go
> --rw-rw-r-- M 5543 fst fst6332 Feb 10  2013 client.go
> --rw-rw-r-- M 5543 fst fst8623 Feb 10  2013 index.html
> --rw-rw-r-- M 5543 fst fst 450 Feb 10  2013 logger.go
> --rw-rw-r-- M 5543 fst fst1307 Feb 10  2013 main.go
> --rw-rw-r-- M 5543 fst fst4232 May 13  2013 server.go
> --rwxrwxr-x M 5543 fst fst 5977542 Apr 12 13:57 tcpmeter
> supermic% rm tcpmeter
> supermic% go build
> supermic% ls -ltr
> --rw-rw-r-- M 5543 fst fst6332 Feb 10  2013 client.go
> --rw-rw-r-- M 5543 fst fst 450 Feb 10  2013 logger.go
> --rw-rw-r-- M 5543 fst fst1071 Feb 10  2013 LICENSE
> --rw-rw-r-- M 5543 fst fst1307 Feb 10  2013 main.go
> --rw-rw-r-- M 5543 fst fst 206 Feb 10  2013 README
> --rw-rw-r-- M 5543 fst fst   12477 Feb 10  2013 admui.go
> --rw-rw-r-- M 5543 fst fst8623 Feb 10  2013 index.html
> --rw-rw-r-- M 5543 fst fst4232 May 13  2013 server.go
> d-rwxrwxr-x M 5543 fst fst   0 Jul 21  2015 .hg
> --rwxrwxr-x M 5543 fst fst 5855281 Apr 12 14:00 tcpmeter
> supermic% file tcpmeter
> tcpmeter: 386 plan 9 executable
> supermic% ./tcpmeter -?
> flag provided but not defined: -?
> 2016/04/12 14:00:31 usage: ./tcpmeter (-c|-s) [-r [host:]port] [-h 
> [host:]port] [-l logfile]
> supermic% GOARCH=arm go build
> supermic% file tcpmeter
> tcpmeter: arm plan 9 executable
> supermic% cpu -h rpi2
> rpi2% ./tcpmeter -?
> flag provided but not defined: -?
> 2016/04/12 14:04:35 usage: ./tcpmeter (-c|-s) [-r [host:]port] [-h 
> [host:]port] [-l logfile]
> rpi2% pwd
> /usr/fst/GoApps/src/tcpmeter
> rpi2% exit
> supermic% pwd
> /usr/fst/GoApps/src/tcpmeter
> supermic% 
> 
> Similar setup could be done under Linux/MacOSX with some work. I found this 
> article very helpful:
> https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.635w6yhi5
> 
> btw, building Go on rpi/linux, took some time.  i have not tried rpi3 yet 
> (waiting for 64bit plan9 or linux).  building Go on odroid-c2 (linux/arm64) 
> "feels" as speedy as on atom or i3.
> 
> 
>> On Tue, Apr 12, 2016 at 12:21 PM, Chris McGee  wrote:
>> Hi Skip,
>> 
>> Have you managed to get Go running on an RPi this way?
>> 
>> Cheers,
>> Chris
>> 
>> >
>> > If you run Plan 9 in a VM, emulator or a confined device (RPi), it will be 
>> > easier/faster to cross compile your app and copy it over. E.g. to compile 
>> > for 9Pi:
>> > $ GOOS=plan9 GOARCH=arm go build
>> >
>> >
> 


Re: [9fans] Go on Plan 9?

2016-04-12 Thread Skip Tavakkolian
i've not built Go under plan9/arm.  however, in practice (in a real Plan 9
environment) this is not an issue. the way authentication and namespaces
(including file server) work in a Plan 9 envrionment, it is natural to use
the fastest cpu available to (cross) compile apps. typical sessions are
like this:

supermic% ls -l
d-rwxrwxr-x M 5543 fst fst   0 Jul 21  2015 .hg
--rw-rw-r-- M 5543 fst fst1071 Feb 10  2013 LICENSE
--rw-rw-r-- M 5543 fst fst 206 Feb 10  2013 README
--rw-rw-r-- M 5543 fst fst   12477 Feb 10  2013 admui.go
--rw-rw-r-- M 5543 fst fst6332 Feb 10  2013 client.go
--rw-rw-r-- M 5543 fst fst8623 Feb 10  2013 index.html
--rw-rw-r-- M 5543 fst fst 450 Feb 10  2013 logger.go
--rw-rw-r-- M 5543 fst fst1307 Feb 10  2013 main.go
--rw-rw-r-- M 5543 fst fst4232 May 13  2013 server.go
--rwxrwxr-x M 5543 fst fst 5977542 Apr 12 13:57 tcpmeter
supermic% rm tcpmeter
supermic% go build
supermic% ls -ltr
--rw-rw-r-- M 5543 fst fst6332 Feb 10  2013 client.go
--rw-rw-r-- M 5543 fst fst 450 Feb 10  2013 logger.go
--rw-rw-r-- M 5543 fst fst1071 Feb 10  2013 LICENSE
--rw-rw-r-- M 5543 fst fst1307 Feb 10  2013 main.go
--rw-rw-r-- M 5543 fst fst 206 Feb 10  2013 README
--rw-rw-r-- M 5543 fst fst   12477 Feb 10  2013 admui.go
--rw-rw-r-- M 5543 fst fst8623 Feb 10  2013 index.html
--rw-rw-r-- M 5543 fst fst4232 May 13  2013 server.go
d-rwxrwxr-x M 5543 fst fst   0 Jul 21  2015 .hg
--rwxrwxr-x M 5543 fst fst 5855281 Apr 12 14:00 tcpmeter
supermic% file tcpmeter
tcpmeter: 386 plan 9 executable
supermic% ./tcpmeter -?
flag provided but not defined: -?
2016/04/12 14:00:31 usage: ./tcpmeter (-c|-s) [-r [host:]port] [-h
[host:]port] [-l logfile]
supermic% GOARCH=arm go build
supermic% file tcpmeter
tcpmeter: arm plan 9 executable
supermic% cpu -h rpi2
rpi2% ./tcpmeter -?
flag provided but not defined: -?
2016/04/12 14:04:35 usage: ./tcpmeter (-c|-s) [-r [host:]port] [-h
[host:]port] [-l logfile]
rpi2% pwd
/usr/fst/GoApps/src/tcpmeter
rpi2% exit
supermic% pwd
/usr/fst/GoApps/src/tcpmeter
supermic%

Similar setup could be done under Linux/MacOSX with some work. I found this
article very helpful:
https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.635w6yhi5

btw, building Go on rpi/linux, took some time.  i have not tried rpi3 yet
(waiting for 64bit plan9 or linux).  building Go on odroid-c2 (linux/arm64)
"feels" as speedy as on atom or i3.


On Tue, Apr 12, 2016 at 12:21 PM, Chris McGee  wrote:

> Hi Skip,
>
> Have you managed to get Go running on an RPi this way?
>
> Cheers,
> Chris
>
> >
> > If you run Plan 9 in a VM, emulator or a confined device (RPi), it will
> be easier/faster to cross compile your app and copy it over. E.g. to
> compile for 9Pi:
> > $ GOOS=plan9 GOARCH=arm go build
> >
> >
>
>
>


Re: [9fans] Go on Plan 9?

2016-04-12 Thread Dave MacFarlane
I've managed to get Go running on an RPi2 using a similar method, but:

1. You need to make sure you're using go-tip. <= 1.6 doesn't have Plan9/arm
support.
2. I had to apply this patch that Richard Miller sent me to my kernel:

term% diff /n/sources/contrib/miller/9/bcm/mem.h /sys/src/9/bcm/mem.h
55c55
< #define   USTKTOP 0x2000  /* user segment end
+1 */
---
> #define   USTKTOP 0x4000  /* user segment end
+1 */

(Then realized that the git client I was writing in Go wasn't ready enough
to use
as a daily driver for developing Go programs under Plan9, so I didn't go
much
further than that and compiling a few test programs..)

-- Dave

On Tue, Apr 12, 2016 at 3:21 PM, Chris McGee  wrote:

> Hi Skip,
>
> Have you managed to get Go running on an RPi this way?
>
> Cheers,
> Chris
>
> >
> > If you run Plan 9 in a VM, emulator or a confined device (RPi), it will
> be easier/faster to cross compile your app and copy it over. E.g. to
> compile for 9Pi:
> > $ GOOS=plan9 GOARCH=arm go build
> >
> >
>
>
>


-- 
- Dave


Re: [9fans] Go on Plan 9?

2016-04-12 Thread Chris McGee
Hi Skip,

Have you managed to get Go running on an RPi this way?

Cheers,
Chris

> 
> If you run Plan 9 in a VM, emulator or a confined device (RPi), it will be 
> easier/faster to cross compile your app and copy it over. E.g. to compile for 
> 9Pi:
> $ GOOS=plan9 GOARCH=arm go build
> 
> 




Re: [9fans] Go on Plan 9?

2016-04-12 Thread Skip Tavakkolian
Yes, this works and is the easier of the two methods.  Using a desktop OS
and starting no Go compilers:

1. download the Go 1.6 binaries for your desktop OS and install them; set
GOROOT_BOOTSTRAP to that directory (e.g. /usr/local/go)

2. copy the Go 1.6 sources (either the tar.gz or git clone of sources) to
your desktop OS; set GOROOT to that directory (e.g. $HOME/go)

3. build the bootstrap for Plan 9 (i.e. go-plan9-386-bootstrap.tbz) on your
desktop:
$ cd $GOROOT/src
$ GOOS=plan9 GOARCH=386 ./bootstrap.bash
   if all is well, this will produce ../../go-plan9-386-bootstrap.tbz

4. untar this in your Plan 9 environment and set GOROOT_BOOTSTRAP to that
directory; e.g. drawterm from your desktop OS to Plan 9:
% cd $home
% bunzip2 -c /mnt/term/path-to-go-plan9-386-bootstrap.tbz | tar -xv
% GOROOT_BOOTSTRAP=$home/go-plan9-386-bootstrap

5. copy Go 1.6 sources to your Plan 9 fs and set GOROOT to that directory;
e.g. drawterm from your desktop OS to Plan 9:
% mkdir $home/go
% dircp /mnt/term/path-of-GOROOT-on-desktop $home/go
% GOROOT=$home/go
% cd $GOROOT/src
% ./all.rc

If you run Plan 9 in a VM, emulator or a confined device (RPi), it will be
easier/faster to cross compile your app and copy it over. E.g. to compile
for 9Pi:
$ GOOS=plan9 GOARCH=arm go build

-Skip


On Mon, Apr 11, 2016 at 5:59 PM, Chris McGee  wrote:
>
>
> It may also be possible to cross compile a bootstrap of Go from
> Linux/Mac/Windows using the bootstrap.sh script after setting GOOS=plan9,
> GOARCH=386 and GO386=387. That bootstrap can be placed into plan9 and used
> as the GOROOT_BOOTSTRAP to compile a full Go installation on the plan9
> system.
>
>
>