Skip to content

Conversation

@CppCXY
Copy link
Member

@CppCXY CppCXY commented Dec 16, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @CppCXY, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Linux build system by introducing an optional Zig-based compilation path. This change is primarily aimed at improving compatibility with older Linux environments, specifically those running glibc 2.17. By allowing developers to opt into using Zig, the project can produce binaries that are more widely deployable across various Linux distributions, addressing common issues related to glibc versioning and C++ standard library dependencies.

Highlights

  • Zig Compiler Integration: Introduced an option to use Zig as the compiler for Linux builds, specifically targeting glibc 2.17 compatibility.
  • Conditional Build Logic: The build system now checks for the USE_ZIG environment variable to determine whether to use Zig or the default GCC for Linux compilation.
  • Compiler Wrapper Script: A new zig-cc-wrapper.sh script is used as the C/C++ compiler when Zig is enabled. This wrapper filters out the -lstdc++fs flag, which is redundant with Zig's libc++.
  • Targeted Glibc Versions: When Zig is used, specific -target flags are applied for x86_64-linux-gnu.2.17 and aarch64-linux-gnu.2.17 to ensure compatibility with older glibc environments.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for using Zig as a compiler for Linux builds, enabling targeting a specific glibc version for better compatibility. The changes are gated by a USE_ZIG environment variable. The approach is sound. I have provided a few suggestions to improve maintainability and robustness. Specifically, I've recommended refactoring some duplicated code in the Lua script and suggested improvements for the new shell script, including making it more robust and ensuring it has the correct file permissions to be executable.

@@ -0,0 +1,14 @@
#!/bin/bash

Choose a reason for hiding this comment

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

high

I have a couple of suggestions for this new script:

  1. Robustness: It's a good practice to add set -euo pipefail at the start of bash scripts. This makes them exit immediately on errors, on usage of unset variables, or on pipeline failures.

  2. Permissions: This script needs to be executable to work as a compiler wrapper. Please ensure you set the executable bit (e.g., chmod +x zig-cc-wrapper.sh) and commit this permission change. Without this, the build will fail on Linux/macOS systems.

Suggested change
#!/bin/bash
#!/bin/bash
set -euo pipefail

Comment on lines +35 to +42
elseif lm.platform == "linux-x64" then
-- Target glibc 2.17 for x86_64
lm.flags = { '-target', 'x86_64-linux-gnu.2.17' }
lm.ldflags = { '-target', 'x86_64-linux-gnu.2.17', '-lc++' }
elseif lm.platform == "linux-arm64" then
-- Target glibc 2.17 for aarch64
lm.flags = { '-target', 'aarch64-linux-gnu.2.17' }
lm.ldflags = { '-target', 'aarch64-linux-gnu.2.17', '-lc++' }

Choose a reason for hiding this comment

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

medium

There's some code duplication here for setting the compiler and linker flags for different architectures. You can refactor this to be more concise and easier to maintain by determining the target architecture first and then constructing the flags. This also makes it easier to update the glibc version in the future.

        elseif lm.platform == "linux-x64" or lm.platform == "linux-arm64" then
            local target_arch = (lm.platform == "linux-x64") and "x86_64" or "aarch64"
            local glibc_version = "2.17"
            local target = ("%s-linux-gnu.%s"):format(target_arch, glibc_version)
            lm.flags = { '-target', target }
            lm.ldflags = { '-target', target, '-lc++' }

@sumneko sumneko merged commit 0a24800 into LuaLS:master Dec 16, 2025
9 of 10 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