AaronRobinsonMSFT / DNNE

Prototype native exports for a .NET Assembly.
MIT License
397 stars 41 forks source link

Q: How to set up cross-compilation. #84

Closed obiwanjacobi closed 2 years ago

obiwanjacobi commented 2 years ago

I am trying to understand how to get cross-compilation to work. I am on Windows and would like my project to build a windows, linux and mac binary.

Do you have any guidance on how to set this up?

AaronRobinsonMSFT commented 2 years ago

@obiwanjacobi That is a tall order and in practice not really possible. The managed assembly can of course be cross-platform but the native component is going to be difficult. In order to accomplish this on the native side, you will need a C99 compiler that can target each of those platforms. I am not aware of one though. This would require a compiler that could run on Windows but provide a macOS SDK, linux SDK, and produce a macOS .dylib (Mach-O image) and a linux .so (ELF image).

For Windows, this could be accomplished by building inside of WSL but I know of no way to produce the Mach-O image on Windows. Moving everything to macOS might allow you to do macOS and linux but then Windows is an issue. I do not know of anyone that has solved this problem yet.

obiwanjacobi commented 2 years ago

Bummer. Thanks.

AaronRobinsonMSFT commented 2 years ago

Added FAQ entry - https://github.com/AaronRobinsonMSFT/DNNE#faqs.