-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
fix cross compilation for arm platforms #43474
Conversation
9df27b7
to
566c327
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.
LGTM
Are any of these perhaps also needed to address docker-library/docker#260 ?
if-no-files-found: error | ||
retention-days: 7 | ||
|
||
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.
Should we remove the cross
stage from Jenkins once this is merged?
remove --build-arg CROSS=true
from
Line 90 in c687298
sh 'docker build --force-rm --build-arg APT_MIRROR --build-arg CROSS=true -t docker:${GIT_COMMIT} .' |
remove the cross
stage:
Lines 167 to 179 in c687298
stage("Cross") { | |
steps { | |
sh ''' | |
docker run --rm -t --privileged \ | |
-v "$WORKSPACE/bundles:/go/src/github.com/docker/docker/bundles" \ | |
--name docker-pr$BUILD_NUMBER \ | |
-e DOCKER_GITCOMMIT=${GIT_COMMIT} \ | |
-e DOCKER_GRAPHDRIVER \ | |
docker:${GIT_COMMIT} \ | |
hack/make.sh 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.
I think we should remove the CROSS
and DOCKER_CROSSPLATFORMS
args in a follow-up and rely only on --platform
like docker/cli
, buildx
so packaging will be easier and also we could remove the cross logic in the .binary
script. But that needs some work to align the dependencies in the dockerfile.
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.
We need to make sure it can be run outside of the Dockerfile / container as well; it's possible there's people using the scripts to build/cross compile directly on the host.
(I guess xx can be used in that situation as well, but may need either extra instructions or a script to set it up)
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.
We do not need a non-Dockerfile "cross-all" type target if we have no use for it ourselves. The script for the single arch would run for any target arch inside Dockerfile(and cross-all is just --platform
list). To run the same script locally it is user's responsibility that they have a cross toolchain for the target arch they are setting.
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 possible there's people using the scripts to build/cross compile directly on the host.
I don't know of distros that would use these scripts for cross-compilation, but I do know at least some distros definitely build their packages outside of containers/in their own environments.
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.
Let's continue that discussion when that change is actually made (this PR does not yet make that change)
@tonistiigi @tianon PTAL |
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@tonistiigi @tianon PTAL; this LGTY? |
My bad I see this Dockerfile downloads our static packages. Are these packages cross compiled or native? If cross then yes that should fix this issue. |
Thx! Let's get this one in |
Sandboxed build invocation with xx currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS. This was previously fixed in moby#43474 Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Sandboxed build invocation with xx currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS. This was previously fixed in moby#43474 Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Sandboxed build invocation with xx currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS. This was previously fixed in moby#43474 Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Builds currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS when doing cross-compilation. This was previously fixed in moby#43474 Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Build currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS when doing cross-compilation. This was previously fixed in moby#43474 Also removes the toolchain configuration. Following changes for cross-compilation in moby#44546, we forgot to remove the toolchain configuration that is not used anymore as xx already sets correct cc/cxx envs already. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Build currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS when doing cross-compilation. This was previously fixed in moby#43474 Also removes the toolchain configuration. Following changes for cross-compilation in moby#44546, we forgot to remove the toolchain configuration that is not used anymore as xx already sets correct cc/cxx envs already. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> (cherry picked from commit 9457042)
Build currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS when doing cross-compilation. This was previously fixed in moby#43474 Also removes the toolchain configuration. Following changes for cross-compilation in moby#44546, we forgot to remove the toolchain configuration that is not used anymore as xx already sets correct cc/cxx envs already. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> (cherry picked from commit 9457042) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
follow-up docker/docker-ce-packaging#665 (comment)
cross compilation is currently broken against some arm platforms:
- What I did
fix cross compilation for arm platforms by setting correct switches for
CGO_CFLAGS
andCGO_CXXFLAGS
flags.also adds a GitHub Action job to check cross targets work, which is not currently done in Jenkins.
- How to verify it
- Description for the changelog
fix cross compilation for arm platforms
in a follow-up we should switch to xx.
cc @thaJeztah