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

Linux compile on Debian 6. #1

Merged
merged 4 commits into from
Sep 9, 2015
Merged

Linux compile on Debian 6. #1

merged 4 commits into from
Sep 9, 2015

Conversation

tsg
Copy link
Contributor

@tsg tsg commented Sep 4, 2015

We used to compile on a recent ubuntu version, which is needed for
cross-compiling to Windows and OS X. This poses the problem that it links
against a relatively recent version of libc, so the resulting binary cannot work
on older linux distributions. To work around this issue we tried to compile
statically linked binaries. Unfortunately, statically linking against libc
breaks in part the name resolution, in particular resolving the names from
/etc/hosts.

This pull requests makes 2 Docker images: one based on ubuntu for cross
compiling to os x and windows and one based on debian 6 for compiling for Linux
(both 32 and 64 bits versions). Libpcap continues to be statically linked for
Linux.

Because the Dockerfiles have drifted quite a bit from the versions from XGO, I
moved them to this repository.

This closes elastic/beats#225.

We used to compile on a recent ubuntu version, which is needed for
cross-compiling to Windows and OS X. This poses the problem that it links
against a relatively recent version of libc, so the resulting binary cannot work
on older linux distributions. To work around this issue we tried to compile
statically linked binaries. Unfortunately, statically linking against libc
breaks in part the name resolution, in particular resolving the names from
/etc/hosts.

This pull requests makes 2 Docker images: one based on ubuntu for cross
compiling to os x and windows and one based on debian 6 for compiling for Linux
(both 32 and 64 bits versions). Libpcap continues to be statically linked for
Linux.

Because the Dockerfiles have drifted quite a bit from the versions from XGO, I
moved them to this repository.

This closes elastic/beats#225.
@tsg tsg added the review label Sep 4, 2015
@@ -0,0 +1,18 @@
FROM tudorg/xgo-deb6-1.4.2
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move this image to elastic/xog-deb6-1.4.2?

Choose a reason for hiding this comment

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

I don't think the 'elastic' namespace on docker hub is ours :-(

Copy link
Contributor

Choose a reason for hiding this comment

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

At least I don't know this guy: https://hub.docker.com/r/elastic/ I doesn't look like he needs it. Should we ask him?
Beat is taken: https://hub.docker.com/r/beat/
Beats is available: https://hub.docker.com/r/beats/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@electrical How did you do it in the past, did you use your personal account for hub.docker.com images?

Choose a reason for hiding this comment

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

I'm currently using my personal account indeed.
I'm hoping we will have an internal docker registry at some point for these kind of things

@ruflin
Copy link
Contributor

ruflin commented Sep 4, 2015

There are quite a few things commented out in the code. Not sure if you want to remove it or keep it in for the moment.


FROM debian:6

MAINTAINER Péter Szilágyi <[email protected]>
Copy link

Choose a reason for hiding this comment

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

?

@tsg
Copy link
Contributor Author

tsg commented Sep 7, 2015

@ruflin, regarding the comments, the build.sh file from xgo-image and xgo-image-deb6 have a lot of code duplication between them. I'm thinking on how to reduce that, but I prefer to do it in another PR. I'll get rid of the commented out blocks then.

tsg referenced this pull request Sep 7, 2015
@@ -0,0 +1,5 @@
#!/bin/sh

docker build -t tudorg/xgo-deb6-base base/ && \

Choose a reason for hiding this comment

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

Could you add --rm=true to the build commands? this will remove the intermediate containers after a good build to save diskspace.

@andrewkroh
Copy link
Member

When go get github.com/tsg/xgo executes during the build I am not getting the enhanced version of xgo that supports the -image flag. This is because the enhancements are not in the master branch of the fork. I think the Makefile should account for this or you could pull those changes into master of tsg/xgo.

@andrewkroh
Copy link
Member

It looks like docker/xgo-image/beats-builder/Dockerfile needs to have its FROM line changed to FROM tudorg/xgo-1.4.2.

@tsg
Copy link
Contributor Author

tsg commented Sep 7, 2015

@andrewkroh thanks, fixed.

@tsg
Copy link
Contributor Author

tsg commented Sep 7, 2015

@andrewkroh Regarding the tsg/xgo I merged the required changes in master and opened pull requests for the upstream. So it should work now, thanks for letting me know about the issue.

@urso
Copy link

urso commented Sep 8, 2015

need to run 'make deps' and 'make xgo-image' before make will work. without running 'make xgo-image' did try to download the image for me.

We might want to add some notes about building the image in the Readme or have a dependency on xgo-image in default target

urso pushed a commit that referenced this pull request Sep 9, 2015
Linux compile on Debian 6.
@urso urso merged commit fcab5d1 into elastic:master Sep 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/etc/hosts entries ignored in beta3
5 participants