-
Notifications
You must be signed in to change notification settings - Fork 21
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
NativeAOT Compilation #9
Comments
We do have some internal builds of RawFileReader against .Net 8 but I need to check to see if the code is ready for external release. |
Hello, I wanted to follow up to see if there's any news here. |
Our Product Evaluation (OPE) group is looking at the update. I am waiting for their final documentation and sign off before I update the files. |
Thank you. |
I was able to compile the new Net8 build as a NativeAOT static library, but I see a barrage of warnings:
I compiled the same .NET code that I have previously used with dynamically linking with and bootstrapping a .NET runtime via FFI, but opening a RAW file fails:
Based upon the compilation warnings, this runtime warning seems to follow from using reflection or the like in a way that isn't compatible with AOT compilation. So right now we're still going to need to ensure the .NET runtime is available separately on the system to use the RawFileReader library. Is making the library compatible with native AOT static compilation something that Thermo is interested in doing? If not, it's good to know to avoid pouring more time into this. |
Can you provide me some more details about how you are building your application (Windows, Linux, or MacOS)? Also are you using Visual Studio or Visual Studio Code? Part of this information is so that I can try building it myself. |
All work is being done on Windows right now. The .NET codebase is located at https://github.com/mobiusklein/thermorawfilereader.rs/tree/feature/native-aot/librawfilereader. The .NET build process is running explicitly with the dotnet publish librawfilereader -c Release --use-current-runtime The statically compiled .NET code itself is able to start up, safely do basic arithmetic, call across language boundaries to pass strings, etcetera. The error message I showed is produced at https://github.com/mobiusklein/thermorawfilereader.rs/blob/feature/native-aot/librawfilereader/Lib.cs#L1028 The associated Rust program is automatically locating the AOT compilation SDK and compiling the .NET library in the build script, but it can be built independently to be linked with something else like C++, but I doubt the behavior would change. |
To verify it's not the Rust-static library linking bit causing the problem, I added a pure .NET AOT compiled executable in https://github.com/mobiusklein/thermorawfilereader.rs/blob/feature/native-aot/librawfilereader/test_rawfilereader.csproj. This runs the same file-opening logic and checks whether there was an error set https://github.com/mobiusklein/thermorawfilereader.rs/blob/feature/native-aot/librawfilereader/Lib.cs#L1358-L1379
This builds the test CLI application and runs the native AOT executable, producing the following output:
I get the same native AOT warnings about relying on reflection and runtime type information, which have the associated generic-based static dispatch alternatives called out in the earlier message |
Has the library been compiled successfully as either a static or shared library with .NET 8? While I was able to get a shared library to build on Windows, it would fail on attempting to open the file with the following
FileError
value:There were several warnings about reflection being used to compute sizes during marshaling where a compile time alternative is available as well.
This feature would let the C# library be wrapped and used as though it were an opaque C library. Using it as-is is still possible with
nethost
or some other native hosting layer as long as the machine already has a suitable .NET runtime version already installed.The text was updated successfully, but these errors were encountered: