Golang on Solaris 10

Dear experts,

I am new to golang and trying to learn and take the benefits of go’s cocurrency capabilities. The thing I am trying to do is rewrite my current python application which sole purpose is to asyncroizely getting command outputs from a large amount of ssh servers. I found go is very suitable for this task. However, my pain point is I am having difficulties deploy my go applications on Solaris 10 environments using gccgo. I manage to create a simple hello world application on Solaris 10, but when I try to add more packages in my applications the go tool in gccgo is not really helping me to compile the codes. Here is some details when I try to compile the applications:

For simple hello_world applications, I can use:

/opt/csw/bin/i386-pc-solaris2.10-gccgo-5.2 -v -static-libgo -static-libgcc -o hello go_hello.go -Wl,-dy -lsocket -lnsl -lrt

This works.

when using gotool to compile i got following errors:

bash-3.2$ /opt/csw/bin/go-5.2 build --compiler gccgo
kidce.go:3:9: cannot find package “fmt” in any of:
/opt/csw/lib/src/fmt (from $GOROOT)
/export/home/eheh/go-dev/src/fmt (from $GOPATH)
package ere.us/kidce
imports runtime: cannot find package “runtime” in any of:
/opt/csw/lib/src/runtime (from $GOROOT)
/export/home/eheh/go-dev/src/runtime (from $GOPATH)

I read some articals on the internet about the go abilities for Solaris, and it cross compile feature only support later Solaris 11 versions. So this won’t help me at this moment. I just don’t understand if gccgo can support using go on Solaris 10, why its go tool not being useful or is I miss anything. I am aware that this might not be best place to ask questions about go for gcc enviroment. I just feel that maybe someone has similar experience as I have and can guild me through it.

Thank you.

It looks like the go tool isn’t able to find the standard library source. Possibly it’s not built correctly or installed in an unexpected location. Can you point to it explicitly with GOROOT?

Hi Calmh,

Thank you for your reply, I actually did this and the error is as follows:

kidce.go:4:2: cannot find package “fmt” in any of:
/opt/csw/lib/go/5.2.0/i386-pc-solaris2.10/src/fmt (from $GOROOT)
/export/home/eheh/go-dev/src/fmt (from $GOPATH)
package runtime: no buildable Go source files in /opt/csw/lib/go/5.2.0/i386-pc-solaris2.10/src/runtime

Can you find the fmt package?

If not, you could always clone the Go repository (checking out the correct version) and point `$GOROOT`` there.

Hi Nathankerr,

Yes, i can find the fmt package:

ls /opt/csw/lib/go/5.2.0/i386-pc-solaris2.10/src/
archive container debug exp go html.gox io math net os.gox regexp sort.gox sync testing.gox unicode.gox
bufio.gox crypto encoding expvar.gox hash image io.gox math.gox net.gox path regexp.gox src sync.gox text
bytes.gox crypto.gox encoding.gox flag.gox hash.gox image.gox log mime old path.gox runtime strconv.gox syscall.gox time.gox
compress database errors.gox fmt.gox html index log.gox mime.gox os reflect.gox runtime.gox strings.gox testing unicode

Solaris 10 is not supported. See:

I don’t know what those gox things are, but they don’t appear to be the source that Go expects? You should have a directory fmt with .go files in it. (And the same for all other standard library packages.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.