-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[release/6.0-rc2][wasm] Fixes, and improvements based on user feedback #59486
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
Conversation
`WasmNativeStrip` -> `false` Compile, and link optimization flags for `emcc` to `-O1`
.. rebuilds. Specifically, when a rebuild causes only the *linking* part to be run again. In that case, we were correctly skipping over compiling native files, but didn't add them to `@(FileWrites)`, which caused msbuild's incremental clean logic to treat them as "orphaned" files, and delete them!
.. and remove the Blazor sdk targets hack used for testing, since the updated SDK has the fixes.
|
Tagging subscribers to 'arch-wasm': @lewing Issue Details
|
|
The test failures are due to missing It fails to restore a blazorwasm project: |
For non-publish builds, undefined symbols will show up as warnings: ``` EXEC : warning : undefined symbol: sqlite3_column_database_name (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_column_origin_name (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_column_table_name (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_snapshot_cmp (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_snapshot_free (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_snapshot_get (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_snapshot_open (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] EXEC : warning : undefined symbol: sqlite3_snapshot_recover (referenced by top-level compiled C/C++ code) [/BlazorWebAssemblySqlite.csproj] ```
Currently, for a variadic function like: `int sqlite3_config(int, ...);` .. and multiple pinvokes like: ```csharp [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_none(int op); [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_int(int op, int val); [DllImport(SQLITE_DLL, ExactSpelling=true, EntryPoint = "sqlite3_config", CallingConvention = CALLING_CONVENTION)] public static extern unsafe int sqlite3_config_log(int op, NativeMethods.callback_log func, hook_handle pvUser); ``` .. we generate: ```c int sqlite3_config (int); int sqlite3_config (int,int); int sqlite3_config (int,int,int); ``` .. which fails to compile. Instead, this patch will generate a variadic declaration with one fixed parameter: ```c // Variadic signature created for // System.Int32 sqlite3_config_none(System.Int32) // System.Int32 sqlite3_config_int(System.Int32, System.Int32) // System.Int32 sqlite3_config_log(System.Int32, SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods+callback_log, SQLitePCL.hook_handle) int sqlite3_config (int, ...); ``` TODO: functions with different first argument
- For pinvokes with function pointers, *no* declaration is added to `pinvoke-table.h`, and a warning is raised: ``` warning : DllImports with function pointers are not supported. Calling them will fail. Managed DllImports: [/Users/radical/dev/r2/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/g3acrk4b.a0o/variadic_g3acrk4b.a0o.csproj] warning : Type: Test, Method: System.Int32 using_sum_one(?) [/Users/radical/dev/r2/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/g3acrk4b.a0o/variadic_g3acrk4b.a0o.csproj] ``` - Also, handle multiple pinvokes with the same number of params, but different types
- pinvokes with function pointers could be for variadic functions too - if there are multiple pinvokes for the same native function, but some of them have function pointers, then ignore those but generate the declaration for the rest - raise better warnings - and emit info about the variadic pinvokes in pinvoke-table.h
This reverts commit c2174f3.
|
@marek-safar should we re-target this to 6.0 or is it blocking for rc2 ? |
|
RC2 would definitely help us get better feedback about this feature. But if it’s a big problem I expect we could live with 6.0. |
|
Closing in favor of #59671 . |
This contains:
Fix to handle pinvokes with function pointers, which unblocks using native
sqlitelibraryfix for an incremental build issue where the compiled native
.ofiles wouldincorrectly get deleted after linking. And that would cause them to be
recompiled, unnecessarily increasing the build time.
Change to the default optimization flag used when building for
Debugconfigfrom
-Ozto-O1Customer impact
project with a native library goes down from
22sto12s.Testing
Manual testing, existing tests, and specific new tests.
Risk
Low. Improves build experience.