microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
407 stars 81 forks source link

Build exception 'Could not load file or assembly' when building on Arm64 (Mac M3) #1848

Closed NeoSoft99 closed 2 weeks ago

NeoSoft99 commented 4 weeks ago

Describe the bug

I am trying to build the very basic "hello world" on MacBook M3 and getting exception during the build:

admin@MacBook-Pro-4 QuantumProject % dotnet build
Determining projects to restore... All projects are up-to-date for restore. Determining projects to restore... All projects are up-to-date for restore. Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/Users/admin/.nuget/packages/microsoft.quantum.sdk/0.28.302812/tools/utils/Microsoft.Quantum.Sdk.BuildConfiguration.dll'. An attempt was made to load a program with an incorrect format.

File name: '/Users/admin/.nuget/packages/microsoft.quantum.sdk/0.28.302812/tools/utils/Microsoft.Quantum.Sdk.BuildConfiguration.dll' /var/folders/5p/9jp2chgd0436fmfw51n79nqm0000gn/T/MSBuildTempadmin/tmp43af1a52c80b480d9af64c44f73fd91f.exec.cmd: line 2: 59043 Abort trap: 6 dotnet "/Users/admin/.nuget/packages/microsoft.quantum.sdk/0.28.302812/DefaultItems/../tools/utils/Microsoft.Quantum.Sdk.BuildConfiguration.dll" -v Normal --output "obj/qsharp/config/qsc.config" --QscReferences "(/Users/admin/.nuget/packages/microsoft.quantum.csharpgeneration/0.28.302812/build//../lib/net6.0/Microsoft.Quantum.CSharpGeneration.dll, -1)" /Users/admin/.nuget/packages/microsoft.quantum.sdk/0.28.302812/Sdk/Sdk.targets(68,5): error MSB3073: The command "dotnet "/Users/admin/.nuget/packages/microsoft.quantum.sdk/0.28.302812/DefaultItems/../tools/utils/Microsoft.Quantum.Sdk.BuildConfiguration.dll" -v Normal --output "obj/qsharp/config/qsc.config" --QscReferences "(/Users/admin/.nuget/packages/microsoft.quantum.csharpgeneration/0.28.302812/build//../lib/net6.0/Microsoft.Quantum.CSharpGeneration.dll, -1)"" exited with code 134. [/Users/admin/Projects/QuantumProject/QuantumProject.csproj]

Build FAILED.

I have all the prerequisites installed, and I am able to build successfully c# code on the same machine. The Microsoft.Quantum.Sdk.BuildConfiguration.dll file exists in the specified locataion.

To Reproduce

Steps to reproduce the behavior:

  1. dotnet build
  2. See the error above

System information

billti commented 4 weeks ago

It looks like you're using the old .NET based version of the QDK. We shipped a complete re-write at the start of the year (see https://devblogs.microsoft.com/qsharp/announcing-v1-0-of-the-azure-quantum-development-kit/), and recently deprecated the old version.

Do you have an existing project you need to use the old QDK for? If there are scenarios where the new QDK isn't suitable, we'd love to understand why and hopefully fill that gap.

If not, any other reason you are still trying to use the old QDK? For details on installing the latest QDK, see https://learn.microsoft.com/en-us/azure/quantum/install-overview-qdk

billti commented 2 weeks ago

Closing. Please comment back if I misunderstood and you're having issues with the current QDK.