-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix cross compile build #78
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
Conversation
|
My cleanup of Dockerfile.cross should let us use it for CI which will fix the build |
Cleanup dynbinary and binary builds Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
7f3e5f0 to
3ae1064
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not have parallel as a requirement?
| github.com/docker/cli/cmd/docker | ||
| export BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
|
||
| SHELL=/bin/bash parallel ::: \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need parallel?
$ make -f docker.Makefile cross
sha256:2860f619648726547325ceec0b8768f370a1973dae7f16b91d1b54d89c1e954e
./scripts/build/cross: line 7: parallel: command not found
make: *** [Makefile:28: cross] Error 127
docker.Makefile:46: recipe for target 'cross' failed
make: *** [cross] Error 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, docker.Makefile was using the wrong image!
Thanks, just pushed a fix.
|
@andrewhsu what's wrong with |
|
|
||
| ``` | ||
| $ make clean | ||
| $ make -f docker.Makefile binary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If building with docker is the default as specified in the beginning of that section, then I would make docker.Makefile the default Makefile and the in container one the secondary one.
i.e.: as an user I just want to do make, make binary or make cross directly. This is the most common behavior and doesn't force someone to have to read the README if they just want the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I understand that.
My concern is that docker.Makefile is not really a good use of make. Every target is effectively .PHONY. It is not really taking advantage of any of what Make provides. It could just as easily be a bash script, or ideally a tool that is actually designed for this use case.
We should be looking to remove docker.Makefile and replace it with something else, which is why it's named this way. We could very easily drop in a dobi.yaml for this purpose and it would provide a lot of additional benefits.
It should also (eventually) be merged with what is now circle.yml so we don't have a separate copy for CI tasks. This is not really possible with circleci, just yet.
We could, for now, create a script that wraps this make -f docker.Makefile so the instructions would be something like ./task binary ./task lint, etc. This would give us a shim to transition to new build tools and would probably be a lot more concise when what we have in docker.Makefile right now.
Since this PR provides some necessary support for building cross, I'd like to get this merged first and address that in a separate PR.
WDTY?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is blocking quite a few things, I'm fine with merging it as it is.
But I'm afraid we'll end up breaking people relying on the cli downstream if we don't update quickly afterwards.
make is the standard, but I agree it is ill fitted to deal with output depending on docker images (depending on the Dockerfiles themselves would be an improvement though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I agree make is pretty standard for some languages, but I don't see it widely used by many golang projects. If it is a standard it's not very widely adopted. I think there are a lot more issues with make beyond just handling docker images, but Ill leave that for another thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be fine with having a build.sh script instead. Not for this PR, just my 2¢.
| libltdl-dev \ | ||
| gcc-mingw-w64 \ | ||
| parallel \ | ||
| ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ; necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's necessary because of the \ on the previous line. I like this style because it lets you add items to the list, and keep it sorted, without worrying about the special case of no \ on the last line.
It's a minor thing though, and I'm fine to change it if you prefer I drop the \ and ;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️ , I'm more used to the other way around, I was just wondering if this was adding any side effect I wasn't aware off.
docker.Makefile
Outdated
|
|
||
| # build the CLI for multiple architectures using a container | ||
| .PHONY: cross | ||
| cross: build_docker_image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be build_cross_image
| # Not yet supported by gox | ||
| # linux/s390x | ||
|
|
||
| gox -output build/docker-{{.OS}}-{{.Arch}} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we print something here (and the others) telling what we're building? The compilation can take quite a time sometimes, and all we get is the sha output of the container being used (and this one is there without context). It's kind of weird to see a blank terminal and not knowing if the program is stuck or doing something.
A simple Building {x}... would be nice :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
|
Added echo about building and fixed the cross dependency. Let me know what you think about the other two |
mlaventure
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit but LGTM
|
|
||
| .PHONY: build_cross_image | ||
| build_cross_image: | ||
| @docker build -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing -q
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually left this out on purpose. I prefer to see the build output. If we get to a point where the build output is too long, it's probably a sign that we should fix our dockerfile.
What do you think? I would like to make these consistent. Should I remove -q from the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way of the other, as long as it's consistent :).
I actually prefer having the output too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, done
Remove referenced to developing on the host, we shouldn't support it. Move script/validate to scripts/validate to be consistent. Set the default target to be binary instead of clean. Signed-off-by: Daniel Nephin <dnephin@docker.com>
mlaventure
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/cc @tiborvass @andrewhsu
Yes those are normal. |
|
LGTM stuff works: |
|
LGTM I checked the osx binaries' dependencies they match with what's released. |
Uncomment TasksMax=unlimited for recent distros Upstream-commit: 33325c8a2598c94bc5136a9fe7213e3ebe152dd7 Component: packaging
Fixes #26
Fixes #75
-tags pkcs11is working for the dynbinary on linux and osx. It's not working on windows. I'm not sure if we need it on windows.The OSX cross has some warnings "was built for newer OSX version (10.11) than being linked (10.6)". I'm using the same OSX SDK as docker/docker, so I'm guessing these have existed for a while?
linux/ppc64leis broken because ofpkg/term, needs a fix inmoby/mobylinux/s390xis blocked on mitchellh/gox#85. We should just run a fork of gox to support it. However we might hit the same problem asppc64lewithpkg/term