Attempting to compile filebeat in AIX

Hello,

I've been reading the entries in this forum regarding filebeat compilation using go (gccgo) in AIX.

I am able to compile a hello-world.go program in AIX, dynamically or statically linked but no way to find a workaround compiling filebeat.

Hello,
Details:
filebeat 6.x
gcc-go on AIX 7.1
gccgo (GCC) 8.1.0. http://www.bullfreeware.com/affichage.php?id=4416

Have set the GOPATH and GOROOT correctly and I'm getting this error:
../vendor/github.com/fatih/color/color.go:21:12: error: reference to undefined identifier 'isatty.IsTerminal'
(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
[......]

and further errors.

NOTE: I've compiled filebeat for linux/ppc64le successfully.

Any advice?

Thanks.

Filebeat v5 compiled nicely with GCC 7.1 previously.
Filebeat v6.4 code now makes use of more other Go code, like Docker, generating new issues on AIX. I'm looking at them.

@arlequin @trex58 I am currently working on a PR to easily define feature at compile time, I believe that will help in your case, It's not ready yet.

We could have an include defined for your specific platform like AIX.

The following error message come from a dependency defined by our testing helpers, which seems to fallback to a windows

Have set the GOPATH and GOROOT correctly and I'm getting this error:
../vendor/github.com/fatih/color/color.go:21:12: error: reference to undefined identifier 'isatty.IsTerminal'
(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
[......]

Hi Pier Hugues
I do not understand what you mean "feature at compile time". Please elaborate.

About the issues got by arlequin, here is an explanation of some of them:

About the issues dealing with:

../vendor/ github.com/docker/docker/pkg/system/lstat_unix.go:16:9 : error: reference to undefined name 'fromStatT'
return fromStatT(s)
^
../vendor/ github.com/docker/docker/pkg/system/lstat_unix.go:16:2 : error: not enough arguments to return
return fromStatT(s)
^
../vendor/ github.com/docker/docker/pkg/system/stat_unix.go:57:9 : error: reference to undefined name 'fromStatT'
return fromStatT(s)
^

grep fromStatT ./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/* | grep func

./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_darwin.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_freebsd.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_linux.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_netbsd.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_openbsd.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_solaris.go:func fromStatT(s *syscall.Stat_t) (*StatT, error) {
./src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/stat_windows.go:func fromStatT(fi *os.FileInfo) (*StatT, error) {

The "func fromStatT" is defined only for darwin, freebsd, linux, .... operating system. Nothing for AIX.

This is an issue with Go... Implementing a function ONLY in files ending with _<OS>.go (<OS> = darwin, linux, etc) means that there is NO generic code for a new OS like aix.

So, you HAVE to add a file stat_aix.go which you can duplicate from stat_solaris.go I think .

Do the same for the other cases.

Many of your issues deal with Docker code not managing a future unknown OS by means of generic code...

Moreover, it looks like the AIX version of GCC Go provides the Lstat function implemented in lstat_unix.go :

/go/syscall/libcall_posix_largefile.go :

     // +build aix linux solaris,386 solaris,sparc

     //sys   **Lstat** (path string, stat *Stat_t) (err error)

//lstat64(path *byte, stat *Stat_t) _C_int

However, I should write some code to be sure.

@trex58 I am working on something to allow you to pick and choose what feature to have in your binaries, like having docker support or not. Because there is no point to have docker compiled in an AIX binary since this library is mostly used when you are running filebeat inside a Docker container.

Our plugin registers themselves when Go execute the init() function in the plugin package I think you could make compile on AIX by removing any plugins that use the docker library.

I do not have AIX to test it, but I believe the lines below should be removed.

The following lines:

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