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

Add support for bottling Portable Ruby for ARM64 Linux #19111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ZhongRuoyu
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

These are the things that I identified when playing with Portable Ruby on ARM64 Linux.

Library/Homebrew/shims/super/cc Outdated Show resolved Hide resolved
DevelopmentTools.gcc_version(compiler.to_s) >= "9.3.1"
# Out-of-line atomics are not supported out-of-the-box on all systems.
# https://learn.arm.com/learning-paths/servers-and-cloud-computing/lse/intro/
"#{generic_determine_optflags} -mno-outline-atomics"
Copy link
Member

Choose a reason for hiding this comment

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

Given we already use -march=armv8-a, is this for scenarios with a shared libgcc is used?
Is this also relevant for anything outside of Portable Ruby?

Copy link
Member Author

@ZhongRuoyu ZhongRuoyu Jan 17, 2025

Choose a reason for hiding this comment

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

This is not related to shared libgcc AFAIK; it's relevant for building all bottles with GCC >= 9.3.1 (where out-of-line atomics are enabled by default and not controlled by -march=armv8-a). I recall not being able to run binaries from a bottle built in standard CI environment (GCC 11) out-of-the-box on Ubuntu 18.04 (requires an extra package libc6-lse to be installed).

Copy link
Member

@Bo98 Bo98 Jan 17, 2025

Choose a reason for hiding this comment

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

That's interesting given https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10 implies it can determine it at runtime using a libgcc call of __aarch64_cas4_relax.

Is it elsewhere on 18.04 and not being linked? Missing from our GCC 11 build like https://bugs.gentoo.org/868018?

Copy link
Member Author

@ZhongRuoyu ZhongRuoyu Jan 17, 2025

Choose a reason for hiding this comment

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

Mmm, will need to check this. Away from keyboard at the moment but will do tonight in the weekend (sorry things got in the way).

Copy link
Member

Choose a reason for hiding this comment

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

Unless we need this to build Portable Ruby on the GitHub runner: I'd prefer if we didn't have this. Feels like something that should be formula specific.

Co-authored-by: Bo Anderson <[email protected]>
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks for this! Most of this should be good to go 🔜

@@ -46,15 +46,30 @@ def homebrew_extra_paths

def homebrew_extra_isystem_paths
paths = []
# Add paths for GCC headers when building against [email protected] because we have to use -nostdinc.
if deps.any? { |d| d.name == "[email protected]" }
# Add paths for GCC headers when building against [email protected] or [email protected]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be all versioned glibcs (glibc@.+) rather than hardcoding a list here?

DevelopmentTools.gcc_version(compiler.to_s) >= "9.3.1"
# Out-of-line atomics are not supported out-of-the-box on all systems.
# https://learn.arm.com/learning-paths/servers-and-cloud-computing/lse/intro/
"#{generic_determine_optflags} -mno-outline-atomics"
Copy link
Member

Choose a reason for hiding this comment

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

Unless we need this to build Portable Ruby on the GitHub runner: I'd prefer if we didn't have this. Feels like something that should be formula specific.

args << "-nostdinc" if @deps.include?("[email protected]")
# Add -nostdinc when building against [email protected] or [email protected] to avoid
# mixing system and brewed glibc headers.
args << "-nostdinc" if @deps.intersect?(["[email protected]", "[email protected]"])
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@@ -353,19 +354,20 @@ class Cmd
end

def ldflags_linux(args)
versioned_glibc_dep = (@deps & ["[email protected]", "[email protected]"]).first
Copy link
Member

Choose a reason for hiding this comment

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

And even more: same as above. Given how many times we're hardcoding these versions definitely feel like we should be using e.g. a consistent constant and a regex.

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