Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user precompiled libpcap #25769

Merged
merged 4 commits into from
Jun 2, 2021
Merged

Conversation

kuisathaverat
Copy link
Contributor

@kuisathaverat kuisathaverat commented May 18, 2021

What does this PR do?

This PR removes the code related to cross-compile Libpcap before to cross-compile Packetbeat, the library is already compiled in the cross-build Docker image after we merge elastic/golang-crossbuild#91

Why is it important?

This reduces the time to build Packetbeat packages and make the process more robust due to does not have to download third-party resources.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

How to test this PR locally

cd packetbeat
make crosscompile

Related issues

Relates elastic/golang-crossbuild#63
Requires elastic/golang-crossbuild#91

@kuisathaverat kuisathaverat added Team:Automation Label for the Observability productivity team build-system Issue or change affecting Mage, Make, or build scripts. labels May 18, 2021
@kuisathaverat kuisathaverat requested review from andrewkroh and a team May 18, 2021 18:18
@kuisathaverat kuisathaverat self-assigned this May 18, 2021
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 18, 2021
Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes LGTM thanks for making it.

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 18, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: kuisathaverat commented: /test

  • Start Time: 2021-06-02T09:36:14.414+0000

  • Duration: 25 min 11 sec

  • Commit: 78f7c0d

Trends 🧪

Image of Build Times

❕ Flaky test report

No test was executed to be analysed.

@urso
Copy link

urso commented May 20, 2021

CI still complains about the pcap.go :( . Sometimes import order is the problem. You might be able to fix the issue by running make check from within the packetbeat directory. It will likely fail, but update the pcap.go locally, so you can commit and push the fixed file.

@kuisathaverat
Copy link
Contributor Author

I am not sure what this is about

(linux) I have no name!@40037d58abb6:~$ make -C packetbeat check
make: Entering directory '/go/src/github.com/elastic/beats/packetbeat'
>> fmt - go-licenser: Checking for missing headers
>> fmt - go-licenser: Adding missing headers
>> fmt - goimports: Formatting Go code
>> fmt - autopep8: Formatting Python code
No fields files for module applayer
No fields files for module tcp
No fields files for module udp
Generated fields.yml for packetbeat to /go/src/github.com/elastic/beats/packetbeat/fields.yml
Generated fields.yml for packetbeat to /go/src/github.com/elastic/beats/packetbeat/fields.yml
>> Building packetbeat.yml for linux/amd64
>> Building packetbeat.reference.yml for linux/amd64
>> Building packetbeat.docker.yml for linux/amd64
exec: go list -m
>> check: Checking source code for common problems
go: downloading github.com/elastic/go-lookslike v0.3.0
# github.com/tsg/gopacket/pcap
/go/pkg/mod/github.com/tsg/gopacket@v0.0.0-20200626092518-2ab8e397a786/pcap/pcap.go:20:10: fatal error: pcap.h: No such file or directory
 #include <pcap.h>
          ^~~~~~~~
compilation terminated.

@urso
Copy link

urso commented May 25, 2021

# github.com/tsg/gopacket/pcap
/go/pkg/mod/github.com/tsg/gopacket@v0.0.0-20200626092518-2ab8e397a786/pcap/pcap.go:20:10: fatal error: pcap.h: No such file or directory
 #include <pcap.h>
          ^~~~~~~~
compilation terminated.

How was libpcap made available in the docker image? The compiler can't find the header files. We either need to adapt the include path, or we are missing some files.

@mdelapenya
Copy link
Contributor

@kuisathaverat I submitted a PR against your branch here: kuisathaverat#7

It seems there is a blank line in the packages block

@kuisathaverat
Copy link
Contributor Author

/test

1 similar comment
@kuisathaverat
Copy link
Contributor Author

/test

@kuisathaverat
Copy link
Contributor Author

/test

2 similar comments
@kuisathaverat
Copy link
Contributor Author

/test

@kuisathaverat
Copy link
Contributor Author

/test

@kuisathaverat kuisathaverat added the backport-v7.13.0 Automated backport with mergify label Jun 2, 2021
@kuisathaverat kuisathaverat added the backport-v7.14.0 Automated backport with mergify label Jun 2, 2021
@kuisathaverat kuisathaverat merged commit 4790420 into elastic:master Jun 2, 2021
mergify bot pushed a commit that referenced this pull request Jun 2, 2021
* feat: user precompiled libpcap

* Update packetbeat/scripts/mage/pcap.go

* fix: remove empty line

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
(cherry picked from commit 4790420)
mergify bot pushed a commit that referenced this pull request Jun 2, 2021
* feat: user precompiled libpcap

* Update packetbeat/scripts/mage/pcap.go

* fix: remove empty line

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
(cherry picked from commit 4790420)
kuisathaverat added a commit that referenced this pull request Jun 24, 2021
* feat: user precompiled libpcap

* Update packetbeat/scripts/mage/pcap.go

* fix: remove empty line

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
(cherry picked from commit 4790420)

Co-authored-by: Ivan Fernandez Calvo <kuisathaverat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.13.0 Automated backport with mergify backport-v7.14.0 Automated backport with mergify build-system Issue or change affecting Mage, Make, or build scripts. Team:Automation Label for the Observability productivity team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants