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

[question] cannot compile with-runtime #6

Closed fawdlstty closed 4 years ago

fawdlstty commented 4 years ago
E:\GitHub\zerosharp\with-runtime>build.cmd

E:\GitHub\zerosharp\with-runtime>csc /debug /noconfig /nostdlib /runtimemetadata
version:v4.0.30319 zerosharp.cs /out:zerosharp.ilexe /langversion:latest /unsafe
 /r:Test.CoreLib.dll
Microsoft(R) Visual C# 编译器 版本 3.5.0-beta4-20153-05 (20b9af91)
版权所有(C) Microsoft Corporation。保留所有权利。

zerosharp.cs(46,13): warning CS0162: 检测到无法访问的代码

E:\GitHub\zerosharp\with-runtime>"C:\Users\Administrator\.nuget\packages\runtime
.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-27824-01\tools\ilc" zerosharp.i
lexe -r:Test.CoreLib.dll -o zerosharp.obj --systemmodule Test.CoreLib --map zero
sharp.map -O --noscan -g

E:\GitHub\zerosharp\with-runtime>link zerosharp.obj "C:\Users\Administrator\.nug
et\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-27824-01\sdk
\bootstrapper.lib" "C:\Users\Administrator\.nuget\packages\runtime.win-x64.micro
soft.dotnet.ilcompiler\1.0.0-alpha-27824-01\sdk\Runtime.lib" kernel32.lib ole32.
lib advapi32.lib /incremental:no /debug /opt:ref
Microsoft (R) Incremental Linker Version 14.25.28612.0
Copyright (C) Microsoft Corporation.  All rights reserved.

libcpmt.lib(nothrow.obj) : fatal error LNK1112: 模块计算机类型“x86”与目标计算
机类型“x64”冲突

E:\GitHub\zerosharp\with-runtime>
fawdlstty commented 4 years ago
E:\GitHub\zerosharp\no-runtime>build.cmd

E:\GitHub\zerosharp\no-runtime>csc /debug:embedded /noconfig /nostdlib /runtimem
etadataversion:v4.0.30319 zerosharp.cs /out:zerosharp.ilexe /langversion:latest
/unsafe
Microsoft(R) Visual C# 编译器 版本 3.5.0-beta4-20153-05 (20b9af91)
版权所有(C) Microsoft Corporation。保留所有权利。

zerosharp.cs(7,34): warning CS0169: 从不使用字段“object.m_pEEType”

E:\GitHub\zerosharp\no-runtime>C:\Users\Administrator\.nuget\packages\runtime.wi
n-x64.microsoft.dotnet.ilcompiler\1.0.0-alpha-27824-01\tools\ilc zerosharp.ilexe
 -o zerosharp.obj --systemmodule zerosharp --map zerosharp.map -O

E:\GitHub\zerosharp\no-runtime>link /subsystem:console zerosharp.obj /entry:__ma
naged__Main kernel32.lib /merge:.modules=.pdata /incremental:no
Microsoft (R) Incremental Linker Version 14.25.28612.0
Copyright (C) Microsoft Corporation.  All rights reserved.

zerosharp.obj : error LNK2001: 无法解析的外部符号 WriteConsoleW
zerosharp.obj : error LNK2001: 无法解析的外部符号 GetStdHandle
D:\Windows Kits\10\lib\10.0.18362.0\um\x86\kernel32.lib : warning LNK4272:库计算
机类型“x86”与目标计算机类型“x64”冲突
zerosharp.exe : fatal error LNK1120: 2 个无法解析的外部命令

E:\GitHub\zerosharp\no-runtime>
MichalStrehovsky commented 4 years ago

Make sure you run the x64 Native tools command prompt, not the x86 one:

image