use statically build libraries instead of syso files #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The existing
.syso
file approach was causing persistent CGO warnings for all downstream projects:This warning appeared even with
CGO_ENABLED=1
because Go's linker detected native code in.syso
files but couldn't find the CGO runtime. The warning was harmless but annoying and unprofessional for library users.Solution
Replaced
.syso
files with proper CGO bindings using pre-built platform-specific static libraries.What Changed
Removed problematic files:
*.syso
fileswrapper_*.s
)bindings_*.go
)Added platform-specific CGO bindings:
cgo_linux_amd64.go
- Linux x86_64 with AVX2/AVX512/SHANI optimizationscgo_linux_arm64.go
- Linux ARM64 with SHA2 optimizationscgo_darwin_arm64.go
- macOS Apple Silicon with SHA2 optimizationscgo_windows_amd64.go
- Windows x86_64 with AVX2/AVX512/SHANI optimizationscgo_fallback.go
- Pure Go fallback when CGO disabledPre-built static libraries:
lib/linux_amd64/libhashtree.a
- Native Linux x86_64 buildlib/linux_arm64/libhashtree.a
- Cross-compiled ARM64 buildlib/darwin_arm64/libhashtree.a
- Native macOS ARM64 buildlib/windows_amd64/libhashtree.a
- Native Windows MinGW buildGitHub Actions workflow:
Restored original CPU feature detection:
supportedCPU = hasAVX2 || hasShani || hasAVX512
supportedCPU = hasShani
(improved from originaltrue
)