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

Fix builds for arm32vX, mips64le, ppc64le, riscv64, and s390x #1003

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

yosifkit
Copy link
Member

@yosifkit yosifkit commented Feb 4, 2025

By removing the unsupported -mno-omit-leaf-frame-pointer flag when building on them

Verifying the supported arches (amd64 and arm64v8):

x86_64|aarch64) \
{{ ) else ( -}}
amd64|arm64) \
{{ ) end -}}
Copy link
Member

Choose a reason for hiding this comment

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

Im wondering if these should be in a jq function to make it more readable but other than that, all good

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was tempted to do something like golang, but couldn't decide on a good way to embed it.

I was thinking something like the following, but it'll either interrupt the mental parsing of the RUN if placed where it is used, or the flags will be far from their context if placed before the RUN.

{{
	def os_arches:
    		if is_alpine then
			{
				x86_64: " -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer",
...

Comment on lines 223 to 238
{{ if is_alpine then ( -}}
armhf|armv7|ppc64le|riscv64|s390x) \
{{ ) else ( -}}
armel|armhf|mips64el|ppc64el|riscv64|s390x) \
{{ ) end -}}
# these arches don't support "-mno-omit-leaf"
EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; \
;; \
{{ if is_alpine then ( -}}
x86) \
{{ ) else ( -}}
i386) \
{{ ) end -}}
# don't enable frame-pointers on 32bit x86 due to performance drop.
;; \
# no default
Copy link
Member

Choose a reason for hiding this comment

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

Instead of explicitly listing "everything else" like this, why not make them the default so we're only maintaining the lists of special cases?

Copy link
Member

Choose a reason for hiding this comment

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

ie:

Suggested change
{{ if is_alpine then ( -}}
armhf|armv7|ppc64le|riscv64|s390x) \
{{ ) else ( -}}
armel|armhf|mips64el|ppc64el|riscv64|s390x) \
{{ ) end -}}
# these arches don't support "-mno-omit-leaf"
EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; \
;; \
{{ if is_alpine then ( -}}
x86) \
{{ ) else ( -}}
i386) \
{{ ) end -}}
# don't enable frame-pointers on 32bit x86 due to performance drop.
;; \
# no default
{{ if is_alpine then ( -}}
x86) \
{{ ) else ( -}}
i386) \
{{ ) end -}}
# don't enable frame-pointers on 32bit x86 due to performance drop.
;; \
*) \
# other arches don't support "-mno-omit-leaf"
EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; \
;; \

By removing the unsupported `-mno-omit-leaf-frame-pointer` flag when building on them
;; \
*) \
# other arches don't support "-mno-omit-leaf"
EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; \
Copy link
Member

Choose a reason for hiding this comment

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

Looking at this one last time before merging, if we come back to this again, we should move this outside the case with a simple if [ "$arch" != i386 ]; then ... so that the amd64 | arm64 case can be just the extra -mno-... flag.

Comment on lines +214 to +216
x86_64|aarch64) \
{{ ) else ( -}}
amd64|arm64) \
Copy link
Member

Choose a reason for hiding this comment

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

Next time we touch this, we should add more whitespace here:

Suggested change
x86_64|aarch64) \
{{ ) else ( -}}
amd64|arm64) \
x86_64 | aarch64) \
{{ ) else ( -}}
amd64 | arm64) \

@tianon tianon merged commit 393cf61 into docker-library:master Feb 4, 2025
47 checks passed
@tianon tianon deleted the less-leaf branch February 4, 2025 21:54
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Feb 5, 2025
Changes:

- docker-library/python@0330f0ba: Update 3.13 to 3.13.2
- docker-library/python@9c50e071: Update 3.12 to 3.12.9
- docker-library/python@393cf619: Merge pull request docker-library/python#1003 from infosiftr/less-leaf
- docker-library/python@3186ee40: Fix builds for `arm32vX`, `mips64le`, `ppc64le`, `riscv64`, and `s390x`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants