Skip to content

🐛 fix: GLIBC version too low and linux default platform#21

Merged
SigureMo merged 1 commit intoPFCCLab:mainfrom
gouzil:fix/GLIBC_error
Jul 16, 2025
Merged

🐛 fix: GLIBC version too low and linux default platform#21
SigureMo merged 1 commit intoPFCCLab:mainfrom
gouzil:fix/GLIBC_error

Conversation

@gouzil
Copy link
Collaborator

@gouzil gouzil commented Jul 16, 2025

feat

  • 修改编译指令体积缩小 48.5%, 3.3M -> 1.7M

fix

  • 禁用 CGO 防止出现,使用者 GLIBC 版本过低导致的问题(可能)
  • 修复在不指定 platform 下出现的 is not a supported wheel on this platform. 问题(仅限 Linux)

@gouzil gouzil requested a review from Copilot July 16, 2025 15:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fix build configuration to resolve GLIBC compatibility and default Linux wheel issues while reducing binary size.

  • Updated Python platform mapping for Linux to manylinux_2_17 instead of musllinux_1_2.
  • Disabled CGO and switched from make build to direct go build with -ldflags -s -w to shrink the binary by ~48%.
  • Removed make dependency and added Git commit hash embedding in the build metadata.
Comments suppressed due to low confidence (1)

hatch_build.py:112

  • [nitpick] Consider adding unit tests or a mocking strategy to verify that the Git commit hash is correctly retrieved and embedded, and to handle cases where git rev-parse could fail or return an empty string.
        commit_hash = subprocess.run(

"go",
"build",
"-ldflags",
f"-s -w -X 'main.version={version}' -X 'main.commit={commit_hash}'",
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

The single quotes around main.version and main.commit in the -X flags will be passed literally to the Go linker. Either remove the inner quotes or split the flags into separate arguments (e.g., -X, main.version=...) so the linker receives -X main.version=... correctly.

Suggested change
f"-s -w -X 'main.version={version}' -X 'main.commit={commit_hash}'",
f"-s -w -X main.version={version} -X main.commit={commit_hash}",

Copilot uses AI. Check for mistakes.
@gouzil gouzil requested a review from SigureMo July 16, 2025 15:50
@SigureMo SigureMo changed the title fix: GLIBC version too low and linux default platform 🐛 fix: GLIBC version too low and linux default platform Jul 16, 2025
@SigureMo SigureMo merged commit 52d4f8b into PFCCLab:main Jul 16, 2025
17 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.

3 participants