MichalStrehovsky / zerosharp

Demo of the potential of C# for systems programming with the .NET native ahead-of-time compilation technology.
2k stars 103 forks source link

no-runtime is not working #28

Closed kant2002 closed 2 years ago

kant2002 commented 2 years ago

When dotnet publish -c Release -r win-x64 following exception happens.

EXEC : error : One or more errors occurred. (Code generation failed for method '[noruntime]Program.printf(uint8*)') [D:\d\kant\GitHub\zerosharp\no-runtime\noruntime.csproj]
  System.AggregateException: One or more errors occurred. (Code generation failed for method '[noruntime]Program.printf(uint8*)')
   ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[noruntime]Program.printf(uint8*)'
   ---> System.InvalidOperationException: Expected type 'Internal.Runtime.CompilerHelpers.InteropHelpers' not found in module 'noruntime'
     at Internal.IL.HelperExtensions.GetKnownType(ModuleDesc module, String namespace, String name)
     at Internal.IL.Stubs.PInvokeILEmitter.EmitPInvokeCall(PInvokeILCodeStreams ilCodeStreams)
     at Internal.IL.Stubs.PInvokeILEmitter.EmitIL()
     at Internal.IL.Stubs.PInvokeILEmitter.EmitIL(MethodDesc method, PInvokeILEmitterConfiguration pinvokeILEmitterConfiguration, InteropStateManager interopStateManager)
     at ILCompiler.Compilation.CombinedILProvider.GetMethodIL(MethodDesc method)
     at ILCompiler.Compilation.ILCache.CreateValueFromKey(MethodDesc key)
     at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey key)
     at ILCompiler.Compilation.GetMethodIL(MethodDesc method)
     at Internal.IL.ILImporter..ctor(ILScanner compilation, MethodDesc method, MethodIL methodIL)
     at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode)
     --- End of inner exception stack trace ---
     at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode)
     at System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i)
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     at System.Threading.Tasks.TaskReplicator.Replica.Execute()
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
     at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
     at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
     at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
     at ILCompiler.ILScanner.CompileMultiThreaded(List`1 methodsToCompile)
     at ILCompiler.ILScanner.ComputeDependencyNodeDependencies(List`1 obj)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan()
     at ILCompiler.Program.Run(String[] args)
     at ILCompiler.Program.Main(String[] args)
...nuget\packages\microsoft.dotnet.ilcompiler\7.0.0-alpha.1.22058.1\
nifanfa commented 2 years ago

i got the same problem. the new version of ILCompiler doesn't work at all. i can only use ILCompiler 1.0.0-alpha