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

Replace -g flag by -gdwarf-4 for musl armhf toolchain [AP-3099] #141

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

sbmueller
Copy link
Contributor

@sbmueller sbmueller commented Nov 5, 2024

The binutils version of the toolchain seems to be too old for the compiler, expecting DWARF5. This change enforces DWARF4.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100725

@sbmueller sbmueller force-pushed the smuller/AP-3099-starling-build-error branch from 74e289a to f436104 Compare November 5, 2024 15:20
@sbmueller sbmueller marked this pull request as ready for review November 11, 2024 18:53
@sbmueller sbmueller requested review from pcrumley and a team and removed request for john-michaelburke and pcrumley November 12, 2024 07:28
@sbmueller
Copy link
Contributor Author

@swift-nav/build ping

Copy link

@jbangelo jbangelo left a comment

Choose a reason for hiding this comment

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

@sbmueller could you give a bit of context for this change? Are there certain toolchains being used that need DWARF-4 debug symbols specifically? Why only on the ARM toolchain?

How do we test bazel rule changes like this to avoid breaking builds?

@sbmueller
Copy link
Contributor Author

sbmueller commented Nov 14, 2024

@jbangelo sure. I'm working on https://swift-nav.atlassian.net/browse/AP-3099. The goal of the ticket is to resolve the CI errors in this job. One of those errors is:

/home/jenkins/.cache/bazel/_bazel_jenkins/cc4b846586278eecd893264d08018579/external/arm-linux-musleabihf/bin/../lib/gcc/arm-linux-musleabihf/11.2.0/../../../../arm-linux-musleabihf/bin/ld: DWARF error: can't find .debug_ranges section.

The Jenkins file for the stage is here, using the Docker image 571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2024-05-29, wich is a Debian 11 container.
As described in the link in the description, the error is due to a binutils version < 2.35. In the musl armhf toolchain, 2.33.1 is used.
Therefore, I simplly applied the fix suggested in the thread. I tested it in the original job and the error is resolved.

In terms of how to test, I was hoping to get more insight from discussions in this PR where this toolchain is used. I'm unfamiliar with everything around the build-working-group yet. If you have other ideas how to fix the error, I'm also happy to have a look. I guess one could also update the MUSL toolchain to binutils >= 2.35, but that seemed like the higher impact change to me.

@sbmueller sbmueller requested a review from jbangelo November 14, 2024 11:04
Copy link

@jbangelo jbangelo left a comment

Choose a reason for hiding this comment

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

Looking around I only see this particular toolchain used in one place, so if your build is fixed by this I don't see a risk of other builds getting impacted.

I do find it odd that the the toolchain we're using here isn't packaged with a matching version of binutils. I have seen something like this happen when you mix different compiler versions and whatever version of binutils your chosen distro packages, but I was under the impression that the ARM toolchain we're using here is completely self contained. Maybe that's not actually the case? Either way I think this is a pretty low risk change.

Thanks for providing the additional context @sbmueller !

@sbmueller sbmueller changed the title Replace -g flag by -gdwarf-4 for musl armhf toolchain Replace -g flag by -gdwarf-4 for musl armhf toolchain [AP-3099] Nov 15, 2024
@sbmueller sbmueller merged commit 8f17481 into main Nov 15, 2024
1 check passed
@sbmueller sbmueller deleted the smuller/AP-3099-starling-build-error branch November 15, 2024 07:17
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.

2 participants