无法加载 DLL 'Microsoft.Quantum.Simulator.Runtime.dll' (CentOS 7)
Unable to load DLL 'Microsoft.Quantum.Simulator.Runtime.dll' (CentOS 7)
我正在尝试获取 Microsoft's Quantum Development Kit to work on a CentOS 7 machine. I followed the instructions 以安装 dotnet
,而琐碎的 dotnet
'Hello World' 工作正常。我还从 yum
安装了 Visual Studio,并从 Visual Studio 资源管理器安装了 Microsoft Quantum Development Kit for Visual Studio。
克隆他们的 github 仓库后。我试试:
dotnet_vm: Teleportation$ cd ~/Quantum/Samples/Teleportation/
dotnet_vm: Teleportation$ scl enable rh-dotnet21 bash
dotnet_vm: Teleportation$ dotnet run
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved. [/home/user/Quantum/Samples/Teleportation/TeleportationSample.csproj]
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved.
Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'Microsoft.Quantum.Simulator.Runtime.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMicrosoft.Quantum.Simulator.Runtime.dll: cannot open shared object file: No such file or directory
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.Init()
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator..ctor(Boolean throwOnReleasingQubitsNotInZeroState, Nullable`1 randomNumberGeneratorSeed, Boolean disableBorrowing)
at Microsoft.Quantum.Examples.Teleportation.Program.Main(String[] args) in /home/user/Quantum/Samples/Teleportation/Program.cs:line 13
看起来是同样的错误。我尝试了我认为的 linux 等效解决方案:
cp ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/runtimes/linux-x64/native/Microsoft.Quantum.Simulator.Runtime.dll ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/
我仍然遇到同样的错误。另外,我的计算机上没有启用 AVX 指令集(这可能是一个潜在问题?)。
例如
grep flags /proc/cpuinfo
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm abm
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm abm
dotnet_vm: Teleportation$
我没有任何 Windows 经验,这些看起来不像典型的 Linux 库(不是 .so 或 .a)。
问题:
我如何让它工作?
Microsoft.Quantum.Simulator.Runtime.dll
是一个普通的Linux库(.so),只是为了更容易支持跨平台而重命名。
它看起来确实与 的问题类似,但是您应该查看 Ubuntu
答案:使用 ldd
找出依赖项并安装缺少的任何东西。正如那个 post,问题很可能是你遗漏了 libgomp
,但我不熟悉 CentOS。
不启用 AVX 会使速度变慢,尤其是在处理大量量子位时,但您仍然可以 运行。
根据 El capi 的回答,我查看了链接到的库:例如
dotnet_vm: gcc-5.1.0$ ldd /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
linux-vdso.so.1 => (0x00007fff2f12b000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f1fb5fee000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1fb5cec000)
libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f1fb5ac6000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1fb56f9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1fb656a000)
为了解决关于 GLIBCXX_3.4.21 的版本控制问题,我安装了 gcc-5.1.0(及其依赖项)。然后运行代码:
dotnet_vm: Teleportation$ dotnet run
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved. [/home/user/Quantum/Samples/Teleportation/TeleportationSample.csproj]
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved.
Round 0: Sent True, got True.
Teleportation successful!!
Round 1: Sent False, got False.
Teleportation successful!!
Round 2: Sent True, got True.
Teleportation successful!!
Round 3: Sent False, got False.
Teleportation successful!!
Round 4: Sent True, got True.
Teleportation successful!!
Round 5: Sent False, got False.
Teleportation successful!!
Round 6: Sent True, got True.
Teleportation successful!!
Round 7: Sent False, got False.
Teleportation successful!!
Press Enter to continue...
成功了!
我正在尝试获取 Microsoft's Quantum Development Kit to work on a CentOS 7 machine. I followed the instructions 以安装 dotnet
,而琐碎的 dotnet
'Hello World' 工作正常。我还从 yum
安装了 Visual Studio,并从 Visual Studio 资源管理器安装了 Microsoft Quantum Development Kit for Visual Studio。
克隆他们的 github 仓库后。我试试:
dotnet_vm: Teleportation$ cd ~/Quantum/Samples/Teleportation/
dotnet_vm: Teleportation$ scl enable rh-dotnet21 bash
dotnet_vm: Teleportation$ dotnet run
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved. [/home/user/Quantum/Samples/Teleportation/TeleportationSample.csproj]
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved.
Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'Microsoft.Quantum.Simulator.Runtime.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMicrosoft.Quantum.Simulator.Runtime.dll: cannot open shared object file: No such file or directory
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.Init()
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator..ctor(Boolean throwOnReleasingQubitsNotInZeroState, Nullable`1 randomNumberGeneratorSeed, Boolean disableBorrowing)
at Microsoft.Quantum.Examples.Teleportation.Program.Main(String[] args) in /home/user/Quantum/Samples/Teleportation/Program.cs:line 13
cp ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/runtimes/linux-x64/native/Microsoft.Quantum.Simulator.Runtime.dll ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/
我仍然遇到同样的错误。另外,我的计算机上没有启用 AVX 指令集(这可能是一个潜在问题?)。
例如
grep flags /proc/cpuinfo
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm abm
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm abm
dotnet_vm: Teleportation$
我没有任何 Windows 经验,这些看起来不像典型的 Linux 库(不是 .so 或 .a)。
问题: 我如何让它工作?
Microsoft.Quantum.Simulator.Runtime.dll
是一个普通的Linux库(.so),只是为了更容易支持跨平台而重命名。
它看起来确实与 Ubuntu
答案:使用 ldd
找出依赖项并安装缺少的任何东西。正如那个 post,问题很可能是你遗漏了 libgomp
,但我不熟悉 CentOS。
不启用 AVX 会使速度变慢,尤其是在处理大量量子位时,但您仍然可以 运行。
根据 El capi 的回答,我查看了链接到的库:例如
dotnet_vm: gcc-5.1.0$ ldd /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
/home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/user/.nuget/packages/microsoft.quantum.development.kit/0.2.1809.701-preview/lib/netstandard2.0/Microsoft.Quantum.Simulator.Runtime.dll)
linux-vdso.so.1 => (0x00007fff2f12b000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f1fb5fee000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1fb5cec000)
libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f1fb5ac6000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1fb56f9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1fb656a000)
为了解决关于 GLIBCXX_3.4.21 的版本控制问题,我安装了 gcc-5.1.0(及其依赖项)。然后运行代码:
dotnet_vm: Teleportation$ dotnet run
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved. [/home/user/Quantum/Samples/Teleportation/TeleportationSample.csproj]
/home/user/Quantum/Microsoft.Quantum.Canon/Microsoft.Quantum.Canon.csproj : warning NU1603: Microsoft.Quantum.Canon depends on NETStandard.Library (>= 2.0.2-servicing-25519-03) but NETStandard.Library 2.0.2-servicing-25519-03 was not found. An approximate best match of NETStandard.Library 2.0.2 was resolved.
Round 0: Sent True, got True.
Teleportation successful!!
Round 1: Sent False, got False.
Teleportation successful!!
Round 2: Sent True, got True.
Teleportation successful!!
Round 3: Sent False, got False.
Teleportation successful!!
Round 4: Sent True, got True.
Teleportation successful!!
Round 5: Sent False, got False.
Teleportation successful!!
Round 6: Sent True, got True.
Teleportation successful!!
Round 7: Sent False, got False.
Teleportation successful!!
Press Enter to continue...
成功了!