porting go to sparc Solaris

3,389 views
Skip to first unread message

mu...@yahoo.com

unread,
May 21, 2017, 3:21:53 AM5/21/17
to golang-dev
Is there any document describing the steps needed to port the go toolchain to a new platform, including modifying the toolchain to create binaries that will run on the new platform? I am trying to port the go toolchain to sparc Solaris.

Aram Hăvărneanu

unread,
May 21, 2017, 6:23:40 AM5/21/17
to mu...@yahoo.com, golang-dev
I have already ported Go to sparc: https://github.com/4ad/go

It's still based on the old compiler, there were some delays in
implementing SSA so I couldn't submit it upstream yet, hopefully it
will get into 1.10.

--
Aram Hăvărneanu

mu...@yahoo.com

unread,
May 21, 2017, 1:55:01 PM5/21/17
to golang-dev, mu...@yahoo.com
Thanks for the pointer.
Do you have a binary release that can be used to build this?
Also, are there any plans to make the sparc port available from the golang.org web site?

Aram Hăvărneanu

unread,
May 21, 2017, 7:20:41 PM5/21/17
to mu...@yahoo.com, golang-dev
On Sun, May 21, 2017 at 7:55 PM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
> Do you have a binary release that can be used to build this?

No, but you can use any recent-enough version of Go to build this on
any supported host system.

> Also, are there any plans to make the sparc port available from the golang.org web site?

Sure.

--
Aram Hăvărneanu
Message has been deleted
Message has been deleted

mu...@yahoo.com

unread,
May 22, 2017, 1:04:27 PM5/22/17
to golang-dev, mu...@yahoo.com
I built go under go-sparc64 on a intel-Linux platform. I assume that this go will generate sparc binaries. However if I use this go and compile a 'hello world' program on intel-Linux, the resulting executable runs on intel-Linux but not on sparc-Solaris. What am I doing wrong?
Note: the file VERSION was missing missing in go-sparc64 and this caused the build to fail. I copied this file from the 1.8.1 sources and the build succeeded.

Also, is there a way to build go using gccgo? I have gccgo available on sparc-Solaris.

Ian Lance Taylor

unread,
May 22, 2017, 8:21:35 PM5/22/17
to mu...@yahoo.com, golang-dev
On Mon, May 22, 2017 at 9:44 AM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
>
> I built go under go-sparc64 on a intel-Linux platform. I assume that this go
> will generate sparc binaries. However if I use this go and compile a 'hello
> world' program on intel-Linux, the resulting executable runs on intel-Linux
> but not on sparc-Solaris. What am I doing wrong?

To cross-compile with the gc toolchain, set GOARCH=sparc when running
`go build`.

> Also, is there a way to build go using gccgo? I have gccgo available on
> sparc-Solaris.

Yes, this is possible. Search for gccgo in
https://golang.org/doc/install/source .

Ian

Aram Hăvărneanu

unread,
May 22, 2017, 9:10:10 PM5/22/17
to Ian Lance Taylor, mu...@yahoo.com, golang-dev
On Tue, May 23, 2017 at 2:21 AM, Ian Lance Taylor <ia...@golang.org> wrote:
> To cross-compile with the gc toolchain, set GOARCH=sparc when running
> `go build`.

GOARCH=sparc64

--
Aram Hăvărneanu

mu...@yahoo.com

unread,
May 22, 2017, 10:17:01 PM5/22/17
to golang-dev, ia...@golang.org, mu...@yahoo.com
If I set GOARCH=sparc64, I get the error:
cmd/go: unsupported GOOS/GOARCH pair linux/sparc64

I then tried setting GOOS=solaris and got the error
compile: unknown architecture "sparc64"

Is there something else I need to do?

mu...@yahoo.com

unread,
May 22, 2017, 11:00:56 PM5/22/17
to golang-dev, ia...@golang.org, mu...@yahoo.com
My mistake, I forgot to set GOROOT.
After I set GOROOT, it builds the executable correctly but when I try to run it on a sparc-Solaris machine, I the the following errors:

runtime: address space conflict: map(0xc420000000) = 0xffffffff7eb00000
fatal error: runtime: address space conflict

runtime stack:
runtime.throw(0x14c39b, 0x1f)
        .../go-sparc64/src/runtime/panic.go:573 +0xe0 fp=0xffffffff7fffe510 sp=0
xffffffff7fffe450
runtime.sysMap(0xc420000000, 0x100000, 0xffffff7fffeb04, 0x1c04d8)
        .../go-sparc64/src/runtime/mem_bsd.go:84 +0x1ec fp=0xffffffff7fffe600 sp
=0xffffffff7fffe510
runtime.(*mheap).sysAlloc(0x1a7e20, 0x100000, 0xffffffff7fffe031)
        .../go-sparc64/src/runtime/malloc.go:429 +0x3a4 fp=0xffffffff7fffe730 sp
=0xffffffff7fffe600
runtime.(*mheap).grow(0x1a7e20, 0x8, 0x0)
        .../go-sparc64/src/runtime/mheap.go:726 +0xf4 fp=0xffffffff7fffe830 sp=0
xffffffff7fffe730
    ...

Dave Cheney

unread,
May 22, 2017, 11:03:22 PM5/22/17
to mu...@yahoo.com, golang-dev, ia...@golang.org

Please, please, please do not set GOROOT.

Leave GOROOT unset and cd into the src/ sub directory of the copy of Go you are trying to build.

Just to repeat, do not set GOROOT if you are building from source.


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mu...@yahoo.com

unread,
May 22, 2017, 11:18:26 PM5/22/17
to golang-dev, mu...@yahoo.com, ia...@golang.org
Maybe I was not clear.
I built the cross go for sparc-Solaris without setting GOROOT.
Now I use this go to build a 'hello world' program and in this step I set GOROOT. If I don't set GOROOT in this step, I get the errors I reported earlier. The runtime error and stack trace I am getting is when I run the 'hello world' program on a sparc-Solaris machine.

Dave Cheney

unread,
May 22, 2017, 11:19:37 PM5/22/17
to mu...@yahoo.com, golang-dev, ia...@golang.org

How did you build the cross compiling go? What were the exact commands you used?

mu...@yahoo.com

unread,
May 22, 2017, 11:22:09 PM5/22/17
to golang-dev, mu...@yahoo.com, ia...@golang.org
I built the cross-compiling go for sparc-Solaris on a intel-Linux machine and I used the script make.bash to build it. The go in my path was the go on intel-Linux.

Dave Cheney

unread,
May 22, 2017, 11:25:22 PM5/22/17
to mu...@yahoo.com, golang-dev, ia...@golang.org

You need to show us exactly the steps you used if we are to offer any useful help.

Also, if you are using Aram's port, you can build it natively on your SPARC64 host. There is no need to cross compile a toolchain Intel to sparc64

Mukesh Kapoor

unread,
May 22, 2017, 11:33:50 PM5/22/17
to Dave Cheney, golang-dev, ia...@golang.org
I don't have a go binary release for sparc-Solaris and Aram suggested that I build on any platform where I have go available so I built on intel-Linux. Here are the steps I followed:

on intel-Linux machine:
% cd go-sparc64/src
% ./make.bash

This builds the cross-go and installs under go-sparc64/bin.

To use this compiler I did the following steps:

% export PATH=<path-to-cross-go>/$PATH
% cd .../hello
% ls
hello.go

% go build
% ls
hello  hello.go

% file hello
hello: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked (uses shared libs), not stripped

On a sparc-Solaris machine I try to run this hello:

% hello
runtime: address space conflict: map(0xc420000000) = 0xffffffff7eb00000
fatal error: runtime: address space conflict

runtime stack:
runtime.throw(0x14c39b, 0x1f)
   ...



From: Dave Cheney <da...@cheney.net>
To: mu...@yahoo.com; golang-dev <golan...@googlegroups.com>
Cc: ia...@golang.org
Sent: Monday, May 22, 2017 8:25 PM
Subject: Re: [golang-dev] porting go to sparc Solaris

Dave Cheney

unread,
May 22, 2017, 11:38:28 PM5/22/17
to Mukesh Kapoor, golang-dev, ia...@golang.org


On Tue, 23 May 2017, 13:33 Mukesh Kapoor <mu...@yahoo.com> wrote:
I don't have a go binary release for sparc-Solaris and Aram suggested that I build on any platform where I have go available so I built on intel-Linux. Here are the steps I followed:

on intel-Linux machine:
% cd go-sparc64/src
% ./make.bash

This builds the cross-go and installs under go-sparc64/bin.

Unless you have set GOARCH=SPARC64 this will not build a cross compiling version. 


To use this compiler I did the following steps:

% export PATH=<path-to-cross-go>/$PATH
% cd .../hello
% ls
hello.go

% go build
% ls
hello  hello.go

You can just run path-to-go-sparc64/bin/go build 

Again, make sure you have exported GOARCH=sparc64 if you want to compile for that architecture. 


% file hello
hello: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked (uses shared libs), not stripped

On a sparc-Solaris machine I try to run this hello:

% hello
runtime: address space conflict: map(0xc420000000) = 0xffffffff7eb00000
fatal error: runtime: address space conflict

Yup, that's a bug, I think the sparc64 port is based off a version of Go that is 2.5 years old now, many changes to the runtime have landed since then. 

mu...@yahoo.com

unread,
May 22, 2017, 11:53:18 PM5/22/17
to golang-dev, mu...@yahoo.com, ia...@golang.org


On Monday, May 22, 2017 at 8:38:28 PM UTC-7, Dave Cheney wrote:


On Tue, 23 May 2017, 13:33 Mukesh Kapoor <mu...@yahoo.com> wrote:
I don't have a go binary release for sparc-Solaris and Aram suggested that I build on any platform where I have go available so I built on intel-Linux. Here are the steps I followed:

on intel-Linux machine:
% cd go-sparc64/src
% ./make.bash

This builds the cross-go and installs under go-sparc64/bin.

Unless you have set GOARCH=SPARC64 this will not build a cross compiling version. 

I had not set GOARCH for this step.
I just built the cross-go again after setting GOARCH but I still get the same errors as before when I run the resulting hello on sparc-Solaris.
 


To use this compiler I did the following steps:

% export PATH=<path-to-cross-go>/$PATH
% cd .../hello
% ls
hello.go

% go build
% ls
hello  hello.go

You can just run path-to-go-sparc64/bin/go build 

Again, make sure you have exported GOARCH=sparc64 if you want to compile for that architecture. 


% file hello
hello: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked (uses shared libs), not stripped

On a sparc-Solaris machine I try to run this hello:

% hello
runtime: address space conflict: map(0xc420000000) = 0xffffffff7eb00000
fatal error: runtime: address space conflict

Yup, that's a bug, I think the sparc64 port is based off a version of Go that is 2.5 years old now, many changes to the runtime have landed since then. 

So, this means the sparc64 port does not work right now? I got the impression from Aram's message that it works.

 

Dave Cheney

unread,
May 22, 2017, 11:58:41 PM5/22/17
to mu...@yahoo.com, golang-dev, ia...@golang.org
On Tue, May 23, 2017 at 1:53 PM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
>
>
> On Monday, May 22, 2017 at 8:38:28 PM UTC-7, Dave Cheney wrote:
>>
>>
>>
>> On Tue, 23 May 2017, 13:33 Mukesh Kapoor <mu...@yahoo.com> wrote:
>>>
>>> I don't have a go binary release for sparc-Solaris and Aram suggested
>>> that I build on any platform where I have go available so I built on
>>> intel-Linux. Here are the steps I followed:
>>>
>>> on intel-Linux machine:
>>> % cd go-sparc64/src
>>> % ./make.bash
>>>
>>> This builds the cross-go and installs under go-sparc64/bin.
>>
>>
>> Unless you have set GOARCH=SPARC64 this will not build a cross compiling
>> version.
>
>
> I had not set GOARCH for this step.

Then I have no idea how your toolchain produced a solaris/sparc64
binary; it should have produced an intel one.
Not sure sorry. You're using solaris 11 / illumos right? Solaris 10
and earlier are not supported.

mu...@yahoo.com

unread,
May 23, 2017, 12:08:53 AM5/23/17
to golang-dev, mu...@yahoo.com, ia...@golang.org


On Monday, May 22, 2017 at 8:58:41 PM UTC-7, Dave Cheney wrote:
On Tue, May 23, 2017 at 1:53 PM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
>
>
> On Monday, May 22, 2017 at 8:38:28 PM UTC-7, Dave Cheney wrote:
>>
>>
>>
>> On Tue, 23 May 2017, 13:33 Mukesh Kapoor <mu...@yahoo.com> wrote:
>>>
>>> I don't have a go binary release for sparc-Solaris and Aram suggested
>>> that I build on any platform where I have go available so I built on
>>> intel-Linux. Here are the steps I followed:
>>>
>>> on intel-Linux machine:
>>> % cd go-sparc64/src
>>> % ./make.bash
>>>
>>> This builds the cross-go and installs under go-sparc64/bin.
>>
>>
>> Unless you have set GOARCH=SPARC64 this will not build a cross compiling
>> version.
>
>
> I had not set GOARCH for this step.

Then I have no idea how your toolchain produced a solaris/sparc64
binary; it should have produced an intel one.

Yes, it produced an intel-Linux binary cross-go. I run this cross-go on an intel-Linux machine and it produces a sparc-Solaris binary. I then run this sparc-Solaris binary on sparc.
One more step that I need to do is to bootstrap sparc64-go using the cross-go and then I will get a native sparc go. I still have to do this step.
 

Ahh, this was the problem. I was trying to run the 'hello world' binary on a Solaris 10 machine. I just tried on a Solaris 11 machine and it works fine. Thanks for all your help.

Now my next task: bootstrap sparc64-go using the cross-go to create a native sparc go...
 

mu...@yahoo.com

unread,
May 23, 2017, 12:36:20 AM5/23/17
to golang-dev, mu...@yahoo.com, ia...@golang.org


On Monday, May 22, 2017 at 9:08:53 PM UTC-7, mu...@yahoo.com wrote:
...


Now my next task: bootstrap sparc64-go using the cross-go to create a native sparc go...

I just completed this bootstrap step and the native sparc go works fine for a 'hello world' program.

Dave Cheney

unread,
May 23, 2017, 1:22:36 AM5/23/17
to mu...@yahoo.com, golang-dev, ia...@golang.org

Excellent news!


Aram Hăvărneanu

unread,
May 23, 2017, 6:22:42 AM5/23/17
to Dave Cheney, Mukesh Kapoor, golang-dev, ia...@golang.org
On Tue, May 23, 2017 at 5:38 AM, Dave Cheney <da...@cheney.net> wrote:
> I think the sparc64 port is based off a version of Go that is 2.5 years old
> now, many changes to the runtime have landed since then.

Not really, it's based on the last version of Go 1.8 development tree
(so 1.7+) that still contained the old compiler, plus some more recent
changes.

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
May 23, 2017, 6:22:59 AM5/23/17
to mu...@yahoo.com, golang-dev, Ian Lance Taylor
On Tue, May 23, 2017 at 6:36 AM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
> I just completed this bootstrap step and the native sparc go works fine for
> a 'hello world' program.

Great.

--
Aram Hăvărneanu

Dave Cheney

unread,
May 23, 2017, 7:16:36 AM5/23/17
to Aram Hăvărneanu, Mukesh Kapoor, golang-dev, ia...@golang.org
That's good to know. Thanks for correcting me.

mu...@yahoo.com

unread,
May 23, 2017, 12:25:22 PM5/23/17
to golang-dev, da...@cheney.net, mu...@yahoo.com, ia...@golang.org
Any idea when it will be ported using the latest Go sources and when it will be available for download from the golang.org website?
Also, is someone working on porting to other sparc and Solaris platforms: sparc-Linux and intel-Solaris?
 

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
May 23, 2017, 12:35:03 PM5/23/17
to Mukesh Kapoor, golang-dev, Dave Cheney, Ian Lance Taylor
On Tue, May 23, 2017 at 6:25 PM, mu11 via golang-dev
<golan...@googlegroups.com> wrote:
> Any idea when it will be ported using the latest Go sources and when it will
> be available for download from the golang.org website?

I can't give you an exact time, but I hope as soon as possible.

> Also, is someone working on porting to other sparc and Solaris platforms: sparc-Linux and intel-Solaris?

As fas as I know, nobody is working on linux/sparc64, although the
work should be pretty simple.

On solaris/amd64 Go has been working for many years already. By
solaris I mean solaris 11 and illumos. It doesn't run on Solaris 10
because it uses Solaris 11+ APIs. In principle we could also port it
to Solaris 10, but nobody has really asked for it.

--
Aram Hăvărneanu

Brad Fitzpatrick

unread,
May 23, 2017, 12:37:35 PM5/23/17
to mu...@yahoo.com, golang-dev, Dave Cheney, Ian Taylor
On Tue, May 23, 2017 at 9:25 AM, mu11 via golang-dev <golan...@googlegroups.com> wrote:


On Tuesday, May 23, 2017 at 3:22:42 AM UTC-7, Aram Hăvărneanu wrote:
On Tue, May 23, 2017 at 5:38 AM, Dave Cheney <da...@cheney.net> wrote:
> I think the sparc64 port is based off a version of Go that is 2.5 years old
> now, many changes to the runtime have landed since then.

Not really, it's based on the last version of Go 1.8 development tree
(so 1.7+) that still contained the old compiler, plus some more recent
changes.

Any idea when it will be ported using the latest Go sources and when it will be available for download from the golang.org website?

Earliest February 1st, 2018. Or August 1st, 2018.


mu...@yahoo.com

unread,
May 23, 2017, 12:47:43 PM5/23/17
to golang-dev, mu...@yahoo.com, ia...@golang.org
Using this bootstrapped sparc64 go, I tried running the script all.bash on a sparc Solaris 11 machine in the src directory and it failed with the following error:

##### Building Go bootstrap tool.
cmd/dist
go tool dist: unknown architecture: sun4v

What's wrong now?

Aram Hăvărneanu

unread,
May 23, 2017, 12:53:23 PM5/23/17
to Mukesh Kapoor, golang-dev, Ian Lance Taylor
> ##### Building Go bootstrap tool.
> cmd/dist
> go tool dist: unknown architecture: sun4v
>
> What's wrong now?

Possibly a bug, try setting up GOHOSTARCH=sparc64.

--
Aram Hăvărneanu

mu...@yahoo.com

unread,
May 23, 2017, 12:57:48 PM5/23/17
to golang-dev, mu...@yahoo.com, ia...@golang.org


On Tuesday, May 23, 2017 at 9:53:23 AM UTC-7, Aram Hăvărneanu wrote:
> ##### Building Go bootstrap tool.
> cmd/dist
> go tool dist: unknown architecture: sun4v
>
> What's wrong now?

Possibly a bug, try setting up GOHOSTARCH=sparc64.

This did not help. I still get the same error.
 

--
Aram Hăvărneanu

Josh Bleecher Snyder

unread,
May 23, 2017, 1:43:45 PM5/23/17
to mu...@yahoo.com, golang-dev, Ian Lance Taylor
> I built the cross-compiling go for sparc-Solaris on a intel-Linux machine
> and I used the script make.bash to build it. The go in my path was the go on
> intel-Linux.

Though it is probably not the source of the problems you've
encountered since, you may find it more convenient in future to use
bootstrap.bash instead of make.bash; it is designed specifically for
cross-compiling a bootstrap toolchain.

-josh

calv...@gmail.com

unread,
Jun 7, 2017, 8:48:12 PM6/7/17
to golang-dev
What is the output of your "uname -a" command ? This is the output on my system and I got a lot further than what you had:

uname -a
SunOS <system_name> 5.11 11.3 sun4v sparc sun4v

First I built the go toolchain using bootstrap.bash. It installed the solaris-sparc64 go tool chain under $GOROOT/../go-solaris-sparc64-bootstrap

Then I go to a Solaris 11 system and change the GOROOT_BOOTSTRAP value to:

GOROOT_BOOTSTRAP=<install-dir>/go-solaris-sparc64-bootstrap

and that built gofmt successfully. However, the build of 'go' itself using the bootstrapped solaris-sparc64 go failed due to this error:

runtime/cgo
# runtime/cgo
/usr/bin/as: "/var/tmp//ccQuoGbd.s", line 27: error: unknown "%"-symbol
/usr/bin/as: "/var/tmp//ccQuoGbd.s", line 27: error: quoted-string operand required
/usr/bin/as: "/var/tmp//ccQuoGbd.s", line 27: error: statement syntax

but it got pretty far before the failure :)


mu...@yahoo.com

unread,
Jun 7, 2017, 11:57:30 PM6/7/17
to golang-dev


On Wednesday, June 7, 2017 at 5:48:12 PM UTC-7, Calvin Vu wrote:
What is the output of your "uname -a" command ? This is the output on my system and I got a lot further than what you had:

uname -a
SunOS <system_name> 5.11 11.3 sun4v sparc sun4v

I built it on exactly this same system.
 

mu...@yahoo.com

unread,
Jun 8, 2017, 5:19:18 PM6/8/17
to golang-dev, mu...@yahoo.com, ia...@golang.org

The problem was that I had manually created a symlink ~/go1.4 and it pointed to the intel-Linux go. I changed this link to point to the sparc64-Solaris go and the script all.bash completes. The only error I see in my log is:

 # runtime/cgo
/usr/bin/as: "/var/tmp//ccdyvu8c.s", line 27: error: unknown "%"-symbol
/usr/bin/as: "/var/tmp//ccdyvu8c.s", line 27: error: quoted-string operand requi red
/usr/bin/as: "/var/tmp//ccdyvu8c.s", line 27: error: statement syntax

Is this some bug?

 

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Jun 9, 2017, 5:23:36 AM6/9/17
to Mukesh Kapoor, golang-dev, Ian Lance Taylor
I suppose your gcc uses Solaris as instead of GNU as.

--
Aram Hăvărneanu

shawn....@oracle.com

unread,
Jun 13, 2017, 2:51:26 PM6/13/17
to golang-dev, mu...@yahoo.com, ia...@golang.org

The gcc binaries provided in newer versions of Solaris are configured to use gas instead of Solaris as.  You may wish to build your own gcc.

-Shawn

heng....@gmail.com

unread,
Jul 16, 2017, 6:37:08 PM7/16/17
to golang-dev, mu...@yahoo.com, da...@cheney.net, ia...@golang.org
Hi Aram,

Actually i am trying to build go tool chain on Solaris 10 amd64, and it does not work, the error i get is as follows (I tried to use gccgo 5 to build my go applications and I follow the steps on https://golang.org/doc/install/source):

cd /tmp/go-1.4/src
env GOROOT_BOOTSTRAP=/opt/csw ./make.bash

# Building C bootstrap tool.
cmd/dist

# Building compilers and Go bootstrap tool for host, solaris/amd64.
lib9
In file included from /usr/include/inttypes.h:20:0,
                 from /tmp/go-1.4/include/u.h:60,
                 from /tmp/go-1.4/src/lib9/atoi.c:28:
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications      and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
In file included from /usr/include/inttypes.h:20:0,
                 from /tmp/go-1.4/include/u.h:60,
                 from /tmp/go-1.4/src/lib9/_exits.c:28:
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications      and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
In file included from /usr/include/inttypes.h:20:0,
                 from /tmp/go-1.4/include/u.h:60,
                 from /tmp/go-1.4/src/lib9/_p9dir.c:28:
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications      and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m64 -I /tmp/go-1.4/include -DPLAN9PORT -I /tmp/go-1.4/src/lib9 -o $WORK/atoi.o /tmp/go-1.4/src/lib9/atoi.c
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m64 -I /tmp/go-1.4/include -DPLAN9PORT -I /tmp/go-1.4/src/lib9 -o $WORK/_p9dir.o /tmp/go-1.4/src/lib9/_p9dir.c
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m64 -I /tmp/go-1.4/include -DPLAN9PORT -I /tmp/go-1.4/src/lib9 -o $WORK/_exits.o /tmp/go-1.4/src/lib9/_exits.c
In file included from /usr/include/inttypes.h:20:0,
                 from /tmp/go-1.4/include/u.h:60,
                 from /tmp/go-1.4/src/lib9/await.c:31:
/opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications      and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m64 -I /tmp/go-1.4/include -DPLAN9PORT -I /tmp/go-1.4/src/lib9 -o $WORK/await.o /tmp/go-1.4/src/lib9/await.c

I wonder what process should I follow in order to get this feature out of go to cross compile on Solaris 10?

Thanks a lot.


在 2017年5月23日星期二 UTC-4下午12:35:03,Aram Hăvărneanu写道:

Aram Hăvărneanu

unread,
Jul 16, 2017, 6:41:33 PM7/16/17
to heng....@gmail.com, golang-dev, Mukesh Kapoor, Dave Cheney, Ian Lance Taylor
Unfortunately the standard Go distribution requires Solaris 11 or
later, or derivatives like illumos. It doesn't work on Solaris 10
because it uses APIs only available on Solaris 11, like event ports.

--
Aram Hăvărneanu

Shawn Walker-Salas

unread,
Jul 17, 2017, 12:00:00 PM7/17/17
to heng....@gmail.com, golang-dev, mu...@yahoo.com, da...@cheney.net, ia...@golang.org
Support for Solaris 10 isn't planned or being worked on, considering
that Oracle Premier Support for it ends January 2018.

With that said, your problem is likely with compilation mode. That is,
I suspect you need something like "-std=gnu99" in the flags passed to
the compiler above.

Solaris headers strictly conform to POSIX conformance testing (modulo
bugs of course), so something is trying to use a function or declaration
only available in C99 or later.

-Shawn

ca...@barkerzone.com

unread,
Apr 20, 2018, 8:44:24 PM4/20/18
to golang-dev
Stumbled across this old thread...  I'm considering porting a Go project to Solaris 11/SPARC. From what I can tell, I could maybe get gccgo working, but I'm using the standard Go toolchain on other targets, so it would be nice to stick with that. I see that the 4ad/go repository hasn't had any recent commits, so I'm wondering if there's still a possibility of SPARC support making it into Go. If so, I'll consider pulling the 4ad/go tree and using that for now. If not, I'll look into gccgo.

Thanks for any advice,
Casey

Ian Lance Taylor

unread,
Apr 20, 2018, 8:52:19 PM4/20/18
to ca...@barkerzone.com, golang-dev
On Fri, Apr 20, 2018 at 5:41 PM, <ca...@barkerzone.com> wrote:
>
> Stumbled across this old thread... I'm considering porting a Go project to
> Solaris 11/SPARC. From what I can tell, I could maybe get gccgo working, but
> I'm using the standard Go toolchain on other targets, so it would be nice to
> stick with that. I see that the 4ad/go repository hasn't had any recent
> commits, so I'm wondering if there's still a possibility of SPARC support
> making it into Go. If so, I'll consider pulling the 4ad/go tree and using
> that for now. If not, I'll look into gccgo.

We would be happy to accept a SPARC Solaris/11 port for the gc
toolchain, subject to the usual porting policy
(https://golang.org/wiki/PortingPolicy), but as far as I know nobody
is working on such a port today.

Last I checked gccgo already works on SPARC Solaris.

Ian

Aram Hăvărneanu

unread,
Apr 21, 2018, 6:31:11 AM4/21/18
to Ian Lance Taylor, ca...@barkerzone.com, golang-dev
> I see that the 4ad/go repository hasn't had any recent commits, so
> I'm wondering if there's still a possibility of SPARC support making
> it into Go.

My SPARC64 port was complete, passing all the tests, however, it
was based on Go 1.7-1.8. It needs to be updated to the current Go
tip, which is much, much harder than you'd think, and Oracle pulled
the funding.

It might or it might not still happen one day.

--
Aram Hăvărneanu

ayasu...@gmail.com

unread,
Sep 30, 2018, 5:56:16 PM9/30/18
to golang-dev
Understand this is an old group but still glad to see the same struggle. This thread helps me a lot though the toolchain built gave me the memory address conflict error as flows-

/**********************************/
$> /export/home/wmuser/agent/go-solaris-sparc64-bootstrap/bin # ./go
runtime: address space conflict: map(0xc420000000) = 0xffffffff7e200000
fatal error: runtime: address space conflict

runtime stack:
runtime.throw(0x74f60d, 0x1f)
        /home/ayasuda/agent/go-solaris-sparc64-bootstrap/src/runtime/panic.go:567 +0xe4 fp=0xffffffff7fffe230 sp=0xffffffff7fffe170
runtime.sysMap(0xc420000000, 0x100000, 0x0, 0x94b018)
        /home/ayasuda/agent/go-solaris-sparc64-bootstrap/src/runtime/mem_bsd.go:84 +0x1f4 fp=0xffffffff7
...

Were you referring to this branch (sparc64.go1.8) for your port? I used the branch to build out the toolchain but the bin got me the error in the env below.

My target env:
Solaris 10 10/09 s10s_u8wos_08a SPARC

Any lead is highly appreciated.

A. Yasuda

Aram Hăvărneanu

unread,
Sep 30, 2018, 6:48:48 PM9/30/18
to ayasu...@gmail.com, golang-dev
Sorry, Solaris 11+ only. Solaris 10 is not supported.

--
Aram Hăvărneanu
Reply all
Reply to author
Forward
0 new messages