-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Freebuff AVX2 Compatibility Issue on Older CPUs #1288
Description
What happened
Freebuff crashes with "Illegal instruction" error on CPUs lacking AVX2 support, despite the Bun runtime properly detecting the CPU's capabilities.
Issue Details
System Information
- CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (Ivy Bridge, 2012)
- Instruction Sets: SSE4.2, AVX (AVX1 only)
- Missing: AVX2
- OS: Windows 10/11
- PowerShell: Windows PowerShell 5.1
Error Output
PS C:\Windows\system32> freebuff --help
Bun v1.3.14 (0d9b296a) Windows x64
Windows v.win10_cu
CPU: sse42 avx
Args:
Features: no_avx2
panic: Illegal instruction at address 0x7FF6BD7DF82C
panicked during a panic. Aborting.
Attempted Workarounds (All Failed)
- Set `$env:BUN_NO_AVX2 = "1"`
- Set `$env:BUN_FALLBACK = "1"`
- Reinstalled via npm
- Tried different PowerShell versions
---
Root Cause Analysis
The Freebuff binary is compiled with **AVX2 instructions** at build time. This is a **compile-time dependency**, not a runtime decision.
Key Observations:
1. Bun's runtime correctly detects `no_avx2` as a feature
2. The crash occurs at the same memory address each time (`0x7FF6BD7DF82C`)
3. Environment variables designed for Bun's runtime don't affect the compiled binary
4. The issue is hardware-level - the CPU physically cannot execute AVX2 instructions
**AVX2 Introduction Timeline:**
- **Intel:** Haswell (4th gen, 2013)
- **AMD:** Excavator (2015) / Ryzen (2017)
- **Your CPU:** Ivy Bridge (3rd gen, 2012) - AVX1 only
---
Proposed Solutions
Build-Time Solutions
1. **Provide Multiple Build Variants**
freebuff-x64-avx2.exe (for modern CPUs)
freebuff-x64.exe (baseline, no AVX2)
freebuff-x86.exe (32-bit fallback)
2. **Use CPU Dispatch**
```cpp
// Example: Runtime CPU detection
if (__builtin_cpu_supports("avx2")) {
// Use AVX2-optimized code path
} else {
// Use fallback implementation
}
- Change Compilation Flags
// Current (problematic): -march=native -O3 -mavx2 // Better for compatibility: -march=x86-64 -O3 // Or: -march=core2 -O3
Package Manager Solutions
-
Platform-Specific Builds
// package.json example { "optionalDependencies": { "freebuff-win32-x64-avx2": "^1.0.0", "freebuff-win32-x64": "^1.0.0" } }
-
Install-Time Detection
# postinstall script if grep -q avx2 /proc/cpuinfo; then npm install freebuff-avx2 else npm install freebuff-fallback fi
Impact Assessment
Affected User Base
Significant portion of users, including:
- Enterprise environments with older hardware
- Educational institutions using lab computers
- Budget-conscious developers with older machines
- Windows users on pre-2013 hardware
Compatibility Overlap
| CPU Generation | AVX2 | Freebuff Works |
|---|---|---|
| Intel ≤3rd Gen | ❌ | ❌ |
| Intel 4th+ Gen | ✅ | ✅ |
| AMD Pre-2015 | ❌ | ❌ |
| AMD Ryzen+ | ✅ | ✅ |
Recommended Fix
Short Term
- Release an emergency build without AVX2
- Add compatibility notice to README
- Auto-detect during npm install and suggest appropriate version
Long Term
- Adopt runtime CPU dispatch for performance-critical code
- Use SIMD libraries that handle detection automatically (e.g., Google Highway, Intel IPP)
- Implement graceful fallback with clear error message:
Error: Your CPU does not support AVX2 instructions required by this build. Please install the compatibility version: npm install -g freebuff@latest-fallback - CI pipeline testing on diverse hardware
Additional Context
Detection Script for Users
# Check if your CPU supports AVX2 function Test-AVX2Support { $cpu = Get-WmiObject -Class Win32_Processor Write-Host "CPU: $($cpu.Name)" # Check via environment (Windows 10+) $env:PROCESSOR_IDENTIFIER if ($env:PROCESSOR_IDENTIFIER -match "AVX2") { return $true } # Alternative via hardware check $supported = [System.Environment]::Is64BitOperatingSystem Write-Host "Run: wmic cpu get name, capabilities" return $false }
Bun's AVX2 Support
Bun's runtime properly detects and avoids AVX2 instructions in its own code, but the Freebuff binary overrides this behavior. This is why setting BUN_NO_AVX2 doesn't help - Freebuff isn't using Bun's runtime for its CPU-specific code.
- Bun Documentation: CPU Feature Support
- Intel Intrinsics Guide: AVX2 Introduction
- GitHub Issue Template: Add CPU Compatibility Section
- Semantic Versioning: Consider major version bump for compatibility change
Priority: High
Why High Priority:
- Prevents installation on a large segment of hardware
- Silent crash gives poor user experience
- No clear error message suggesting solution
- Affects adoption in enterprise environments
Suggested Response Time: Within 24-48 hours for at least acknowledgment, within 1 week for an AVX2-free build.
Report prepared for: Freebuff Development Team
Reported by: Community User
Date: 2026年09月06日
Steps to reproduce
Freebuff Bug Report: AVX2 Compatibility Crash
Title
Freebuff crashes with Illegal Instruction error on CPUs without AVX2 support (Intel pre-Haswell / AMD pre-Ryzen)
Type
Bug Report (Binary Compatibility / Build Configuration Issue)
Priority
High - Affects a significant user base, prevents installation entirely, poor error handling
Description
Summary
Freebuff crashes immediately upon execution with a panic: Illegal instruction error on CPUs that lack AVX2 support. This affects all Intel processors prior to Haswell (4th gen, 2013) and AMD processors prior to Ryzen (2017). The Bun runtime correctly detects the CPU capabilities (Features: no_avx2) but the compiled Freebuff binary still contains AVX2 instructions.
Actual Behavior
PS C:\> freebuff --help
============================================================
Bun v1.3.14 (0d9b296a) Windows x64
Windows v.win10_cu
CPU: sse42 avx
Args:
Features: no_avx2
panic: Illegal instruction at address 0x7FF6BD7DF82C
panicked during a panic. Aborting.
Expected Behavior
- Graceful error message explaining CPU incompatibility
- OR Fallback to non-AVX2 code path
- OR Automatic installation of compatible binary variant
Environment
| Component | Detail |
|---|---|
| OS | Windows 10/11 |
| Shell | Windows PowerShell 5.1 / PowerShell 7 |
| CPU | Intel Core i7-3770 @ 3.40GHz (Ivy Bridge, 2012) |
| Instruction Sets | SSE4.2, AVX (AVX1 only) |
| Missing | AVX2 |
| Freebuff Version | 0.0.171 (latest) |
| Bun Runtime | v1.3.14 (0d9b296a) |
| Install Method | npm install -g freebuff |
Steps to Reproduce
Prerequisites
- A CPU without AVX2 support (e.g., Intel i7-3770 or older, AMD pre-2015)
- Windows OS
- Node.js and npm installed
Reproduction Steps
-
Verify CPU lacks AVX2:
wmic cpu get name
Expected output: Intel Core i7-3770 (or similar pre-Haswell CPU)
-
Install Freebuff globally:
npm install -g freebuff -
Attempt to run any command:
freebuff --helpor
freebuff --version -
Observe the crash:
panic: Illegal instruction at address 0x7FF6BD7DF82C panicked during a panic. Aborting.
Environment Variables Tested (All Failed)
$env:BUN_NO_AVX2 = "1" $env:BUN_FALLBACK = "1"
These had no effect because the issue is compile-time, not runtime.
Root Cause Analysis
Technical Explanation
The Freebuff binary is compiled with AVX2 instructions using flags like:
-march=native -O3 -mavx2
When the binary executes on a CPU without AVX2 support, the processor throws an #UD (Invalid Opcode) exception, which Bun's runtime cannot handle gracefully.
Why Environment Variables Don't Help
Bun's runtime properly detects no_avx2 and can choose to avoid AVX2 instructions in its own code. However, the Freebuff binary was already compiled with AVX2 instructions embedded - this is a build-time decision, not a runtime choice.
Affected CPU Architectures
| Architecture | AVX2 Support | Freebuff Works |
|---|---|---|
| Intel Sandy Bridge (2nd Gen) | ❌ | ❌ |
| Intel Ivy Bridge (3rd Gen) | ❌ | ❌ |
| Intel Haswell (4th Gen+) | ✅ | ✅ |
| AMD Bulldozer/Piledriver | ❌ | ❌ |
| AMD Excavator | ✅ (limited) | ❌ |
| AMD Ryzen+ | ✅ | ✅ |
| Intel Atom (pre-Goldmont) | ❌ | ❌ |
Expected Solution
Short-Term Fix (Immediate)
-
Release a non-AVX2 build:
freebuff-x64-avx2.exe (for modern CPUs - default) freebuff-x64.exe (for legacy CPUs - optional) -
Update npm package to auto-detect:
{ "optionalDependencies": { "freebuff-win32-x64-avx2": "^0.0.171", "freebuff-win32-x64-legacy": "^0.0.171" }, "scripts": { "postinstall": "node detect-cpu.js" } } -
Better error message:
Error: Your CPU does not support AVX2 instructions. Please install the compatibility version: npm install -g freebuff@legacy
Long-Term Fix
-
Implement runtime CPU dispatch:
#ifdef __AVX2__ if (__builtin_cpu_supports("avx2")) { // Use AVX2-optimized path } else { // Use scalar/SSE fallback } #endif
-
Use SIMD abstraction libraries (Google Highway, Intel IPP, etc.)
-
CI pipeline testing on multiple CPU generations
-
Build matrix in GitHub Actions with different targets
Workarounds for Users
Option 1: Use an older version
npm uninstall -g freebuff npm install -g freebuff@0.0.150
(May still contain AVX2 depending on build history)
Option 2: Build from source
git clone https://github.com/CodebuffAI/freebuff cd freebuff $env:CFLAGS = "-march=x86-64" $env:CXXFLAGS = "-march=x86-64" npm run build
Option 3: Use cloud environment
- GitHub Codespaces
- AWS Cloud9
- Remote development VM with modern CPU
Additional Context
Bun's AVX2 Handling
Bun's runtime properly handles CPU detection:
CPU: sse42 avx
Features: no_avx2
This shows Bun knows the CPU lacks AVX2. Freebuff should respect this detection or handle it more gracefully.
User Impact Estimate
Based on market share of pre-2013 hardware in enterprise environments:
- Enterprise: ~15-20% of corporate machines still use 3rd-gen Intel or older
- Educational: ~30-40% of lab computers are older models
- Individual Developers: ~10-15% use older hardware
Estimated affected users: Hundreds of thousands globally
Attachments
System Info Output
PS> wmic cpu get name Name Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz PS> systeminfo | findstr /B /C:"OS Name" /C:"OS Version" OS Name: Microsoft Windows 10 Pro OS Version: 10.0.19045 N/A Build 19045
NPM Package Info
PS> npm info freebuff freebuff@0.0.171 | MIT | deps: 1 | versions: 140 dist.tarball: https://registry.npmjs.org/freebuff/-/freebuff-0.0.171.tgz published 15 hours ago by GitHub Actions
Checklist for Developers
- Acknowledge issue within 24 hours
- Provide AVX2-free build within 1 week
- Update README with CPU requirements
- Add CPU detection during npm install
- Create GitHub issue template for hardware compatibility
- Document build flags for self-compilation
- Add CI testing on legacy hardware (or emulation)
Suggested Labels
bugcompatibilitybuild-systemhardware-issuegood-first-issue(for implementing CPU dispatch)help-wanted(for building non-AVX2 versions)
Contact Information
- Reported by: Community User
- Freebuff Version: 0.0.171
- Date: 2026年09月06日
- GitHub Issue Template Used: ✅
Thank you for addressing this critical compatibility issue.
Where does this happen?
CLI (terminal client)
Operating system
Windows
Version
freebuff@0.0.171
Model
No response
Logs or screenshots
PS C:\Windows\system32> freebuff --help ============================================================ Bun v1.3.14 (0d9b296a) Windows x64 Windows v.win10_cu CPU: sse42 avx Args: Features: no_avx2 panic: Illegal instruction at address 0x7FF6BD7DF82C panicked during a panic. Aborting. PS C:\Windows\system32> PS C:\Windows\system32> wmic cpu get name Name Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz PS C:\Windows\system32> systeminfo | findstr /B /C:"OS Name" /C:"OS Version" OS Name: Microsoft Windows 10 Pro OS Version: 10.0.19045 N/A Build 19045 PS C:\Windows\system32> npm info freebuff freebuff@0.0.171 | MIT | deps: 1 | versions: 140 The world's strongest free coding agent https://freebuff.com bin: freebuff dist .tarball: https://registry.npmjs.org/freebuff/-/freebuff-0.0.171.tgz .shasum: 61b3a9b27b603129764504698f2c58693dce419f .integrity: sha512-oiaG31gwykS270+k3rWtNW9aKtKs98ectPnOZRSL2+LF7UKnBpNTqPFi/0ibgnjDw8CVUmbWm99QaUy+qRWZaA== .unpackedSize: 64.2 kB dependencies: tar: ^7.0.0 maintainers: - jahooma <jahooma@gmail.com> - brandonatcodebuff <brandon@codebuff.com> - charleslien <charleslienspam@gmail.com> dist-tags: latest: 0.0.171 published 15 hours ago by GitHub Actions <npm-oidc-no-reply@github.com> PS C:\Windows\system32> $env:BUN_NO_AVX2 = "1" PS C:\Windows\system32> freebuff --help ============================================================ Bun v1.3.14 (0d9b296a) Windows x64 Windows v.win10_cu CPU: sse42 avx Args: Features: no_avx2 panic: Illegal instruction at address 0x7FF6BD7DF82C panicked during a panic. Aborting. PS C:\Windows\system32> PS C:\Windows\system32> $env:BUN_FALLBACK = "1" PS C:\Windows\system32> freebuff --help ============================================================ Bun v1.3.14 (0d9b296a) Windows x64 Windows v.win10_cu CPU: sse42 avx Args: Features: no_avx2 panic: Illegal instruction at address 0x7FF6BD7DF82C panicked during a panic. Aborting. PS C:\Windows\system32> PS C:\Windows\system32> npm uninstall -g freebuff removed 1 package in 125ms PS C:\Windows\system32> npm install -g freebuff added 1 package in 17s PS C:\Windows\system32> freebuff --help [CRASH - Same error as above] wmic cpu get name Name Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz