News for hackers. Stuff that matters.
Re:HTTP/3 is everywhere but nowhere by victor106 on Monday March 17, 2025 @10:06AM (#43388757)
Can .net produce cross platform libraries/executables like Go does? With Go I can develop on Mac and create executables for windows and Linux
Re:HTTP/3 is everywhere but nowhere by CharlieDigital on Monday March 17, 2025 @10:08AM (#43388775)
Yes, it can.

I work on .NET and work on Mac (hate the OS, but the hardware and battery life are way better).

Last startup, we shipped AWS t4g Arm64 and GCP x64 Linux containers. A few devs started on Windows (because of their preferred platform), but we all ended up on M1 MacBook Pros using a mix of Rider and VS Code.

Common misconception between old .NET Framework and new .NET # (e.g. .NET 9) (MS terrible naming). C#/.NET has been capable of cross platform binaries for close to a decade?

I have a bit more info here: https://typescript-is-like-csharp.chrlschn.dev/pages/intro-a...

Re:HTTP/3 is everywhere but nowhere by pjc50 on Monday March 17, 2025 @10:26AM (#43388961)
Are you sure? https://learn.microsoft.com/en-us/dotnet/core/deploying/nati...

"Since there's no standardized way to obtain native macOS SDK for use on Windows/Linux, or Windows SDK for use on Linux/macOS, or a Linux SDK for use on Windows/macOS, Native AOT does not support cross-OS compilation. Cross-OS compilation with Native AOT requires some form of emulation, like a virtual machine or Windows WSL."

Now, you don't have to actually use AOT, the other deployment options are actually much easier to cross-build, but true cross build AOT is still not supported.

(this comment is correct: https://news.ycombinator.com/item?id=43388962 ; runtime-dependent and self-contained are fine)

Re:HTTP/3 is everywhere but nowhere by CharlieDigital on Monday March 17, 2025 @10:31AM (#43388998)

    > Native AOT does not support cross-OS compilation

    > ...runtime-dependent and self-contained are fine
This certainly reads like you moved the goal posts and recognized it.
Re:HTTP/3 is everywhere but nowhere by bheadmaster on Monday March 17, 2025 @10:46AM (#43389131)
Native AOT compilation is definitely not the same as self-contained package. With that logic, every Docker container could be considered AOT compiled static executable.
Re:HTTP/3 is everywhere but nowhere by TeMPOraL on Monday March 17, 2025 @03:41PM (#43392041)
An image or a container could be, yes. It isn't, because Docker stuff is mostly distributed as Dockerfiles and docker-compose files, and those cause your system to download and install stuff, and that part is not like self-contained package.
Re:HTTP/3 is everywhere but nowhere by chronogram on Monday March 17, 2025 @10:52AM (#43389184)
The original question did ask about creating executables like Go, which means a single file you can run as is, so it was fair to mention AOT. For servers etc you usually don't want the AOT version, so then it doesn't matter which platform you develop on, but it's not always just like Go when you want to ship little applications.
Re:HTTP/3 is everywhere but nowhere by CharlieDigital on Monday March 17, 2025 @11:06AM (#43389343)
The context of the thread is HTTP/3 servers; would it not make sense to take the comment in that context? Original article mentions that browsers (the client side) already supports HTTP/3 with the application server ecosystem being the missing piece.
Re:HTTP/3 is everywhere but nowhere by pjc50 on Monday March 17, 2025 @10:59AM (#43389274)
More that there are at least three different ways to deploy things in dotnet, and only AOT is directly equivalent to Go executables. I like dotnet and use it at work but this is a nuisance limitation for us.
Re:HTTP/3 is everywhere but nowhere by neonsunset on Monday March 17, 2025 @02:41PM (#43391508)
I don't know why we're trying anymore.

You're not going to convince someone who is looking for a way to make something not work however minor it is and not the other way around.

Re:HTTP/3 is everywhere but nowhere by homebrewer on Monday March 17, 2025 @10:26AM (#43388962)
If your code does not rely on native libraries, or you're fine with shipping multiple copies for different operating systems, a single build works everywhere with dotnet installed.

Or you can cross-compile and run without having dotnet on the target system, I do it from Linux to all three platforms all the time, it's pretty seamless. The application can be packaged into a single binary (similar to Go), or as a bunch of files which you can then then package up into a zip file.

Re:HTTP/3 is everywhere but nowhere by actionfromafar on Monday March 17, 2025 @11:20AM (#43389508)
How do you cross compile from linux to macos?
Re:HTTP/3 is everywhere but nowhere by orphea on Monday March 17, 2025 @11:38AM (#43389665)

  dotnet publish -r osx-x64 --self-contained
https://learn.microsoft.com/en-us/dotnet/core/deploying/#pub...
Re:HTTP/3 is everywhere but nowhere by mlhpdx on Monday March 17, 2025 @12:30PM (#43390226)
Just like for windows or Linux, in other words. The dotnet tooling is amazingly friction and ceremony free these days.
Re:HTTP/3 is everywhere but nowhere by neonsunset on Monday March 17, 2025 @02:50PM (#43391611)
JIT deployments do not care where they get built on. AOT deployments do because they use OS-provided linker to produce the final binary, much like C++ and Rust do (unless you use PublishAotCross nuget package which uses Zig toolchain to allow you to build Linux binaries from under Windows, I'm sure if someone's interested it could be extended further)

Also, if you want to have just a single binary, you want to do 'dotnet publish /p:PublishSingleFile=true /p:PublishTrimmed=true' instead. Self-contained build means it just ships everything needed to run in a folder without merging the assembly files or without trimming unreachable code and standard library components.

Re:HTTP/3 is everywhere but nowhere by artimaeis on Monday March 17, 2025 @10:31AM (#43389002)
I'm a dabbler in Go, far from an expert. But I'm not familiar with a capability to use, say, native MacOS platform libraries from a go app that I'm compiling in Windows/Linux without using a VM of some sort to compile it. If that's possible I'd love to learn more.
Re:HTTP/3 is everywhere but nowhere by hnlmorg on Monday March 17, 2025 @03:36PM (#43392002)
If you’re calling against shared libraries using cgo then things are a little more tricky, but still doable.

But if it’s native Go code, then cross platform compiling is just an a few environmental variables

  GOOS=darwin 
  GOARCH=arm64
Re:HTTP/3 is everywhere but nowhere by dismalaf on Monday March 17, 2025 @11:45AM (#43389746)
Mono's been on Linux for like 20 years, maybe longer... C# is like Java, can run basically anywhere.
Re:HTTP/3 is everywhere but nowhere by LtWorf on Tuesday March 18, 2025 @01:57AM (#43396171)
I think being on linux and being decent on linux are not the same, and there's .net problem.
Re:HTTP/3 is everywhere but nowhere by neonsunset on Tuesday March 18, 2025 @02:03AM (#43396195)
Can you link to anything recent which could support your argument?
Re:HTTP/3 is everywhere but nowhere by LtWorf on Tuesday March 18, 2025 @12:36PM (#43401427)
https://learn.microsoft.com/en-us/dotnet/api/system.diagnost...

Look at this garbage API that for no reason whatsoever mirrors winapi on posix for example.

Then after you painfully wrote your linux application despite all of that, you find out that .net is not included by any linux distribution, so have fun distributing your app!

Re:HTTP/3 is everywhere but nowhere by neonsunset on Tuesday March 18, 2025 @12:55PM (#43401695)
I'm not sure why you are reading the docs sideways but just in case - C# has method overloading. Process API, while dated, simply offers multiple overloads suitable for different scenarios.

Launching a new process can be as easy as `Process.Start(path, args)`.

Although if you are doing this, I can recommend using CliWrap package instead which provides nicer UX. Anything is possible the second you stop looking for a strawman.

> you find out that .net is not included by any linux distribution

Would I? If it's a CLI or a GUI application, I'd distribute it as either a native binary or as the recipe the user will be easily able to build with the .NET SDK (which is a standard approach - you'd need Rustc and Cargo in the same way).

Lastly - no one wants to put up with the maintainers with such attitude and you know well enough that "not included in any linux distribution" is both provably false and a non-factor - in all the distributions that matter it is `sudo {package manager} install dotnet9` away :)

Re:HTTP/3 is everywhere but nowhere by LtWorf on Tuesday March 18, 2025 @04:55PM (#43404985)
> Took you long enough.

Yeah I do have a life. I advice you to get one as well.

> Launching a new process can be as easy as `Process.Start(path, args);`.

-_-' Same exact problem. Letting every single process do their own escaping of the arguments. A proper portable API would have an array of strings for the arguments, to map execve(). That's how on windows every program does its own escaping and there's lots of programs doing it differently than others, but not how it works on posix.

Thanks for confirming you don't even comprehend the issue here. Crying "strawman!" won't help.

> If it's a CLI or a GUI application, I'd distribute it as either a native binary or as the recipe the user will be easily able to build with the .NET SDK (which is a standard approach - you'd need Rustc and Cargo in the same way).

You can't do any GUI in .NET outside of windows and you know it fully well.

The difference with cargo or go or pip is that all of these are found in every linux distribution, while .net is in none. Please go ahead and misunderstand this sentence on purpose like you've been doing so far.

> in all the distributions that matter it is `sudo {package manager} install dotnet9` away :)

I guess ubuntu, debian, red hat do not matter? What's left? neonsunsetimaginarylinux?

Re:HTTP/3 is everywhere but nowhere by neonsunset on Tuesday March 18, 2025 @05:50PM (#43405585)
Look, it is very difficult to hold a conversation with someone who responds with "you're just a fanboy, it's 5!" to "2 + 2 equals 4".

On the off chance you are making an intentionally inflammatory reply - you could also ask normally.

Let me try one last time (and now I vaguely remember having similar conversation here before).

On Ubuntu:

  sudo apt install dotnet9
On RHEL (8 or 9):

  sudo dnf install dotnet-sdk-9.0
On Alpine:

  sudo apk add dotnet9-sdk
Then, you can get a simple cross-platform application template like this:

  dotnet new install Avalonia.Templates      && \
  dotnet new avalonia.app -o AvaloniaExample && \
  cd AvaloniaExample                         && \
  dotnet publish -o build -p:PublishAot=true && \
  ./build/AvaloniaExample
The above can target: Linux, macOS, Windows, WASM and with some caveats Android and iOS (although I would not recommend using Avalonia for mobile devices over e.g. Flutter).

The build folder will contain the native application itself and the Skia dynamically linked dependency alongside it (and possibly some symbols you can delete). This is very similar to the way Qt applications are shipped.

This is just one GUI framework. There are other: Uno Platform, Gir.Core (GTK4 + GObject libraries), SDL2 via Silk.NET, Eto. I'm sure there's more.

What is bewildering is you could argue about "first-class" or "subpar", etc. But "does not work at all" is just ridiculous and indefensible. What kind of thought process leads to this conclusion?

In any case, I doubt you're going to read this since your replies seem to indicate interest in tilting at any windmill with ".NET" label on it instead, but at least my conscience is clear that I tried to explain this to the best of my ability.

Re:HTTP/3 is everywhere but nowhere by LtWorf on Wednesday March 19, 2025 @02:02AM (#43408647)
All these words and you lost the original part where the APIs are windows oriented?
Re:HTTP/3 is everywhere but nowhere by exceptione on Wednesday March 19, 2025 @10:43AM (#43412660)
Man.. All of these words did proof you were wrong.

> The difference with cargo or go or pip is that all of these are found in every linux distribution, while .net is in none.

This statement is false. It is also in arch. If it is not in debian and ubuntu, that is their fault. (But it would not surprise me, any user will soon run into the fact that even for non-obscure software there are no up-to-date packages in the main repo. The default escape hatch is to add extra repo sources, but my advice is to skip those distro's altogether anyways, unless you have very specific needs.)

But then again, if you think package management is a serious topic and then dismiss .net for the python mess, come on.

> the APIs are windows oriented?

The design of this particular API might be off. I guess this dates from the pivot to cross-platform. Usually, tuning for .net performance is better on Linux. I think nobody in MS believes in Windows as a platform really, it is a sinking ship.

Re:HTTP/3 is everywhere but nowhere by LtWorf on Wednesday March 19, 2025 @07:22PM (#43418281)
> It is also in arch. If it is not in debian and ubuntu, that is their fault.

Of course. Microsoft is a tiny poor company. It couldn't possibly afford to hire a consultant to do this kind of job.

> But then again, if you think package management is a serious topic and then dismiss .net for the python mess, come on.

What mess? apt solves the mess, there's no mess if you stay away from pypi (which I advice you do).

> I think nobody in MS believes in Windows as a platform really, it is a sinking ship.

I'm rather sure governments will still use it in 20 or 30 years.

Re:HTTP/3 is everywhere but nowhere by andygocke on Tuesday March 18, 2025 @12:00AM (#43395641)
Hi, I own the Native AOT compiler and self-contained compiler for .NET.

Self-contained will work fine because we precompile the runtime and libraries for all supported platforms.

Native AOT won't, because we rely on the system linker and native libraries. This is the same situation as for C++ and Rust. Unlike Go, which doesn't use anything from the system, we try to support interop with system libraries directly, and in particular rely on the system crypto libraries by default.

Unfortunately, the consequence of relying on system libraries is that you actually have to have a copy of the system libraries to link against them, and a linker that supports that. In practice, clang is actually a fine cross-linker for all these platforms, but acquiring the system libraries is an issue. None of the major OSes provide libraries in a way that would be easy to acquire and deliver to clang, and we don't want to get into the business of building and redistributing the libcs for all platforms (and then be responsible for bugs etc).

Note that if you use cgo and call any C code from Go you will end up in the same situation even for Go -- because then you need a copy of the target system libc and a suitable system linker.