Skip to content

fix: remove x86_64 rustflags from arm64 job cargo config - #60

Merged
msftsiwei merged 5 commits into
mainfrom
fix/onebranch-path-no-subdir
Apr 20, 2026
Merged

fix: remove x86_64 rustflags from arm64 job cargo config#60
msftsiwei merged 5 commits into
mainfrom
fix/onebranch-path-no-subdir

Conversation

@msftsiwei

@msftsiwei msftsiwei commented Apr 20, 2026

Copy link
Copy Markdown
Member

Problem

PR #59 correctly fixed the \s path issue (OneBranch checkout puts source at $(Build.SourcesDirectory)\s). However, build 13886498 still fails with:

LINK : fatal error LNK1246: '/CETCOMPAT' not compatible with 'ARM64' target machine

The linker command shows /DYNAMICBASE /DYNAMICBASE /CETCOMPAT — two configs being merged.

Root Cause

The arm64 job's cargo config included both [target.x86_64-pc-windows-msvc] and [target.aarch64-pc-windows-msvc] sections. The x86_64 section has /CETCOMPAT in its rustflags.

When CargoAuthenticate@0 reads s/.cargo/config.toml (which contains x86_64 rustflags with /CETCOMPAT), it writes those flags to CARGO_HOME/config.toml. Cargo then merges both configs during arm64 compilation, injecting /CETCOMPAT into the arm64 linker command — which is incompatible with ARM64.

Fix

Remove the [target.x86_64-pc-windows-msvc] section from the arm64 job's cargo config. The arm64 job only compiles aarch64-pc-windows-msvc, so it doesn't need x86_64 rustflags at all.

The x86_64 job's cargo config is unchanged (it still has both x86_64 and aarch64 sections, which is fine since x86_64 job doesn't cross-compile to arm64).

…y the source root

PR #59 incorrectly added \s suffix to $(Build.SourcesDirectory), causing
double-path like C:\__w\1\s\s\.cargo. The variable already points to
the source root directly (C:\__w\1\s), so no subdirectory suffix needed.
Copilot AI review requested due to automatic review settings April 20, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the OneBranch sign-and-release pipeline paths by removing an incorrect extra \s suffix from $(Build.SourcesDirectory), ensuring Cargo config, build outputs, signing, and packaging all point at the actual repo root.

Changes:

  • Write ADO .cargo/config.toml to $(Build.SourcesDirectory)\.cargo and update CargoAuthenticate configFile to .cargo/config.toml.
  • Update build script workingDirectory to $(Build.SourcesDirectory) for both x64 and arm64 jobs.
  • Update signing and packaging paths from .../s/target/... and .../s/README.md to .../target/... and .../README.md.
Show a summary per file
File Description
.github/workflows/sign-and-release.yml Removes the extra \s path suffix across config writing, Cargo auth, build working directories, signing search_root, and packaging inputs.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread .github/workflows/sign-and-release.yml Outdated
The arm64 cross-compile job only builds aarch64-pc-windows-msvc target,
so it does not need [target.x86_64-pc-windows-msvc] rustflags in its
cargo config. Having x86_64 rustflags (including /CETCOMPAT) in the
arm64 job's config causes CargoAuthenticate@0 to propagate them to
CARGO_HOME/config.toml, which then gets merged with the arm64 config
during compilation, resulting in:
  LNK1246: '/CETCOMPAT' not compatible with 'ARM64' target machine

Note: PR #59's \s path fixes were correct and are preserved here.
@msftsiwei msftsiwei changed the title fix: remove extra \s from paths ($(Build.SourcesDirectory) is already source root) fix: remove x86_64 rustflags from arm64 job cargo config Apr 20, 2026
Copilot AI review requested due to automatic review settings April 20, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread .github/workflows/sign-and-release.yml
Cargo runs from $(Build.SourcesDirectory)\s but finds workspace root at
$(Build.SourcesDirectory) (parent), so output goes to
$(Build.SourcesDirectory)\target\... not $(Build.SourcesDirectory)\s\target\...

Fix:
- verify workingDirectory: remove \s suffix so relative "target\..." resolves correctly
- signing search_root: remove /s/ from absolute path
- package $exePath: remove /s/ from absolute path
The x64 job must use [target.x86_64-pc-windows-msvc] with /CETCOMPAT for
BinSkim compliance. The arm64 job correctly uses only [target.aarch64-pc-windows-msvc]
without /CETCOMPAT (which is incompatible with ARM64).

Addresses Copilot review comment: restore x86_64 section for x64 job.
Copilot AI review requested due to automatic review settings April 20, 2026 20:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (4)

.github/workflows/sign-and-release.yml:195

  • signing search_root was changed to "$(Build.SourcesDirectory)/target/..." but the build runs under "$(Build.SourcesDirectory)\s" and no target-dir override is shown. This likely causes the signing task to miss the built binary; point search_root at the actual cargo output directory (typically .../s/target/...).
                  signing_profile: "external_distribution"
                  files_to_sign: "tgrep.exe"
                  search_root: "$(Build.SourcesDirectory)/target/x86_64-pc-windows-msvc/release"

.github/workflows/sign-and-release.yml:205

  • Packaging now uses $(Build.SourcesDirectory)/target/... for the exe while README is still taken from $(Build.SourcesDirectory)/s/README.md. Unless cargo output is intentionally redirected to the parent directory, the exe path should likely also be under /s/target to match where cargo builds from.
                  $zipName = "tgrep-$tag-x86_64-pc-windows-msvc.zip"
                  $exePath = "$(Build.SourcesDirectory)/target/x86_64-pc-windows-msvc/release/tgrep.exe"
                  $readmePath = "$(Build.SourcesDirectory)/s/README.md"

.github/workflows/sign-and-release.yml:312

  • Arm64 signing search_root was changed to "$(Build.SourcesDirectory)/target/..." but the build runs under "$(Build.SourcesDirectory)\s" and no target-dir override is shown. This will likely prevent the signing task from finding tgrep.exe; point search_root at the actual cargo output directory (typically .../s/target/...).
                  signing_profile: "external_distribution"
                  files_to_sign: "tgrep.exe"
                  search_root: "$(Build.SourcesDirectory)/target/aarch64-pc-windows-msvc/release"

.github/workflows/sign-and-release.yml:318

  • Arm64 packaging now references $(Build.SourcesDirectory)/target/... for the exe while README is still at $(Build.SourcesDirectory)/s/README.md. Unless cargo output is intentionally redirected to the parent directory, the exe path should likely be under /s/target to match the build workingDirectory.
                  $zipName = "tgrep-$tag-aarch64-pc-windows-msvc.zip"
                  $exePath = "$(Build.SourcesDirectory)/target/aarch64-pc-windows-msvc/release/tgrep.exe"
                  $readmePath = "$(Build.SourcesDirectory)/s/README.md"
  • Files reviewed: 1/1 changed files
  • Comments generated: 3

Comment thread .github/workflows/sign-and-release.yml
Comment thread .github/workflows/sign-and-release.yml
Comment thread .github/workflows/sign-and-release.yml
@msftsiwei
msftsiwei enabled auto-merge April 20, 2026 20:44
@msftsiwei
msftsiwei merged commit d97b955 into main Apr 20, 2026
13 of 14 checks passed
@msftsiwei
msftsiwei deleted the fix/onebranch-path-no-subdir branch April 20, 2026 20:53
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