Skip to content

main下最新版本Windows下编译运行不成功 #2833

@TangLaoya

Description

@TangLaoya

Windows server 2019离线环境,纯CPU。
使用附件所示脚本setup_clawcode_offline.ps1编译后,在D:\claw-code\rust\target\release下生成claw.exe
运行:
PS C:\AI_research\Quad_bipartite_label_AI> C:\claude_code\claw\clawcode\claw-code\rust\target\release\claw init
Init
Project C:\AI_research\Quad_bipartite_label_AI
.claw/ created
.claw.json created
.gitignore created
CLAUDE.md skipped (already exists)
Next step Review and tailor the generated guidance

PS C:\AI_research\Quad_bipartite_label_AI> C:\claude_code\claw\clawcode\claw-code\rust\target\release\claw
�[38;5;196m██████╗██╗ █████╗ ██╗ ██╗
██╔════╝██║ ██╔══██╗██║ ██║
██║ ██║ ███████║██║ █╗ ██║
██║ ██║ ██╔══██║██║███╗██║
╚██████╗███████╗██║ ██║╚███╔███╔╝
╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝�[0m �[38;5;208mCode�[0m 🦞

�[2mModel�[0m Qwen3.6-35B-A3B-Instruct
�[2mPermissions�[0m danger-full-access
�[2mBranch�[0m unknown
�[2mWorkspace�[0m clean
�[2mDirectory�[0m C:\AI_research\Quad_bipartite_label_AI
�[2mSession�[0m session-1777451903343-0
�[2mAuto-save�[0m \?\C:\AI_research\Quad_bipartite_label_AI.claw\sessions\ff54a51b09285dd9\session-1777451903343-0.jsonl

Type �[1m/help�[0m for commands · �[1m/status�[0m for live context · �[2m/resume latest�[0m jumps back to the newest session · �[1m/diff�[0m then �[1m/commit�[0m to ship · �[2mTab�[0m for workflow completions · �[2mShift+Enter�[0m for newline
Connected: Qwen3.6-35B-A3B-Instruct via anthropic

请严格按照CLAUDE.md自动执行所有任务,执行完一条自动输出下一条,直到全部完成。
我来开始执行任务。首先读取记忆文件和任务清单。<tool_call>
<function=read_file>
<parameter=path>
C:\AI_research\Quad_bipartite_label_AI.claw\memory\skills.md

C:\AI_research\Quad_bipartite_label_AI.claw\memory\tasks.md C:\AI_research\Quad_bipartite_label_AI.claw\memory\modifycode.md ✔ ✨ Done

很快运行结束,并未按CLAUDE.md和..claw\memory\tasks.md
的要求完成任务。

本地通过llama-server启动LLM服务:
.\llama-server.exe -t 24 --mlock --no-mmap -ngl 0 -m .\Qwen3.6-35B-A3B\Qwen3.6-35B-A3B-Instruct-Pure-GGUF\Qwen3.6-35B-A3B-q8_0.gguf --jinja --chat-template-file .\Qwen3.6-35B-A3B\Qwen3.6-35B-A3B-Instruct-Pure-GGUF\qwen3_nonthinking.jinja --skip-chat-parsing --offline -fa on --temp 0.1 --top-p 0.95 --top-k 20 --min-p 0.01 --repeat-penalty 1.0 -c 262144 --host 0.0.0.0 --port 8080 --cache-type-k q8_0 --cache-type-v q8_0 --ubatch-size 2048 --batch-size 2048 --cache-prompt

此外,还设置了以下环境变量:
ANTHROPIC_BASE_URL=http://localhost:8080/
ANTHROPIC_API_KEY=local-llama-server-no-key-required
ANTHROPIC_MODEL=Qwen3.6-35B-A3B-Instruct
CLAW_TOOL_EXECUTION=true
RUST_LOG=info

请问还需要什么设置?或者是当前版本不支持这个模型,需要使用什么模型才可以工作?

谢谢!

附:
powershell脚本
<#
.SYNOPSIS
Offline build script for Claw Code (v17.6) - removed invalid dependencies.
.DESCRIPTION
Ensures the bundled MinGW is used for all C/C++ compilation. Detects mingw64 subfolder.
Configures .env for the specified llama-server model.
.NOTES
Version: 17.6
#>

$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

function Write-Step { param([string]$m) Write-Host $m -ForegroundColor Yellow }
function Write-Success { param([string]$m) Write-Host " $m" -ForegroundColor Green }
function Write-Warning { param([string]$m) Write-Host " WARNING: $m" -ForegroundColor Yellow }
function Write-ErrorExit { param([string]$m) Write-Host " ERROR: $m" -ForegroundColor Red; exit 1 }

$BaseDir = Join-Path $PSScriptRoot "clawcode"
$DepsDir = Join-Path $BaseDir "deps"
$SourceDir = Join-Path $BaseDir "claw-code"
$RustDir = Join-Path $DepsDir "rust"
$MinGWDir = Join-Path $DepsDir "mingw"

llama-server configuration

$LlamaserverHost = "localhost"
$LlamaserverPort = "8080"
$LlamaserverModel = "Qwen3-Coder-Next-80B"

Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Claw Code - Offline Build Script v17.6" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

function Invoke-CargoCommand {
param(
[string]$Command,
[string]$Arguments,
[string]$WorkingDirectory,
[string]$LogPrefix
)
$logFile = Join-Path $env:TEMP "$LogPrefix`$([Guid]::NewGuid()).log"
$errFile = "$logFile.err"
$proc = Start-Process -FilePath $Command -ArgumentList $Arguments -WorkingDirectory $WorkingDirectory -NoNewWindow -Wait -PassThru -RedirectStandardOutput $logFile -RedirectStandardError $errFile
$success = ($proc.ExitCode -eq 0)
if (-not $success) {
Write-Host " --- Begin of error log (stdout) ---" -ForegroundColor Red
Get-Content $logFile -ErrorAction SilentlyContinue | ForEach-Object { Write-Host " $
" -ForegroundColor DarkRed }
Write-Host " --- End of stdout ---" -ForegroundColor Red
if (Test-Path $errFile) {
$errContent = Get-Content $errFile -Raw
if ($errContent.Trim()) {
Write-Host " --- Begin of stderr ---" -ForegroundColor Red
Get-Content $errFile | ForEach-Object { Write-Host " $_" -ForegroundColor DarkRed }
Write-Host " --- End of stderr ---" -ForegroundColor Red
}
}
Write-Host " Full logs saved to: $logFile and $errFile" -ForegroundColor Yellow
} else {
Remove-Item $logFile, $errFile -ErrorAction SilentlyContinue
}
return $success
}

--- 0. Verify base structure ---

Write-Step "[0/7] Verifying base structure..."
if (!(Test-Path $BaseDir)) { Write-ErrorExit "Folder not found: $BaseDir" }
if (!(Test-Path $SourceDir)) { Write-ErrorExit "Source code not found: $SourceDir" }
if (!(Test-Path $RustDir)) { Write-ErrorExit "Rust toolchain not found: $RustDir" }
if (!(Test-Path $MinGWDir)) { Write-ErrorExit "MinGW directory not found at $MinGWDir." }
Write-Success "Structure OK."

--- 1. Locate Rust toolchain and MinGW ---

Write-Step "[1/7] Setting up Rust and MinGW environment..."
$toolchainsDir = Join-Path $RustDir "toolchains"
$rustcPath = $null
$cargoPath = $null
if (Test-Path $toolchainsDir) {
$found = Get-ChildItem $toolchainsDir -Directory | Where-Object { Test-Path (Join-Path $_.FullName "bin\rustc.exe") }
if ($found) {
$realBinDir = Join-Path $found[0].FullName "bin"
$rustcPath = Join-Path $realBinDir "rustc.exe"
$cargoPath = Join-Path $realBinDir "cargo.exe"
}
}
if (-not $rustcPath) { Write-ErrorExit "Valid rustc.exe not found." }

$env:CARGO_HOME = $RustDir
$env:RUSTUP_HOME = $RustDir

--- Locate MinGW bin directory ---

$MinGWBin = $null
$possibleBins = @(
(Join-Path $MinGWDir "bin"),
(Join-Path $MinGWDir "mingw64\bin")
)
foreach ($candidate in $possibleBins) {
if (Test-Path (Join-Path $candidate "gcc.exe")) {
$MinGWBin = $candidate
break
}
}
if (-not $MinGWBin) {
Write-ErrorExit "MinGW bin directory with gcc.exe not found. Tried: $($possibleBins -join ', ')"
}

$gccExe = Join-Path $MinGWBin "gcc.exe"
$gppExe = Join-Path $MinGWBin "g++.exe"
$arExe = Join-Path $MinGWBin "ar.exe"
if (!(Test-Path $gccExe)) { Write-ErrorExit "gcc.exe not found in $MinGWBin" }

Write-Host " MinGW bin directory: $MinGWBin" -ForegroundColor Gray

Force our MinGW to be first in PATH

$env:PATH = "$MinGWBin;$realBinDir;$env:PATH"

Override compiler detection environment variables

$env:CC = $gccExe
$env:CXX = $gppExe
$env:AR = $arExe
$env:CC_x86_64_pc_windows_gnu = $gccExe
${env:CC_x86_64-pc-windows-gnu} = $gccExe
$env:CXX_x86_64_pc_windows_gnu = $gppExe
${env:CXX_x86_64-pc-windows-gnu} = $gppExe
$env:AR_x86_64_pc_windows_gnu = $arExe
${env:AR_x86_64-pc-windows-gnu} = $arExe
$env:CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = $gccExe
$env:CARGO_TARGET_X86_64_PC_WINDOWS_GNU_AR = $arExe

Write-Host " MinGW added to PATH (priority over Rust self-contained)." -ForegroundColor Gray
Write-Host " rustc version: $(& $rustcPath --version)" -ForegroundColor Gray
Write-Success "Environment ready."

--- 2. Locate Cargo cache ---

Write-Step "[2/7] Locating Cargo cache..."
$registryDir = Join-Path $RustDir "registry"
if (Test-Path $registryDir) {
Write-Success "Cache found at: $registryDir"
} else {
Write-Warning "No local Cargo cache found. Vendor may be required."
}

--- 3. Check / rebuild vendor directory ---

Write-Step "[3/7] Checking vendor directory..."
$vendorDir = Join-Path $RustDir "vendor"
$vendorValid = $false
if ((Test-Path $vendorDir) -and ((Get-ChildItem $vendorDir -Directory -ErrorAction SilentlyContinue).Count -gt 5)) {
Write-Success "Vendor directory exists and appears complete."
$vendorValid = $true
} else {
Write-Warning "Vendor missing or incomplete. Rebuilding from local cache..."
Write-Step "[3a/7] Rebuilding vendor from cache (offline)..."

Push-Location (Join-Path $SourceDir "rust")
$projectCargoDir = ".cargo"
if (Test-Path $projectCargoDir) { Remove-Item $projectCargoDir -Recurse -Force }
New-Item -ItemType Directory -Path $projectCargoDir -Force | Out-Null
@"

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
"@ | Out-File (Join-Path $projectCargoDir "config.toml") -Encoding utf8

if (Test-Path $vendorDir) { Remove-Item $vendorDir -Recurse -Force }

Write-Host "       Running cargo vendor --offline..." -ForegroundColor Gray
$success = Invoke-CargoCommand -Command $cargoPath -Arguments "vendor --offline --versioned-dirs `"$vendorDir`"" -WorkingDirectory (Get-Location).Path -LogPrefix "cargo_vendor"
if (-not $success) { Write-ErrorExit "Vendor generation failed." }
Write-Success "Vendor rebuilt successfully."
Pop-Location
$vendorValid = $true

}

--- 4. Configure Cargo for offline build ---

Write-Step "[4/7] Configuring Cargo for offline build..."
Push-Location (Join-Path $SourceDir "rust")
$projectCargoDir = ".cargo"
if (-not (Test-Path $projectCargoDir)) { New-Item -ItemType Directory -Path $projectCargoDir -Force | Out-Null }
$configPath = Join-Path $projectCargoDir "config.toml"

$vendorPathFormatted = $vendorDir -replace '\', '/'
$gccPathFormatted = $gccExe -replace '\', '/'
$arPathFormatted = $arExe -replace '\', '/'

@"

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "$vendorPathFormatted"

[target.x86_64-pc-windows-gnu]
linker = "$gccPathFormatted"
ar = "$arPathFormatted"

[net]
offline = true
"@ | Out-File -FilePath $configPath -Encoding utf8

Write-Success "Configured vendored sources and forced MinGW tools."

--- 5. Compile Claw Code (offline) ---

Write-Step "[5/7] Compiling Claw Code (release) ..."
$ClawExe = Join-Path (Get-Location) "target\release\claw.exe"
if (Test-Path $ClawExe) {
$choice = Read-Host " Binary exists. Recompile? (y/N)"
if ($choice -ne 'y' -and $choice -ne 'Y') {
Write-Success "Skipping compilation."
$skipCompile = $true
} else {
$skipCompile = $false
Remove-Item "target" -Recurse -Force -ErrorAction SilentlyContinue
}
} else {
$skipCompile = $false
}

if (-not $skipCompile) {
Write-Host " Running cargo build --release --workspace --offline..." -ForegroundColor Gray
$success = Invoke-CargoCommand -Command $cargoPath -Arguments "build --release --workspace --offline" -WorkingDirectory (Get-Location).Path -LogPrefix "cargo_build"
if (-not $success) { Write-ErrorExit "Compilation failed." }
Write-Success "Compilation successful."
} else {
Write-Host " Using existing binary." -ForegroundColor Gray
}
$fileInfo = Get-Item $ClawExe
Write-Host " Binary: $ClawExe ($([math]::Round($fileInfo.Length / 1MB, 2)) MB)" -ForegroundColor Gray

--- 6. Configure .env for llama-server ---

Write-Step "[6/7] Configuring .env file..."
$EnvFile = Join-Path (Split-Path $ClawExe -Parent) ".env"
if (Test-Path $EnvFile) {
$choice = Read-Host " .env exists. Overwrite? (y/N)"
if ($choice -ne 'y' -and $choice -ne 'Y') {
Write-Success "Keeping existing .env."
$skipEnv = $true
} else {
$skipEnv = $false
}
} else {
$skipEnv = $false
}

if (-not $skipEnv) {
@"

Claw Code Configuration for Local llama-server

Generated by setup_clawcode_offline.ps1 v17.6

ANTHROPIC_BASE_URL=http://${LlamaserverHost}:${LlamaserverPort}
ANTHROPIC_API_KEY=local-llama-server-no-key-required
ANTHROPIC_MODEL=${LlamaserverModel}
CLAW_TOOL_EXECUTION=true
RUST_LOG=info
"@ | Out-File -FilePath $EnvFile -Encoding utf8
Write-Success ".env created with model: ${LlamaserverModel}"
}

--- 7. Final summary ---

Write-Step "[7/7] Finalizing..."
Pop-Location

Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Offline setup completed successfully!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Binary: $ClawExe"
Write-Host "Config: $EnvFile"
Write-Host ""
Write-Host "To test Claw Code with your llama-server:"
Write-Host " 1. Ensure llama-server is running (as per your command):"
Write-Host " .\llama-server.exe -t 24 -c 1010000 --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144 --mlock --no-mmap -ngl 0 -m Qwen3-Coder-Next\80B\Qwen3-Coder-Next-Q4_K_M-00001-of-00004.gguf --jinja --offline -fa on --temp 0.3 --top-p 0.95 --top_k 40 --min-p 0 -n 32768 --no-context-shift --host 0.0.0.0 --port 8080"
Write-Host " 2. Navigate to the binary directory:"
Write-Host " cd $((Split-Path $ClawExe))"
Write-Host " 3. Run Claw Code doctor:"
Write-Host " .\claw.exe doctor"
Write-Host " 4. Run a test prompt:"
Write-Host " .\claw.exe prompt 'Hello, who are you?'"
Write-Host ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions