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: mac os x aarch64 sidecar compilation #4809

Merged
merged 6 commits into from
Sep 26, 2024

Conversation

ruseinov
Copy link
Contributor

@ruseinov ruseinov commented Sep 26, 2024

Summary of changes

Changes introduced in this pull request:

  • Fixes the Go compilation on a mac for aarch64 target.

Reference issue to close (if applicable)

Closes #4777

Other information and links

Has been tested running on calibnet. Works.

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@ruseinov ruseinov requested a review from a team as a code owner September 26, 2024 10:54
@ruseinov ruseinov requested review from lemmih and sudo-shashank and removed request for a team September 26, 2024 10:54
@ruseinov ruseinov marked this pull request as draft September 26, 2024 10:54
@ruseinov ruseinov marked this pull request as ready for review September 26, 2024 12:38
build.rs Outdated
@@ -10,6 +10,8 @@ fn main() {
if !is_docs_rs() && is_sidecar_ffi_enabled() {
println!("cargo:rustc-cfg=f3sidecar");
std::env::set_var("GOWORK", "off");
// See <https://github.com/golang/go/issues/58159>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still relevant?

Copy link
Contributor Author

@ruseinov ruseinov Sep 26, 2024

Choose a reason for hiding this comment

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

It is relevant to see why netgo is enabled. If it weren't - we could use the linked implementation instead.

Copy link
Contributor

@hanabi1224 hanabi1224 Sep 26, 2024

Choose a reason for hiding this comment

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

The issue talks about -lresolv which is not used here and I cannot find a mention of netgo

Copy link
Contributor Author

@ruseinov ruseinov Sep 26, 2024

Choose a reason for hiding this comment

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

This issue talks about both -lresolv and -tags=netgo. There isn't a pure issue as this has been mentioned for iOS builds and mac builds. This gives some context into what's happening with the linking and is the most detailed issue I have seen on the subject, though I time-boxed this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me see if I can find a direct link to a relevant comment instead.

@@ -10,6 +10,8 @@ fn main() {
if !is_docs_rs() && is_sidecar_ffi_enabled() {
println!("cargo:rustc-cfg=f3sidecar");
std::env::set_var("GOWORK", "off");
// See <https://github.com/golang/go/issues/58159>
std::env::set_var("GOFLAGS", "-tags=netgo");
Copy link
Contributor

@hanabi1224 hanabi1224 Sep 26, 2024

Choose a reason for hiding this comment

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

What's the pros and cons of using netgo? Could you add some comments on why netgo is needed for macos/arm64 and is used for linux/amd64 and linux/arm64 as well when it's not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, the are no cons to this really, especially because the sidecar does not heavily rely on name resolution.

@ruseinov ruseinov added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit e0f634e Sep 26, 2024
33 checks passed
@ruseinov ruseinov deleted the ru/fix/sidecare-osx-compilation branch September 26, 2024 13:46
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.

Fix F3 sidecar FFI build for aarch64 on MacOS
4 participants