Fix CGO_CFLAGS and static-link errors in release workflow#161
Merged
steffenfritz merged 1 commit intomainfrom Apr 1, 2026
Merged
Fix CGO_CFLAGS and static-link errors in release workflow#161steffenfritz merged 1 commit intomainfrom
steffenfritz merged 1 commit intomainfrom
Conversation
macOS: CGO_CFLAGS was set via `find ... -name yara_x_capi.h` which returns empty on M-chip runners where the install prefix differs. An empty -I flag causes clang to consume the following -arch flag as the include path, leaving 'arm64' as a dangling file argument. Fix: derive the include path from `pkg-config --variable=prefix`, matching the approach already used in buildstatus.yml. Linux: `task build` triggers the build-static subtask which links with -extldflags '-static', requiring libgcc_s.a. Ubuntu runners do not ship the static GCC runtime library. The .deb package only contains the dynamic binary, so the static build is unnecessary in CI. Fix: run `go build` directly for the dynamic binary only, skipping the static build step entirely. Both jobs now use the same YARA-X env var derivation pattern as the existing buildstatus.yml workflow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes two bugs introduced with the release workflow that surfaced during pre-release test runs (
v1.0.0-beta.5,v1.0.0-beta.6).macOS —
clang: error: no such file or directory: 'arm64'CGO_CFLAGSwas set usingfind ... -name "yara_x_capi.h"to locate the include directory. On M-chip runners the YARA-X install prefix is not always/usr/local, sofindreturned empty, leavingCGO_CFLAGS=-I(a bare-Iwith no path). Clang then consumed the next flag (-arch) as the include path, witharm64left as a dangling file argument — exactly the error observed.Fix: derive the include path from
pkg-config --variable=prefix, which is the same approach already used inbuildstatus.ymland the localsetup_mactask.Linux (amd64 + arm64) —
cannot find -lgcc_stask buildtriggers thebuild-staticsubtask, which passes-extldflags '-static ...'to the external linker. That requireslibgcc_s.a(the static GCC runtime), which Ubuntu runners do not ship. The.debpackage only contains the dynamic binary, so the static build step is unnecessary in CI.Fix: replace
task buildwith directgo buildcommands that produce the dynamic binary only, skipping the static build entirely.Test plan
build-linux amd64,build-linux arm64,build-macos-arm64releasejob attaches all three assets to the GitHub Release🤖 Generated with Claude Code