Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work with .net 9 #11

Closed
StackExplode opened this issue Mar 6, 2025 · 1 comment
Closed

Not work with .net 9 #11

StackExplode opened this issue Mar 6, 2025 · 1 comment

Comments

@StackExplode
Copy link

I follow the step written on Readme.md to install zig and llvm . I created a "Hello world" project with .net 9.0. Then I tried to cross compile the project with command :

dotnet publish -r linux-x64

It gave me some errors:

  AOTTest 失败,出现 3 错误 (2.6) → bin\Release\net9.0\linux-x64\AOTTest.dll
    ld.lld : error : undefined symbol: __cpu_indicator_init
    ld.lld : error : undefined symbol: __cpu_model
    C:\Users\Administrator\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.0\build\Microsoft.NETCore.Native.targets(376,5): error MSB3073: 命令“"clang" "obj\Release\net9.0\linux-x64\native\AOTTest.o" -o "bin\Release\net9.0\linux-x64\native\AOTTest" -Wl,--version-script=obj\Release\net9.0\linux-x64\native\AOTTest.exports -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libbootstrapper.o C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libRuntime.WorkstationGC.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libeventpipe-disabled.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libRuntime.VxsortEnabled.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libstandalonegc-disabled.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libstdc++compat.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\framework\libSystem.Native.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\framework\libSystem.IO.Compression.Native.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\framework\libSystem.Net.Security.Native.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\framework\libSystem.Security.Cryptography.Native.OpenSsl.a C:\Users\Administrator\.nuget\packages\runtime.linux-x64.microsoft.dotnet.ilcompiler\9.0.0\sdk\libz.a --target=x86_64-linux-gnu -g -Wl,-rpath,"$ORIGIN" -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lrt -lm -pie -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr --target=x86_64-linux-gnu -Wl,--discard-all -Wl,--gc-sections”已退出,代码为 1。

Then I tried to change the target to Linux-ARM64 with command dotnet publish -r linux-arm64. The target compiled without error and the generated elf file run with no problem on my embedded system board.

I finally tried to change the TargetFramework to net8.0 and cross compile for Linux-x64 again. It worked without issue.

The versions of tools I was using:
OS: Windows 10 1806
.net sdk: 9.0.101
zig: 0.14.0
LLVM: 19.1.1

@MichalStrehovsky
Copy link
Owner

This is a problem in zig, tracked at ziglang/zig#18074. Closing as external; can't do much about it here, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants