Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- uses: swatinem/rust-cache@v2
with:
key: ${{ join(matrix.targets, '-') }}
cache-provider: ${{ matrix.cache_provider }}
- name: Install dist
run: ${{ matrix.install_dist.run }}
# Get the dist-manifest
Expand Down
51 changes: 51 additions & 0 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,60 @@ ci = "github"
installers = []
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", "x86_64-pc-windows-msvc", "i686-pc-windows-msvc"]
# Distribute as tar.gz on UNIX platforms
unix-archive = ".tar.gz"
# Build artifacts on pull requests
pr-run-mode = "upload"

[dist.github-custom-runners]
x86_64-pc-windows-msvc = "windows-latest"
i686-pc-windows-msvc = "windows-latest"
x86_64-unknown-linux-gnu = "ubuntu-latest"
i686-unknown-linux-gnu = "ubuntu-latest"

[[dist.extra-artifacts]]
# Builds for tier 3 target win7
artifacts = ["dist/x86_64/elnpack-x86_64-win7-windows-msvc.zip", "dist/i686/elnpack-i686-win7-windows-msvc.zip"]

# Needs custom cargo flags, bundling of assets; builds both x86_64 and i686
build = [
"powershell",
"-NoProfile",
"-ExecutionPolicy", "Bypass",
"-Command",
'''
$ErrorActionPreference = "Stop"

# Install nightly toolchain and components
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
rustup target add x86_64-win7-windows-msvc --toolchain nightly
rustup target add i686-win7-windows-msvc --toolchain nightly

# Build 64-bit Win7 binary
cargo +nightly build -Z build-std --target x86_64-win7-windows-msvc --release

New-Item -ItemType Directory -Force -Path "dist\x86_64" | Out-Null

# Copy files and package artifact
Copy-Item "target\x86_64-win7-windows-msvc\release\elnpack.exe" "dist\x86_64\elnpack.exe"
Copy-Item "LICENSE" "dist\x86_64\LICENSE"
Copy-Item "README.md" "dist\x86_64\README.md"

Compress-Archive -Path "dist\x86_64\elnpack.exe","dist\x86_64\LICENSE","dist\x86_64\README.md" `
-DestinationPath "dist\x86_64\elnpack-x86_64-win7-windows-msvc.zip" -Force

# Build 32-bit Win7 binary
cargo +nightly build -Z build-std --target i686-win7-windows-msvc --release

New-Item -ItemType Directory -Force -Path "dist\i686" | Out-Null

# Copy files and package artifact
Copy-Item "target\i686-win7-windows-msvc\release\elnpack.exe" "dist\i686\elnpack.exe"
Copy-Item "LICENSE" "dist\i686\LICENSE"
Copy-Item "README.md" "dist\i686\README.md"

Compress-Archive -Path "dist\i686\elnpack.exe","dist\i686\LICENSE","dist\i686\README.md" `
-DestinationPath "dist\i686\elnpack-i686-win7-windows-msvc.zip" -Force
'''
]
Comment on lines +25 to +70
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, find the dist-workspace.toml file and verify its location and content
find . -name "dist-workspace.toml" -type f

Repository: Athemis/ELNPack

Length of output: 80


🏁 Script executed:

# Check if LICENSE and README.md exist in the repository root
ls -la LICENSE README.md 2>&1 | head -20

Repository: Athemis/ELNPack

Length of output: 174


🏁 Script executed:

# Look for cargo-dist configuration and version specifications
find . -maxdepth 3 -name "Cargo.toml" -o -name "Cargo.lock" -o -name "rust-toolchain.toml" | head -20

Repository: Athemis/ELNPack

Length of output: 106


🏁 Script executed:

# Search for cargo-dist version references in configuration files
rg "cargo-dist|cargo_dist" --type toml -A 3 -B 3 | head -50

Repository: Athemis/ELNPack

Length of output: 405


🏁 Script executed:

# Read full dist-workspace.toml to understand the build setup
cat -n dist-workspace.toml

Repository: Athemis/ELNPack

Length of output: 3123


🏁 Script executed:

# Check rust-toolchain.toml configuration
cat -n rust-toolchain.toml

Repository: Athemis/ELNPack

Length of output: 145


🏁 Script executed:

# Check Cargo.toml for any related configurations
cat -n Cargo.toml | head -50

Repository: Athemis/ELNPack

Length of output: 2076


🏁 Script executed:

# Search for any existing nightly usage or tier-3 target references in the codebase
rg "nightly|tier-3|win7|build-std" --type toml -i

Repository: Athemis/ELNPack

Length of output: 1343


🌐 Web query:

Rust tier-3 targets x86_64-win7-windows-msvc i686-win7-windows-msvc build-std nightly

💡 Result:

Short answer: those two targets are Tier 3 and Rust does not ship prebuilt std for them — build with nightly + -Z build-std or build rustc with the targets enabled. Example commands and important notes below.

What they are

  • x86_64-win7-windows-msvc and i686-win7-windows-msvc are Tier‑3 Windows (Win7) targets. Rust does not ship std for them. [1]

Option A — use nightly + cargo -Z build-std (quicker)

  • Install a nightly toolchain: rustup toolchain install nightly
  • Build your crate and the standard library with cargo’s unstable build-std:
    cargo +nightly build -Z build-std=std,core,alloc --target x86_64-win7-windows-msvc --release
    (replace x86_64... with i686-win7-windows-msvc as needed). [1][2]
  • Notes:
    • Using +nightly and -Z enables nightly features for the whole build; some dependencies may behave differently on nightly. [2][3]
    • You will likely need a Windows MSVC toolchain or a cross toolchain (clang-cl + lld-link) and an appropriate Windows SDK; the rustc docs show xwin/clang-cl/lld-link examples for cross-compiling. [1]

Option B — build rustc with the target (full, reproducible)

  • Add the target in your bootstrap/config (bootstrap.toml or config.toml) and build rustc with that target enabled so rustup-distributable components are produced. Example snippet:
    [build]
    build-stage = 1
    target = ["x86_64-win7-windows-msvc"]
    And set target-specific linker/cc if cross-compiling. Then build rustc. [1]

References

  • rustc platform support: *-win7-windows-msvc (explains Tier 3, build-std option, cross toolchain examples). [1]
  • rustc/platform-support general Windows MSVC guidance. [2]
  • Community discussion about build-std/nightly caveats. [3]

If you want, tell me your host OS and whether you’ll cross-compile from Linux or Windows and I’ll give the exact toolchain/linker/Windows SDK steps and the precise cargo command for i686 or x86_64.


🌐 Web query:

Rust -Z build-std flag stability documentation tier-3 targets

💡 Result:

Short answer: -Z build-std is an unstable (nightly-only) Cargo flag that tells Cargo to compile the Rust standard-library crates from source (requires the rust-src component, a nightly toolchain, and passing --target). It's commonly used when targeting tier‑3 triples (which Rust does not ship prebuilt std for), because tier‑3 targets often require you to build your own std. See the Cargo unstable docs for details and the rustc platform-support docs for the tier‑3 definition. [1][2]

Key points:

  • -Z build-std is unstable — requires nightly Cargo/rustc and the -Z flag on every invocation. [1]
  • You must install rust-src (rustup component add rust-src) and pass --target. You can limit which std crates to build (e.g. -Z build-std=core,alloc). [1]
  • Tier 3 = supported in source but not built/tested or distributed by the Rust project; std may be absent and you generally must build it yourself (hence using -Z build-std). [2]

Sources:
[1] Cargo “Unstable Features” (–Z build-std) documentation.
[2] rustc Platform Support — Target tiers (Tier 3 explanation).


Verify tier-3 target viability and PowerShell script robustness.

Your approach demonstrates commendable initiative in resurrecting Windows 7 support through custom build artifacts. However, several matters require attention:

Primary Concerns:

  1. Tier-3 Target Stability: The targets x86_64-win7-windows-msvc and i686-win7-windows-msvc are confirmed as Rust tier-3 targets with no prebuilt standard library. They require the nightly toolchain and the unstable -Z build-std flag. While this is the correct and documented approach for these targets, ensure your CI infrastructure is prepared for potential breakage when nightly updates introduce incompatibilities or when dependencies behave differently under nightly.

  2. PowerShell Script Robustness: While $ErrorActionPreference = "Stop" provides baseline error handling, consider adding explicit error handling around the cargo build commands (lines 43, 56). Cargo build failures can surface in unexpected ways, and defensive checks would improve reliability.

  3. Nightly Toolchain Risk: Your project uses stable by default (rust-toolchain.toml), which is sensible, but this build requires dynamically installing nightly on each CI run. Document and communicate to contributors that this extra-artifact build carries the inherent risk of nightly toolchain instability.

Loading