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 1117: Use realpath in stage1 Darwin os_self_exe_path #1127

Closed
wants to merge 1 commit into from

Conversation

binary132
Copy link

Issue: #1117

The macOS stage1 Zig compiler should look in Zig's real absolute path
for the Zig stdlib, but os_self_exe_path looked in its relative path,
which caused a symlinked Zig to be unable to find the stdlib.

This patch fixes the issue by resolving the relative path to the real
path using realpath() before copying to the output path.

Issue: ziglang#1117

The macOS stage1 Zig compiler should look in Zig's real absolute path
for the Zig stdlib, but os_self_exe_path looked in its relative path,
which caused a symlinked Zig to be unable to find the stdlib.

This patch fixes the issue by resolving the relative path to the real
path using _realpath()_ before copying to the output path.
@binary132
Copy link
Author

binary132 commented Jun 17, 2018

This implementation uses variable-length arrays, which are NOT in the ISO C++ standard, but are supported by clang and gcc, which is what macOS uses.

I'll tweak this to use the Buf struct from buffer.hpp to be more portable and idiomatic and reopen when it is ready.

@binary132 binary132 closed this Jun 18, 2018
@binary132
Copy link
Author

Reopened as #1128.

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.

None yet

2 participants