[Store:280040]An invalid record was found in the store: Code=30

背景:

Weblogic启动AdminServer时报错,提示[Store:280040]An invalid record was found in the store: Code=30

####<Feb 24, 2020 6:59:19 PM CST> <Info> <Socket> <xxx> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541959
689> <BEA-000436> <Allocating 4 reader threads.> 
####<Feb 24, 2020 6:59:19 PM CST> <Info> <Socket> <xxx> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541959
689> <BEA-000446> <Native I/O enabled.> 
####<Feb 24, 2020 6:59:19 PM CST> <Info> <Store> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541959
693> <BEA-280008> <Opening the persistent file store "WLS_DIAGNOSTICS" for recovery: directory=/home/web8050/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/data/store/diagnostics request
edWritePolicy="Disabled" fileLockingEnabled=true driver="wlfileio3".> 
####<Feb 24, 2020 6:59:19 PM CST> <Info> <Store> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541959
700> <BEA-280103> <The persistent file store "WLS_DIAGNOSTICS" will cache in weblogic.store.io.file.direct.FileMapping[granularity=4096 io=mapped].> 
####<Feb 24, 2020 6:59:19 PM CST> <Info> <XML> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <158254195970
5> <BEA-130036> <Initializing XMLRegistry> 
####<Feb 24, 2020 6:59:20 PM CST> <Info> <Security> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541
960088> <BEA-000000> <Starting OpenJPA 1.1.1-SNAPSHOT> 
####<Feb 24, 2020 6:59:20 PM CST> <Info> <Security> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541
960252> <BEA-000000> <StoreServiceImpl.initJDO - StoreService is initialized with Id = ldap_GSLB1VBQg0atilSQQTYS3VzTxbc=> 
####<Feb 24, 2020 6:59:20 PM CST> <Info> <Security> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541
960341> <BEA-090516> <The Authenticator provider has pre-existing LDAP data.> 
####<Feb 24, 2020 6:59:20 PM CST> <Info> <Security> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1582541
960604> <BEA-090516> <The Authorizer provider has preexisting LDAP data.> 
####<Feb 24, 2020 6:59:20 PM CST> <Emergency> <Store> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <15825
41960606> <BEA-280060> <The store "WLS_DIAGNOSTICS" encountered a fatal error, and it must be shut down: weblogic.store.PersistentStoreFatalException: [Store:280040]An invalid record was found in the store: Code
=30.
weblogic.store.PersistentStoreFatalException: [Store:280040]An invalid record was found in the store: Code=30.
        at weblogic.store.io.file.BaseStoreIO.openInternal(BaseStoreIO.java:170)
        at weblogic.store.io.file.FileStoreIO.open(FileStoreIO.java:64)
        at weblogic.store.internal.PersistentStoreImpl.recoverStoreConnections(PersistentStoreImpl.java:476)
        at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:453)
        at weblogic.store.xa.PersistentStoreManagerXA.createFileStore(PersistentStoreManagerXA.java:117)
        at weblogic.diagnostics.archive.DiagnosticStoreRepository.getStore(DiagnosticStoreRepository.java:91)
        at weblogic.diagnostics.lifecycle.ArchiveLifecycleImpl.initialize(ArchiveLifecycleImpl.java:94)
        at weblogic.diagnostics.lifecycle.DiagnosticFoundationService.start(DiagnosticFoundationService.java:121)
        at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
        at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
        at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
> 
####<Feb 24, 2020 6:59:20 PM CST> <Critical> <Health> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <15825
41960610> <BEA-310006> <Critical subsystem PersistentStore.WLS_DIAGNOSTICS has failed. Setting server state to FAILED.
Reason: weblogic.store.PersistentStoreFatalException: [Store:280040]An invalid record was found in the store: Code=30.> 
####<Feb 24, 2020 6:59:20 PM CST> <Critical> <WebLogicServer> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <
> <1582541960611> <BEA-000385> <Server health failed. Reason: health of critical service 'PersistentStore.WLS_DIAGNOSTICS' failed> 
####<Feb 24, 2020 6:59:20 PM CST> <Notice> <WebLogicServer> <xxx> <AdminServer> <[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> 
<1582541960622> <BEA-000365> <Server state changed to FAILED.> 
####<Feb 24, 2020 6:59:21 PM CST> <Critical> <WebLogicServer> <xxx> <AdminServer> <main> <<WLS Kernel>> <> <> <1582541961170> <BEA-000362> <Server failed. Reason: 

There are 1 nested errors:

weblogic.diagnostics.lifecycle.DiagnosticComponentLifecycleException: weblogic.store.PersistentStoreFatalException: [Store:280040]An invalid record was found in the store: Code=30.
        at weblogic.diagnostics.lifecycle.ArchiveLifecycleImpl.initialize(ArchiveLifecycleImpl.java:97)
        at weblogic.diagnostics.lifecycle.DiagnosticFoundationService.start(DiagnosticFoundationService.java:121)
        at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
        at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
        at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: weblogic.store.PersistentStoreFatalException: [Store:280040]An invalid record was found in the store: Code=30.
        at weblogic.store.io.file.BaseStoreIO.openInternal(BaseStoreIO.java:170)
        at weblogic.store.io.file.FileStoreIO.open(FileStoreIO.java:64)
        at weblogic.store.internal.PersistentStoreImpl.recoverStoreConnections(PersistentStoreImpl.java:476)
        at weblogic.store.internal.PersistentStoreImpl.open(PersistentStoreImpl.java:453)
        at weblogic.store.xa.PersistentStoreManagerXA.createFileStore(PersistentStoreManagerXA.java:117)
        at weblogic.diagnostics.archive.DiagnosticStoreRepository.getStore(DiagnosticStoreRepository.java:91)
        at weblogic.diagnostics.lifecycle.ArchiveLifecycleImpl.initialize(ArchiveLifecycleImpl.java:94)
        ... 29 more

> 
####<Feb 24, 2020 6:59:21 PM CST> <Notice> <WebLogicServer> <xxx> <AdminServer> <main> <<WLS Kernel>> <> <> <1582541961170> <BEA-000365> <Server state changed to FAILED.> 
####<Feb 24, 2020 6:59:21 PM CST> <Error> <WebLogicServer> <xxx> <AdminServer> <main> <<WLS Kernel>> <> <> <1582541961171> <BEA-000383> <A critical service failed. The server will shu
t itself down.> 
####<Feb 24, 2020 6:59:21 PM CST> <Notice> <WebLogicServer> <xxx> <AdminServer> <main> <<WLS Kernel>> <> <> <1582541961172> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN.>
 
####<Feb 24, 2020 6:59:21 PM CST> <Info> <WebLogicServer> <xxx> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <15
82541961173> <BEA-000236> <Stopping execute threads.> 
####<Feb 24, 2020 6:59:21 PM CST> <Info> <WebLogicServer> <xxx> <AdminServer> <main> <<WLS Kernel>> <> <> <1582541961173> <BEA-000238> <Shutdown has completed.> 

解决办法:

rm -f /home/web8050/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/data/store/diagnostics/WLS_DIAGNOSTICS000000.DAT
rm -f /home/web8050/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/data/store/default/_WLS_ADMINSERVER000000.DAT
rm -f /home/web8050/Oracle/Middleware/user_projects/domains/base_domain/config/config.lok

 

 

 

PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 查找最新 Windows SDK 库路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $sdkLibPath = @( >> "${env:ProgramFiles(x86)}\Windows Kits\10\Lib", >> "${env:ProgramFiles}\Windows Kits\10\Lib" >> ) | Where-Object { Test-Path $_ } | Select-Object -First 1 (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 获取最新版本路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $latestSdkVersion = Get-ChildItem -Path $sdkLibPath | >> Where-Object { $_.Name -match '^\d+\.\d+' } | >> Sort-Object { [version]$_.Name } -Descending | >> Select-Object -First 1 (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> if ($latestSdkVersion) { >> $umPath = Join-Path $latestSdkVersion.FullName "um\x64" >> $ucrtPath = Join-Path $latestSdkVersion.FullName "ucrt\x64" >> >> # 添加到环境变量 >> $env:LIB = "$umPath;$ucrtPath;$env:LIB" >> $env:INCLUDE = "$(Join-Path $latestSdkVersion.FullName 'um');$(Join-Path $latestSdkVersion.FullName 'ucrt');$env:INCLUDE" >> >> Write-Host "已添加 LIB 路径: $umPath, $ucrtPath" >> Write-Host "已添加 INCLUDE 路径: $(Join-Path $latestSdkVersion.FullName 'um')" >> } else { >> Write-Host "错误: 未找到 Windows SDK 库路径" -ForegroundColor Red >> } 已添加 LIB 路径: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64, C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64 已添加 INCLUDE 路径: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证关键工具可用性 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $tools = @("cl.exe", "link.exe", "rc.exe", "mt.exe", "nvcc.exe") (rtx5070_env) PS E:\PyTorch_Build\pytorch> $missingTools = @() (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> foreach ($tool in $tools) { >> if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { >> $missingTools += $tool >> } >> } (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> if ($missingTools.Count -gt 0) { >> Write-Host "缺失工具: $($missingTools -join ', ')" -ForegroundColor Red >> Write-Host "当前 PATH: $env:PATH" >> } else { >> Write-Host "所有必要工具已配置" -ForegroundColor Green >> } 缺失工具: cl.exe, link.exe, rc.exe, mt.exe 当前 PATH: E:\PyTorch_Build\pytorch\rtx5070_env\Scripts;C:\Program Files\PowerShell\7;C:\Miniconda3\condabin;C:\Miniconda3\Scripts;E:\PyTorch_Build\pytorch\pytorch_env\Scripts;C:\Program Files\PowerShell\7;E:\PyTorch_Build\pytorch\pytorch_env\Scripts;C:\Program Files\PowerShell\7;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet;C:\Users\Administrator\AppData\Local\Microsoft\dotnet\;C:\Program Files\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;E:\Python310;C:\Program Files\dotnet\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;E:\Python310\Scripts;E:\Python310\Scripts;C:\Program Files\PowerShell\7\;E:\Program Files\Microsoft VS Code\bin;E:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2025.3.0\;E:\Program Files\CMake\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Incredibuild;E:\PyTorch_Build\pytorch\build\lib.win-amd64-cpython-310\torch\lib;E:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\ProgramData\chocolatey\bin;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\miniconda3\Scripts;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Users\Administrator\miniconda3\Scripts;E:\Program Files\Rust\.cargo\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\ProgramData\mingw64\mingw64\bin (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 获取 SDK 版本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $sdkVersion = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\Include" | >> Where-Object { $_.PSIsContainer -and $_.Name -match '^\d+\.\d+\.\d+' } | >> Sort-Object { [version]$_.Name } -Descending | >> Select-Object -First 1 -ExpandProperty Name (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> $cmakeArgs = @( >> "-G Ninja", >> "-DCMAKE_BUILD_TYPE=Release", >> "-DCMAKE_C_COMPILER=cl.exe", >> "-DCMAKE_CXX_COMPILER=cl.exe", >> "-DCMAKE_CUDA_COMPILER=E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe", >> "-DCMAKE_CUDA_HOST_COMPILER=cl.exe", >> "-DCMAKE_SYSTEM_VERSION=$sdkVersion", # 关键: 指定 SDK 版本 >> "-DCUDA_NVCC_FLAGS=-Xcompiler /wd4819 -gencode arch=compute_89,code=sm_89", >> "-DTORCH_CUDA_ARCH_LIST=8.9", >> "-DUSE_CUDA=ON", >> "-DUSE_NCCL=OFF", >> "-DUSE_DISTRIBUTED=OFF", >> "-DBUILD_TESTING=OFF", >> "-DBLAS=OpenBLAS", >> "-DCUDA_TOOLKIT_ROOT_DIR=E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0", >> "-DCUDNN_ROOT_DIR=E:/Program Files/NVIDIA/CUDNN/v9.12", >> "-DPYTHON_EXECUTABLE=$((Get-Command python).Source)", >> # 显式指定库路径 >> "-DCMAKE_LIBRARY_PATH=C:/Program Files (x86)/Windows Kits/10/Lib/$sdkVersion/um/x64", >> "-DCMAKE_INCLUDE_PATH=C:/Program Files (x86)/Windows Kits/10/Include/$sdkVersion/um" >> ) (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> cmake .. @cmakeArgs CMake Warning: Ignoring extra path from command line: ".." CMake Error: The source directory "E:/PyTorch_Build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 加载完整 VC 环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> & "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.4 -winsdk=10.0.22621.0 [ERROR:vcvarsall.bat] Invalid argument found : .4 [ERROR:vcvarsall.bat] Invalid argument found : -winsdk=10 [ERROR:vcvarsall.bat] Invalid argument found : .0.22621.0 [ERROR:vcvarsall.bat] Error in script usage. The correct usage is: Syntax: vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] where : [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64 [platform_type]: {empty} | store | uwp [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK. [vc_version] : {none} for latest installed VC++ compiler toolset | "14.0" for VC++ 2015 Compiler Toolset | "14.xx" for the latest 14.xx.yyyyy toolset installed (e.g. "14.11") | "14.xx.yyyyy" for a specific full version number (e.g. "14.11.25503") [spectre_mode] : {none} for libraries without spectre mitigations | "spectre" for libraries with spectre mitigations The store parameter sets environment variables to support Universal Windows Platform application development and is an alias for 'uwp'. For example: vcvarsall.bat x86_amd64 vcvarsall.bat x86_amd64 10.0.10240.0 vcvarsall.bat x86_arm uwp 10.0.10240.0 vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0 vcvarsall.bat x64 8.1 vcvarsall.bat x64 store 8.1 Please make sure either Visual Studio or C++ Build SKU is installed. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 验证环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> cl.exe cl.exe: The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> link.exe link.exe: The term 'link.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 设置 CUDA 路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDA_PATH = "E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$env:CUDA_PATH/bin;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 直接运行 CMake (rtx5070_env) PS E:\PyTorch_Build\pytorch> cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=ON ... CMake Warning: Ignoring extra path from command line: "E:/PyTorch_Build" CMake Warning: Ignoring extra path from command line: ".." -- The CXX compiler identification is GNU 13.2.0 -- The C compiler identification is GNU 13.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/ProgramData/mingw64/mingw64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/ProgramData/mingw64/mingw64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Not forcing any particular BLAS to be found CMake Warning at CMakeLists.txt:418 (message): TensorPipe cannot be used on Windows. Set it to OFF CMake Warning at CMakeLists.txt:430 (message): Libuv is not installed in current conda env. Set USE_DISTRIBUTED to OFF. Please run command 'conda install -c conda-forge libuv=1.39' to install libuv. -- Performing Test C_HAS_AVX_1 -- Performing Test C_HAS_AVX_1 - Failed -- Performing Test C_HAS_AVX_2 -- Performing Test C_HAS_AVX_2 - Success -- Performing Test C_HAS_AVX2_1 -- Performing Test C_HAS_AVX2_1 - Failed -- Performing Test C_HAS_AVX2_2 -- Performing Test C_HAS_AVX2_2 - Success -- Performing Test C_HAS_AVX512_1 -- Performing Test C_HAS_AVX512_1 - Failed -- Performing Test C_HAS_AVX512_2 -- Performing Test C_HAS_AVX512_2 - Success -- Performing Test CXX_HAS_AVX_1 -- Performing Test CXX_HAS_AVX_1 - Failed -- Performing Test CXX_HAS_AVX_2 -- Performing Test CXX_HAS_AVX_2 - Success -- Performing Test CXX_HAS_AVX2_1 -- Performing Test CXX_HAS_AVX2_1 - Failed -- Performing Test CXX_HAS_AVX2_2 -- Performing Test CXX_HAS_AVX2_2 - Success -- Performing Test CXX_HAS_AVX512_1 -- Performing Test CXX_HAS_AVX512_1 - Failed -- Performing Test CXX_HAS_AVX512_2 -- Performing Test CXX_HAS_AVX512_2 - Success -- Current compiler supports avx2 extension. Will build perfkernels. -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX512_EXTENSIONS - Success -- Current compiler supports avx512f extension. Will build fbgemm. -- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY -- Performing Test COMPILER_SUPPORTS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_SUPPORTS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_SUPPORTS_RDYNAMIC -- Performing Test COMPILER_SUPPORTS_RDYNAMIC - Failed -- Found CUDA: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0 (found version "13.0") CMake Error at E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:928 (message): Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe Build flags: Id flags: --keep;--keep-dir;tmp -v The output was: 1 nvcc fatal : Cannot find compiler 'cl.exe' in PATH Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe Build flags: -DLIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_OPERATIONS;-Xfatbin;-compress-all Id flags: --keep;--keep-dir;tmp -v The output was: 1 nvcc fatal : Cannot find compiler 'cl.exe' in PATH Call Stack (most recent call first): E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD) E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test) E:/PyTorch_Build/pytorch/rtx5070_env/Lib/site-packages/cmake/data/share/cmake-4.1/Modules/CMakeDetermineCUDACompiler.cmake:162 (CMAKE_DETERMINE_COMPILER_ID) cmake/public/cuda.cmake:47 (enable_language) cmake/Dependencies.cmake:43 (include) CMakeLists.txt:853 (include) -- Configuring incomplete, errors occurred! (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 创建测试文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> @' >> #include <iostream> >> int main() { >> std::cout << "Hello from C++ & CUDA toolchain!" << std::endl; >> return 0; >> } >> '@ | Set-Content test.cpp (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 编译测试 (rtx5070_env) PS E:\PyTorch_Build\pytorch> cl.exe test.cpp /EHsc /link kernel32.lib user32.lib gdi32.lib cl.exe: The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> if (Test-Path test.exe) { >> .\test.exe >> } else { >> Write-Host "编译失败,错误信息:" >> cl.exe test.cpp /EHsc /link kernel32.lib /v >> } 编译失败,错误信息: cl.exe: Line | 5 | cl.exe test.cpp /EHsc /link kernel32.lib /v | ~~~~~~ | The term 'cl.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 设置基本环境变量 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDA_PATH = "E:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:CUDNN_PATH = "E:/Program Files/NVIDIA/CUDNN/v9.12" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:OpenBLAS_HOME = "E:/Libs/OpenBLAS_Prebuilt" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$env:CUDA_PATH/bin;$env:OpenBLAS_HOME/bin;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 加载 Visual Studio 环境 (rtx5070_env) PS E:\PyTorch_Build\pytorch> & "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" ********************************************************************** ** Visual Studio 2022 Developer Command Prompt v17.14.13 ** Copyright (c) 2025 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 添加编译器路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $clPath = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64" (rtx5070_env) PS E:\PyTorch_Build\pytorch> $env:PATH = "$clPath;$env:PATH" (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 4. 修复 Windows SDK 库路径 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\fix_kernel32_error.ps1 .\fix_kernel32_error.ps1: The term '.\fix_kernel32_error.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 5. 验证工具链 (rtx5070_env) PS E:\PyTorch_Build\pytorch> .\verify_toolchain.ps1 .\verify_toolchain.ps1: The term '.\verify_toolchain.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 6. 准备构建目录 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Location E:\PyTorch_Build\pytorch (rtx5070_env) PS E:\PyTorch_Build\pytorch> Remove-Item build -Recurse -Force -ErrorAction SilentlyContinue (rtx5070_env) PS E:\PyTorch_Build\pytorch> New-Item -Path build -ItemType Directory | Out-Null (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Location build (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 7. 配置 CMake (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> .\cmake_configure_final.ps1 .\cmake_configure_final.ps1: The term '.\cmake_configure_final.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 8. 编译和安装 (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> if ($LASTEXITCODE -eq 0) { >> cmake --build . --config Release --parallel 8 >> if ($LASTEXITCODE -eq 0) { >> cmake --install . >> } >> } Error: not a CMake build directory (missing CMakeCache.txt) (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> # 9. 验证安装 (rtx5070_env) PS E:\PyTorch_Build\pytorch\build> python -c "import torch; print(f'PyTorch版本: {torch.__version__}'); print(f'CUDA可用: {torch.cuda.is_available()}')" PyTorch版本: 2.8.0+cpu CUDA可用: False (rtx5070_env) PS E:\PyTorch_Build\pytorch\build>
09-03
<think>我们正在处理一个XML解析错误:文档元素内容中包含无效的Unicode字符(0x16)。Unicode字符0x16是一个控制字符(属于C0控制字符),在XML 1.0规范中,除了制表符(0x09)、换行(0x0A)和回车(0x0D)之外,其他控制字符都是不允许直接出现在XML文档中的。在XML 1.1中,允许使用更多的控制字符,但需要以转义形式出现(例如使用字符实体引用或数字字符引用)。然而,0x16这个字符在XML 1.1中也是不允许直接出现的。 解决方案通常包括: 1. 在生成XML之前,清理数据,移除或替换无效字符。 2. 在解析XML时,使用解析器设置来忽略或替换这些字符(如果解析器支持)。 具体步骤: 方法一:在生成XML的源头清理数据 如果我们可以控制XML的生成过程,那么应该在数据写入XML之前过滤掉无效字符。例如,在Java中可以使用正则表达式移除无效字符: ```java String sanitized = original.replaceAll("[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]", ""); ``` 方法二:在解析时处理(如果解析器支持) 一些XML解析器提供了忽略或替换这些字符的选项。例如,在Java的SAX解析器中,可以设置属性: ```java SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); // 或者使用自定义的过滤器 ``` 但是,并非所有解析器都支持直接忽略这些字符。另一种方法是使用过滤器(FilterReader)在解析前过滤输入流。 方法三:预处理XML文件 如果我们无法修改生成过程,可以在解析前对XML文件进行预处理,移除无效字符。例如,使用命令行工具(如sed)或编写一个简单的脚本。 在Python中,我们可以这样预处理: ```python import re def remove_invalid_chars(xml_str): # 移除非法的XML 1.0字符(除了制表符、换行、回车) return re.sub(r'[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]', '', xml_str) with open('input.xml', 'r', encoding='utf-8') as f: content = f.read() clean_content = remove_invalid_chars(content) with open('clean.xml', 'w', encoding='utf-8') as f: f.write(clean_content) ``` 注意:0x16(即十进制的22)在正则表达式中可以用`\x16`表示。 方法四:使用字符实体引用 在XML中,我们可以用数字字符引用来表示控制字符,例如``。但是,XML规范不允许在元素内容中直接出现控制字符,所以这种方法并不合法。因此,唯一正确的方法是移除或替换这些字符(例如用空格或空字符串)。 根据问题中引用的错误信息(引用[1]和引用[2])并不直接相关,但我们可以参考错误处理的思想:确保消息格式正确(避免无效目标)和明确识别设备(避免歧义)。类比到XML解析,我们需要确保XML文档格式正确(移除无效字符)以避免解析错误。 因此,推荐的方法是预处理XML文件,移除无效的Unicode控制字符。 相关问题: 1. 如何检测XML文件中的无效字符? 2. 除了移除无效字符,还有其他处理方式吗? 3. 不同编程语言中如何实现XML无效字符的过滤? 4. XML 1.0和XML 1.1在字符处理上有什么不同?</think>### 解决 XML 解析错误:无效 Unicode 字符 (0x16) XML 规范(XML 1.0 和 1.1)严格限制元素内容中允许的 Unicode 字符。字符 `0x16`(SYNCHRONOUS IDLE,十进制 22)属于 **C0 控制字符**(`0x00-0x1F`),在 XML 中是非法的(除制表符 `0x09`、换行 `0x0A` 和回车 `0x0D` 外)。以下是修复方法: --- #### 方法 1:预处理 XML 数据(推荐) 在解析前移除非法字符: ```python import re def clean_xml(xml_str): # 移除非法的 C0 控制字符(保留制表符、换行、回车) return re.sub(r'[\x00-\x08\x0B\x0C\x0E-\x1F]', '', xml_str) with open("input.xml", "r", encoding="utf-8") as f: dirty_xml = f.read() clean_xml = clean_xml(dirty_xml) # 解析 clean_xml ``` --- #### 方法 2:解析时过滤(依赖解析器) 部分 XML 库支持过滤非法字符: - **Java (SAX)**: ```java SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); parser.parse(input, handler); // 启用 FEATURE_SECURE_PROCESSING 的解析器会自动过滤 ``` - **Python (lxml)**: ```python from lxml import etree parser = etree.XMLParser(recover=True) # 尝试恢复模式 tree = etree.parse("input.xml", parser) ``` --- #### 方法 3:修改数据源 如果控制 XML 生成: 1. **替换非法字符**:将 `0x16` 转换为合法字符(如空格) 2. **编码转义**:使用 Unicode 转义序列 `\u0016`(需确保解析器支持) --- #### 错误原因分析 - `0x16` 通常来自二进制文件误存为文本、编码错误或通信协议残留[^1]。 - XML 规范明确定义合法字符范围(Char 生产规则),控制字符违反格式约束[^2]。 --- ### 相关问题 1. 如何批量检测 XML 文件中的非法 Unicode 字符? 2. 不同编程语言(Java/Python/C#)中哪些 XML 解析器支持自动过滤控制字符? 3. XML 1.0 和 XML 1.1 在字符处理规则上有哪些关键区别? 4. 如何防止数据源生成包含控制字符的 XML? [^1]: The format of the specified message destination is invalid. [^^2]: The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值