Compilation filebeat gccgo solaris /sparc

I am driving to compile the project filebeat going for solar / SPARC environments. Officially, Elastic tools are not supported by Solaris.

Neamoins, there is circumventenement to this problem / compile via gccgo. I actually prepare my gccgo compiler. I can compile a small project (with a single file hello.go) see below. But as soon as I try to compile the filebeat project, it does not work. can be a problem of dependencies.I do not know too much. if anyone could help me. Thank you

inspiration : inspiration

Commande : go build --compiler gccgo --gccgoflags "-v -static-libgo -Wl,-dy -lnsl -lsocket -lrt -lsendfile"

**Example 1 : **

xxxx@ubuntu:~/Documents/GCC$ cat hello.go
package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

morosus@ubuntu:~/Documents/GCC$ gccgo -m64 -v -static-libgo -o hello hello.go
-Wl,-dy -lnsl -lsocket -lrt -lsendfile
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/opt/cross/libexec/gcc/sparc-sun-solaris2.10/8.1.0/lto-wrapper
Target: sparc-sun-solaris2.10
   elf64_sparc
COLLECT_GCC_OPTIONS='-m64' '-v' '-o' 'hello' '-shared-libgcc'
xxxxxx@ub

works very well but,

**Example 2 : **

xxxx@ubuntu:~/go/src/github.com/elastic/beats/filebeat$ go build --compiler gccgo --gccgoflags "-v -static-libgo -Wl,-dy -lnsl -lsocket -lrt -lsendfile"
# github.com/elastic/beats/libbeat/plugin
../libbeat/plugin/load.go:25:2: error: import file ‘plugin’ not found
  goplugin "plugin"
  ^
../libbeat/plugin/load.go:29:12: error: reference to undefined name ‘goplugin’
  p, err := goplugin.Open(path)
            ^
# github.com/elastic/beats/vendor/github.com/elastic/go-seccomp-bpf
../vendor/github.com/elastic/go-seccomp-bpf/seccomp_linux.go:59:22: error: reference to undefined identifier ‘syscall.SockFprog’
  program := &syscall.SockFprog{

that's where I'm stuck
THANK YOU

I came across the same blogpost and the docker image based on the blogpost. I tried crosscompiling Filebeat for Solaris on SPARC the same way, but I was not successful compiling it. I am glad to share my findings with you. I had the same problems like you.

The package plugin of Golang stdlib is only supported on Linux. The build tag on the file is correctly set to only build it when GOOS is linux. You need to pass GOOS=solaris so the appropiate source files are selected. However, I was not able to pass this variable to the compiler, so couldn't compile it. I also tried GOOS=solaris go build --compiler gccgo and so on, but so far no luck.

My next move would be to try to compile Filebeat on a solaris/sparc machine, if I had access to one. :slight_smile:

1 Like

Thank you for your reply. I hope Elastic will offer an off-the-shelf solution for Solaris / Sparc. I thank you.

1 Like

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