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 dyld issue on macOS #8

Merged
merged 3 commits into from
May 30, 2023
Merged

Fix dyld issue on macOS #8

merged 3 commits into from
May 30, 2023

Conversation

lrettig
Copy link
Member

@lrettig lrettig commented May 29, 2023

Fixes #6
Replaces #7

@fasmat this clears up the issue for me. Could you give it a shot?

@lrettig
Copy link
Member Author

lrettig commented May 29, 2023

Assuming this works we should do the same in smcli

@fasmat
Copy link
Member

fasmat commented May 30, 2023

This does fix make test but imo it doesn't fix the underlying issue.

rpath is set incorrectly in spacemesh-sdk - it sets the lookup path for libed25519_bip32 to /Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/aarch64-apple-darwin/release/deps/.

Imo instead of overwriting the path in smkeys and smcli (and every other user of the library) by setting DYLD_LIBRARY_PATH we could set the right rpath in the library itself.

Since we statically link the finished binary I'm OK with this change, but if it would be dynamically linked the application couldn't be started without setting the DYLD_LIBRARY_PATH explicitly which I think is prevented by System Integrity Protection on most systems?

@fasmat
Copy link
Member

fasmat commented May 30, 2023

@lrettig
Copy link
Member Author

lrettig commented May 30, 2023

Imo instead of overwriting the path in smkeys and smcli (and every other user of the library) by setting DYLD_LIBRARY_PATH we could set the right rpath in the library itself.

See comment here: spacemeshos/spacemesh-sdk#5 (comment)

Basically, I don't think this is possible because we don't know the "right" rpath at build time. It's relative to the location of the dylib on this side when we run go build/test/....

@fasmat
Copy link
Member

fasmat commented May 30, 2023

The change did the trick, rpath is not pointing to /Users/aviv/actions-runner/_work/spacemesh-sdk/spacemesh-sdk/target/aarch64-apple-darwin/release/deps/ any more and can now be set using CGO_LDFLAGS instead of DYLD_LIBRARY_PATH.

See my comment here: spacemeshos/spacemesh-sdk#5 (comment)

@lrettig lrettig mentioned this pull request May 30, 2023
Copy link
Member

@fasmat fasmat left a comment

Choose a reason for hiding this comment

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

Thanks @lrettig! ❤️

Update SDK dependency version
@lrettig lrettig merged commit 9e842ae into main May 30, 2023
@lrettig lrettig deleted the lane-patch branch May 30, 2023 18:29
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.

go test fails on Mac M1
2 participants