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(build): avoid lto use without lld #2

Conversation

RonaldZielaznicki
Copy link
Contributor

Depending on environment, --lto=true will result in an error.LtoRequiresLld: "LTO requires using LLD"

This occurs when use_lld is false because zig ld does not support LTO yet: ziglang/zig#8680. So, without lld, we can't LTO.

const is_macos = builtin.os.tag == .macos;
const is_windows = builtin.os.tag == .windows;
const use_lld = if (is_macos) false else if (is_windows) true else switch (optimize) {
.Debug => false,
else => true,
};
const use_lto = if (is_macos) false else if (use_lld) lto else false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went back and forth on whether to keep is_macos here. Ended up keeping it so a reader does not need to keep the additional context in mind. But can nix it if wanted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought I was thorough but didn't catch this, Thanks.

@Ultra-Code Ultra-Code merged commit 6acec0f into allyourcodebase:main Oct 29, 2024
18 checks passed
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