# Attempting to compile filebeat in AIX

**URL:** <https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 7, 2018, 5:59pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378 "2018-08-07T17:59:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arlequin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arlequin/32/34228_2.png) [@arlequin](https://discuss.elastic.co/u/arlequin)\
**Post date:** [August 7, 2018, 5:59pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/1 "2018-08-07T17:59:04Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![trex58](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@trex58](https://discuss.elastic.co/u/trex58)\
**Post date:** [August 9, 2018, 3:49pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/2 "2018-08-09T15:49:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 10, 2018, 12:27pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/3 "2018-08-10T12:27:16Z")

</div>

@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](https://github.com/elastic/beats/pull/7803).

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

```auto
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()))
[......]

```

---

<div class="post-metadata">

**Author:** ![trex58](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@trex58](https://discuss.elastic.co/u/trex58)\
**Post date:** [August 10, 2018, 12:45pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/4 "2018-08-10T12:45:50Z")

</div>

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_](http://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_](http://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_](http://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.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 10, 2018, 1:20pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/5 "2018-08-10T13:20:13Z")

</div>

@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.

> <https://github.com/elastic/beats/blob/master/libbeat/cmd/instance/beat.go#L71>

The following lines:

> <https://github.com/elastic/beats/blob/master/libbeat/cmd/instance/beat.go#L78-L80>

> <https://github.com/elastic/beats/blob/master/filebeat/include/list.go#L29>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 7, 2018, 1:20pm UTC](https://discuss.elastic.co/t/attempting-to-compile-filebeat-in-aix/143378/6 "2018-09-07T13:20:22Z")

</div>

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