On Wed, Apr 21, 2021 at 7:38 AM Shiva <emailshivasubraman...@gmail.com> wrote:
>
> Thank you for clearing that up, Ian. I'll set this go1.4 installation aside 
> and install Go 1.16 on windows then. But I am still a bit unclear on what you 
> mean by 'porting Go tip to support nsx' - Can you expand on what you mean by 
> Go tip?

I mean the code that you get when you run "git clone
https://go.googlesource.com";.  The code to which we commit changes.

Ian


> On Tuesday, April 20, 2021 at 9:14:13 PM UTC+1 Ian Lance Taylor wrote:
>>
>> On Tue, Apr 20, 2021 at 1:39 AM Shiva <emailshiva...@gmail.com> wrote:
>> >
>> > I'm a bit confused now. Let me explain what I have been doing.
>> > 1. Installed go on windows (go version go1.4-bootstrap-20170531 
>> > windows/amd64)
>> > 2. Duped linux files to nsx and added build statements
>> > At this point, I am not supposed to run bootstrap.bash but run make.bat 
>> > because my installation is on windows. And when I ran make.bat, it failed 
>> > with the following error 'unknown $GOOS nsx', and the error was from 
>> > cmd\dist\build.c because it looks for known values in the okgoos array. 
>> > And there is no way for me to get past that if I use nsx, so I basically 
>> > assumed that I had to 'add support' for a new target OS. It was the same 
>> > case with sym.c. The only way I can make it work without updating these 
>> > files would be to use goos=linux, I assume.
>> >
>> > My goal has always been to get a cross-compiled version of go1.4 so that I 
>> > can move that to nsx and then compile the latest Go version on NSX. Please 
>> > let me know if I'm not on the right direction.
>>
>> Sorry, but I don't think you're on the right direction.
>>
>> There is no reason to ever port Go 1.4 to nsx. The only reason we
>> talk about Go 1.4 at all is because it can be built without a
>> previously existing Go compiler. But you have a previously existing
>> Go compiler: Go 1.16 (or any other release) on Windows. Your goal
>> should be to port Go tip to nsx, not Go 1.4. Once you've ported Go
>> tip to support nsx, then you can build it, on Windows, using Go 1.16
>> and bootstrap.bash. That will give you a Go toolchain that will run
>> on nsx.
>>
>> Porting Go 1.4 to nsx will be a lot of work that you will have to
>> completely redo in order to port Go tip. What you want in the end is
>> Go tip, not Go 1.4. So don't bother with Go 1.4 at all.
>>
>> Ian
>>
>>
>>
>> > On Monday, April 19, 2021 at 6:52:24 PM UTC+1 Ian Lance Taylor wrote:
>> >>
>> >> On Fri, Apr 16, 2021 at 2:28 AM Shiva <emailshiva...@gmail.com> wrote:
>> >> >
>> >> > Since I haven't generated the various ztypes_nsx_GOARCH.go files, I 
>> >> > think I need to use +build nsx and not ignore the build for 
>> >> > types_nsx.go.
>> >> >
>> >> > I found a way to run bootstrap.bat on windows but I was told that I had 
>> >> > to run make.bat instead, so I did. I had to add "nsx" to the array 
>> >> > 'okgoos' in cmd\dist\build.c to be able to run make.bat so I did that 
>> >> > too. And the output from make.bat had a lot of the same warning 'this 
>> >> > statement may fall through [-Wimplicit-fallthrough=]' and I ignored 
>> >> > them. And I had to update sym.c (liblink)'s headers array with an entry 
>> >> > for nsx which made me realise that the following files will need to 
>> >> > have 'switch cases' for Hnsx on a bunch of other asm*/obj files under 
>> >> > cmd\*l and liblink. So I did them too.
>> >> >
>> >> > I know that I also have to update cmd\ld\elf.c where I see three 
>> >> > references required for Hnsx - one at elfinit and the other two under 
>> >> > asmbelf function - one while setting interpreter and the other for 
>> >> > setting elf protected headers (?). But I'm uncertain about the changes 
>> >> > required in that file especially the one setting the interpreter 
>> >> > because that requires pointing to the dynamic linker loader (different 
>> >> > ones for OABI and EABI) in asm.c under cmd\*l directories? Can you 
>> >> > please advise?
>> >>
>> >> I think you are on the wrong path here. The idea of using
>> >> bootstrap.bash is that you should not have to edit any of the Go 1.4 C
>> >> code at all. The idea is that you run bootstrap.bash on a system that
>> >> already has a working Go compiler installed. That working Go compiler
>> >> is then used as a cross-compiler to build a toolchain that will run on
>> >> nsx. That requires editing the Go tip code to support nsx. It does
>> >> not require editing any of the Go 1.4 code, and should not require
>> >> editing any C code at all.
>> >>
>> >> Ian
>> >>
>> >>
>> >> > On Wednesday, April 14, 2021 at 8:25:55 PM UTC+1 Ian Lance Taylor wrote:
>> >> >>
>> >> >> On Wed, Apr 14, 2021 at 8:25 AM Shiva <emailshiva...@gmail.com> wrote:
>> >> >> >
>> >> >> > One file specifically, types_linux.go which I duped into 
>> >> >> > types_nsx.go has a build statement that goes like this '+build 
>> >> >> > ignore'. Github discussions around this suggest to me that I don't 
>> >> >> > have to build this? But happy to be corrected.
>> >> >>
>> >> >> The "+build ignore" line means that the file will not be built as part
>> >> >> of an ordinary "go build" or "go install". For a file like
>> >> >> syscall/types_linux.go, that is because the file originally served as
>> >> >> input to cgo -godefs as part of generating the various
>> >> >> ztypes_linux_GOARCH.go files.
>> >> >>
>> >> >> > Also, can I build the bootstrap on windows or can I only do it in a 
>> >> >> > POSIX environment - I don't see bootstrap.bat and running 
>> >> >> > bootstrap.bash with GOOS=nsx and GOARCH=amd64 simply returns back 
>> >> >> > the prompt?
>> >> >>
>> >> >> You should be able to build a bootstrap on Windows but you'll have to
>> >> >> either replicate bootstrap.bash in a Windows style, or you'll have to
>> >> >> use something like cygwin to run the bootstrap.bash shell script.
>> >> >> There aren't that many real commands in bootstrap.bash so I think that
>> >> >> creating a minimal bootstrap.bat would be fairly simple.
>> >> >>
>> >> >> Ian
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups "golang-nuts" group.
>> >> > To unsubscribe from this group and stop receiving emails from it, send 
>> >> > an email to golang-nuts...@googlegroups.com.
>> >> > To view this discussion on the web visit 
>> >> > https://groups.google.com/d/msgid/golang-nuts/420ce2be-b241-435f-89f9-b5f7c121bb9an%40googlegroups.com.
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "golang-nuts" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to golang-nuts...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/golang-nuts/3e8a31b9-f349-4984-8538-df7533fccb36n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/4def7bf3-5e6d-4acf-98be-6860587234e3n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVTmNHvAzZWaXezTC4qW33Qq%2BGxPACTZwiumjxhQUrdrA%40mail.gmail.com.

Reply via email to