Bug 236094 - sysutils/beats: fails to build with Go 1.12
Summary: sysutils/beats: fails to build with Go 1.12
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-elastic mailing list
URL:
Keywords:
Depends on: 236059
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-27 23:27 UTC by Jung-uk Kim
Modified: 2019-08-13 12:06 UTC (History)
10 users (show)

See Also:
bugzilla: maintainer-feedback? (elastic)
i.dani: maintainer-feedback? (zi)


Attachments
patch file (5.99 KB, patch)
2019-03-01 12:21 UTC, Dmitri Goutnik
no flags Details | Diff
patch file (6.10 KB, patch)
2019-03-05 21:47 UTC, Dmitri Goutnik
no flags Details | Diff
236094.diff (8.88 KB, patch)
2019-03-06 16:00 UTC, Palle Girgensohn
no flags Details | Diff
second attempt att fixing beats (8.21 KB, patch)
2019-03-13 09:23 UTC, Palle Girgensohn
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jung-uk Kim freebsd_committer 2019-02-27 23:27:24 UTC
Poudriere log shows:

=======================<phase: build          >============================
===>  Building for beats-6.4.2
gmake[1]: Entering directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.4.2/filebeat'
sh: [[: not found
sh: filebeat: not found
go build 
# github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system
../../src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/mknod.go:12:22: cannot use dev (type int) as type uint64 in argument to syscall.Mknod
gmake[1]: *** [../libbeat/scripts/Makefile:99: filebeat] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/beats/work/beats-6.4.2/filebeat'
*** Error code 2

Stop.
make: stopped in /usr/ports/sysutils/beats
build of sysutils/beats | beats-6.4.2 ended at Wed Feb 27 17:42:31 EST 2019
build time: 00:00:22
!!! build failure encountered !!!

Downgrading Go to the previous version, i.e., 1.11.5,1, worked around the problem for me.
Comment 1 Miroslav Lachman 2019-02-28 00:24:28 UTC
I know nothing about Go / filebeat but isn't the problem in bashism? [[ 

This Makefile [1] contains SHELL=bash which is patched by port maintainer to SHELL=sh so I gues our sh does not like 
[[ $(BEAT_NAME) == journalbeat ]]

[1] https://github.com/elastic/beats/blob/b17e12c8be44d137ec8cdaffa0a7e07b89219107/libbeat/scripts/Makefile
Comment 2 Jung-uk Kim freebsd_committer 2019-02-28 02:27:22 UTC
(In reply to Miroslav Lachman from comment #1)
> I know nothing about Go / filebeat but isn't the problem in bashism? [[

There may be a bashism issue.  However, the exact same problem existed before r493967.

With Go 1.12, the following problem appeared:

# github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system
../../src/github.com/elastic/beats/vendor/github.com/docker/docker/pkg/system/mknod.go:12:22: cannot use dev (type int) as type uint64 in argument to syscall.Mknod
Comment 3 Dmitri Goutnik 2019-02-28 15:06:25 UTC
syscall.Mknod was changed to take uint64 dev in Go 1.12 [1]

This will need to be either patched locally or moby/moby persuaded to add pkg/system/mknod_freebsd.go because even their current version [2] will require patching on our side too (unix.Mknod also takes uint64 dev on FreeBSD).

[1] https://github.com/golang/go/commit/dc6eb200dd59dfedaa5259565b8ef1aa96a39271
[2] https://github.com/moby/moby/blob/master/pkg/system/mknod.go
Comment 4 Dmitri Goutnik 2019-03-01 12:21:22 UTC
Created attachment 202477 [details]
patch file

- Unbreak build
- Remove duplicate OPTIONS definitions

QA:
  poudriere testport: OK (112a, 112i, 120a)
Comment 5 geoffroy desvernay 2019-03-04 20:17:02 UTC
tested here: thank you :)
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-03-05 17:37:14 UTC
(In reply to Dmitri Goutnik from comment #4)
Please, update patch it is in meantime marked as broken ports r494719.
Comment 7 Dmitri Goutnik 2019-03-05 21:47:47 UTC
Created attachment 202620 [details]
patch file

Remove BROKEN
Comment 8 Palle Girgensohn freebsd_committer 2019-03-06 16:00:59 UTC
Created attachment 202654 [details]
236094.diff

Hi!

I restructured the patch a bit so it applies cleanly. It builds nicely. OK to commit?

Added a fix for bashism in libbeat/scripts/Makefile as well.

I suggest pushing these changes upstreams as pull requests to each of the projects.

Palle
Comment 9 Palle Girgensohn freebsd_committer 2019-03-06 16:03:10 UTC
Oh, sorry, forgot, the last version of the patch upgrades to 6.6.1 as well.
Comment 10 Dani 2019-03-13 09:16:33 UTC
Some stuff has now already been fixed by zi. Could someone take a look at the rest? Thanks :)
Comment 11 Palle Girgensohn freebsd_committer 2019-03-13 09:23:30 UTC
Created attachment 202836 [details]
second attempt att fixing beats

Hi!

Fresh patch enclosed.

Palle
Comment 12 Ryan Steinmetz freebsd_committer freebsd_triage 2019-03-13 13:42:22 UTC
Have we submitted these patches upstream?
Comment 13 Dmitri Goutnik 2019-03-13 15:23:35 UTC
I've made (slightly more generic) pull request for PACKETBEAT build issue: https://github.com/insomniacslk/dhcp/pull/260

Other go1.12 related build fixes seem to be already made by upstream's dependencies but we'll need to patch them locally until upstream updates vendored deps.
Comment 14 Walter Schwarzenfeld freebsd_triage 2019-08-13 12:06:40 UTC
We have beats version  6.7.1. Is this still relevant?