Where are parameters for csproj like fuse-ld with lld and no-gc-setcion?
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
Continue with [issue#37643](https://github.com/dotnet/sdk/issues/37643#issuecomment-1871686324)
How do I add some parameters for csproj like `` or `` and `lld, bfd etc`
// UPDATED:
```xml
Exe
net10.0
enable
enable
true
true
true
lld
false
false
true
true
```
But I got error cause clang doesn't know how do I get without error like this:
```shell
dotnet publish -c Release -r linux-x64
Restore complete (0.8s)
DeafMan1983.Runtime.Clib net10.0 succeeded (0.2s) → /home/deafman1983/Documents/CSharpProjects/ClibSharp/DeafMan1983.Runtime.Clib/bin/Release/net10.0/DeafMan1983.Runtime.Clib.dll
ClibTest net10.0 linux-x64 failed with 2 error(s) (2.8s) → bin/Release/net10.0/linux-x64/ClibTest.dll
clang : error linker command failed with exit code 1 (use -v to see invocation)
/home/deafman1983/.nuget/packages/microsoft.dotnet.ilcompiler/10.0.0/build/Microsoft.NETCore.Native.targets(389,5): error MSB3073: The command ""clang" "obj/Release/net10.0/linux-x64/native/ClibTest.o" -o "bin/Release/net10.0/linux-x64/native/ClibTest" -Wl,--version-script="obj/Release/net10.0/linux-x64/native/ClibTest.exports" -Wl,--export-dynamic -gz=zlib -fuse-ld=bfd /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Native.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.IO.Compression.Native.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Net.Security.Native.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Security.Cryptography.Native.OpenSsl.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libbootstrapper.o /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libRuntime.WorkstationGC.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libeventpipe-disabled.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libRuntime.VxsortDisabled.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libstandalonegc-disabled.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libaotminipal.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libstdc++compat.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libz.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libbrotlienc.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libbrotlidec.a /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libbrotlicommon.a -g -Wl,--build-id=sha1 -Wl,--as-needed -pthread -ldl -lrt -lm -static-pie -Wl,-z,relro -Wl,-z,now -Wl,--defsym,__xmknod=mknod -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--gc-sections" exited with code 1.
Build failed with 2 error(s) in 4.4s
```
clang full error:
```shell
/usr/bin/ld.bfd: /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Native.a(pal_uid.c.o): note: the message above does not take linker garbage collection into account
/usr/bin/ld.bfd: /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Native.a(pal_uid.c.o): in function `SystemNative_GetPwUidR':
/__w/1/s/src/runtime/src/native/libs/System.Native/pal_uid.c:69:(.text.SystemNative_GetPwUidR+0x50): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld.bfd: /home/deafman1983/.nuget/packages/microsoft.netcore.app.runtime.nativeaot.linux-x64/10.0.0/runtimes/linux-x64/native/libSystem.Native.a(pal_uid.c.o): note: the message above does not take linker garbage collection into account
/usr/bin/ld.bfd: BFD (GNU Binutils for Ubuntu) 2.42 assertion fail ../../bfd/elflink.c:15434
/usr/bin/ld.bfd: BFD (GNU Binutils for Ubuntu) 2.42 assertion fail ../../bfd/elflink.c:15434
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
But I have tried to pass `false` and `lld`
Like I have copied and pasted with full compilication prompt:
```shell
clang ... -static-pie -fuse-ld=lld -Wl,-z,relro -Wl,-z,now -Wl,-
-defsym,__xmknod=mknod -Wl,--eh-frame-hdr -Wl,--discard-all -Wl,--no-gc-sections
```
Can you tell about problem? I use Dotnet 10.x with Ubuntu 24.04.3
// UPDATED:
It works fine now. Thanks I am sorry for that. Because I searched Google if I don't know which parameters but I found `lld` And I disable Garbage Collection -> `false` But I am not sure that. If I am correct for disabling garbage collection? Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.