Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(cli): fix release debug symbol uploads on mac and cross builds (#86712)

Aleksander Błaszkiewiczee7d64240919
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
index 7cfe15d6dc73..50db127f868d 100644
--- a/.github/workflows/release-cli.yml
+++ b/.github/workflows/release-cli.yml
@@ -476,6 +476,13 @@ jobs:
- name: Build artifacts
env:
CARGO_PROFILE_DIST_SPLIT_DEBUGINFO: ${{ runner.os == 'macOS' && 'packed' || 'off' }}
+ # Debug symbol uploads derive their chunk id from the GNU build id,
+ # and zig's lld (used by cargo-zigbuild for cross builds) emits none
+ # by default. dist reads the ambient RUSTFLAGS and appends its own,
+ # so this composes with the musl static flags. A config.toml
+ # rustflags entry would not work: dist always sets the RUSTFLAGS
+ # env, which overrides cargo config.
+ RUSTFLAGS: ${{ runner.os == 'Linux' && '-C link-arg=-Wl,--build-id=sha1' || '' }}
run: |
# Actually do builds and make zips and whatnot
dist build ${{ needs.plan-release.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
@@ -524,9 +531,14 @@ jobs:
cp "$package_dir/posthog-cli" "$target_symbols_dir/posthog-cli"
done
+ # Cargo builds into cli/target (the cargo workspace root is cli/),
+ # while repo-root target/ only holds cargo-dist's staging area, so
+ # dSYM bundles produced by split-debuginfo live under cli/target.
+ # posthog-cli.dSYM is a symlink to a hash-named bundle in deps/,
+ # so the find must follow links and the copy must dereference.
while IFS= read -r -d '' dsym; do
- cp -R "$dsym" "$symbols_dir/$(basename "$(dirname "$dsym")")-posthog-cli.dSYM"
- done < <(find target -type d -name 'posthog-cli.dSYM' -print0)
+ cp -R -L "$dsym" "$symbols_dir/$(basename "$(dirname "$dsym")")-posthog-cli.dSYM"
+ done < <(find -L target cli/target -type d -name 'posthog-cli.dSYM' -print0)
cargo run --manifest-path cli/Cargo.toml --profile dist -- \
symbol-sets upload --directory "$symbols_dir" \
diff --git a/cli/.sampo/changesets/linux-build-id-in-release-binaries.md b/cli/.sampo/changesets/linux-build-id-in-release-binaries.md
new file mode 100644
index 000000000000..d5334bc1d266
--- /dev/null
+++ b/cli/.sampo/changesets/linux-build-id-in-release-binaries.md
@@ -0,0 +1,5 @@
+---
+cargo/posthog-cli: patch
+---
+
+Linux release binaries now embed a GNU build id, so native crash reports from the CLI can be matched to uploaded debug symbols.