gpt4 book ai didi

c# - 如何使用 native corert 预览进行构建?

转载 作者:搜寻专家 更新时间:2023-10-31 02:09:35 24 4
gpt4 key购买 nike

我尝试使用 corert 构建一个针对 win-x86 的 .NET Core 2.0 控制台应用程序ilc 编译器和微软链接(soft link)器。

到目前为止,我下载了最新版本的 corert 库,并使用截至提交 c7781a90f00645f6bd06ef57e5d3fd879fe3e9a0 的发布目标成功构建了预览。

我添加了构建脚本 rd.xml、ilc.rsp 和 link.rsp,但我不断收到来自 ilc 的消息:

Error: Target architecture is not supported
Internal.CommandLine.CommandLineException: Target architecture is not supported
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)

更新:我能够解决架构问题,但现在由于缺少文件引用而失败:

C:\testapp>call "..\corert\bin\Windows_NT.x64.Release\tools\ilc.exe" ".\ilc.rsp"
Error: [TEMPORARY EXCEPTION MESSAGE] FileLoadErrorGeneric: Microsoft.Extensions.Options
Internal.TypeSystem.TypeSystemException+FileNotFoundException: [TEMPORARY EXCEPTION MESSAGE] FileLoadErrorGeneric: Microsoft.Extensions.Options
at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID id, String fileName)
at ILCompiler.CompilerTypeSystemContext.GetModuleForSimpleName(String simpleName, Boolean throwIfNotFound)
at Internal.TypeSystem.CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(ModuleDesc module, String name, Boolean throwIfNotFound, Func`4 resolver)
at Internal.TypeSystem.CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(ModuleDesc module, String name, Boolean throwIfNotFound, Func`4 resolver)
at ILCompiler.RdXmlRootProvider.ProcessTypeDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, XElement typeElement)
at ILCompiler.RdXmlRootProvider.ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement)
at ILCompiler.RdXmlRootProvider.AddCompilationRoots(IRootingServiceProvider rootProvider)
at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1 dependencyGraph, NodeFactory nodeFactory, IEnumerable`1 compilationRoots, DebugInformationProvider debugInformationProvider, Logger logger)
at ILCompiler.ILScannerBuilder.ToILScanner()
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)

更新 2:我能够通过查找所有丢失文件的引用来解决问题,但最后我意识到我需要将架构目标切换到 x64,但是现在它失败了链接器:

C:\testapp>call link @".\link.rsp"
libcpmt.lib(nothrow.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

最佳答案

此问题是由于使用开发人员命令提示而不是 x64 native 工具命令提示引起的。前者默认以 x86 为目标,而后者以 x64 为目标,并将链接到 x64 库。

关于c# - 如何使用 native corert 预览进行构建?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46451090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com