Skip to content
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

Investigate UWP support #22729

Closed
jdm opened this issue Jan 18, 2019 · 25 comments
Closed

Investigate UWP support #22729

jdm opened this issue Jan 18, 2019 · 25 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Jan 18, 2019

I'll collect any resources that might be helpful here.

@jdm jdm added the P-windows label Jan 18, 2019
@jdm
Copy link
Member Author

@jdm jdm commented Jan 18, 2019

@jdm
Copy link
Member Author

@jdm jdm commented Jun 6, 2019

Running the vcvars batch scripts with a uwp argument apparently does something different. We should figure out what that entails and make sure that anything useful is added to the native cc-rs and cmake builds:

set __VCVARS_APP_DIR=
if /I "%VSCMD_ARG_APP_PLAT%" == "UWP" (
    set __VCVARS_APP_DIR=store
) else if /I "%VSCMD_ARG_APP_PLAT%" == "OneCore" (
    set __VCVARS_APP_DIR=onecore
)

@REM Windows 10 SDK only past this point
if /I "%VSCMD_ARG_APP_PLAT%"=="UWP" (
    call :add_to_libpath_optional "%ExtensionSDKDir%\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral"
)
@REM Windows 10 SDK only past this point
if /I "%VSCMD_ARG_APP_PLAT%"=="UWP" (
    call :add_to_lib_optional "%VCToolsInstallDir%lib%__VCVARS_LIB_DIR%\store\" "%__VCVARS_VC_LIB_STORE_OVERRIDE%"
    call :add_to_libpath_optional "%ExtensionSDKDir%\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral" "%__VCVARS_NO_OVERRIDE%"
)
@jdm
Copy link
Member Author

@jdm jdm commented Jun 6, 2019

We will need to provide the Code Generation capability to support the spidermonkey JIT: https://docs.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations

@jdm
Copy link
Member Author

@jdm jdm commented Jun 7, 2019

The dirs crate used by font-config and servo_config calls SHGetKnownFolderPath which is forbidden:

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

A bunch of c++ istream/ostream code is present in mozangle and shows up in the WACK forbidden symbols. We might need to make a separate ANGLE crate that wraps https://github.com/Microsoft/angle/ instead for the UWP build.

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

One of the gstreamer dependencies in this list is libwinpthreads-1.dll, which the WACK complains about. According to our gstreamer friends:

The gstreamer binaries built with MSVC do not need libwinpthread-1.dll. 
For instance, the gst test app does not use it. The only way it can get
pulled in is if you're using a plugin that has dependencies built with
Autotools/MinGW. Which plugins are those? It should be possible to port
and build those dependencies with Meson/MSVC instead.
@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

Latest WACK report using the UWP compiler target: https://www.joshmatthews.net/wack.html

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

backtrace-rs relies on dbghelp.dll which appears to be largely forbidden:

API EnumerateLoadedModules64 in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymFromAddr in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymFromAddrW in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymGetLineFromAddr64 in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymGetLineFromAddrW64 in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymGetModuleInfo64 in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymInitialize in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymInitializeW in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymLoadModule64 in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.
API SymSetOptions in dbghelp.dll is not supported for this application type. simpleservo.dll calls this API.

rust-lang/backtrace-rs#193

libEGL in mozangle also links with the dbghelp library.

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

Old versions of rand (0.4, 0.5) look like they are the cause of:

API SystemFunction036 in cryptbase.dll is not supported for this application type. simpleservo.dll calls this API.

0.4 affects hashglobe, servo_rand, tempfile, and ws. 0.5 affects phf_generator, tokio-threadpool, and uuid.

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

mozjs has a static link directive with Dbghelp and uses it in mozjs/mozglue/build/cygprofile.cpp. mozjs/mozglue/misc/StackWalk.cpp also uses imagehelp.dll methods like StackWalk64, which weren't supported in 2016 (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/703260).

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

nspr calls a bunch of unsupported methods. Luckily, we can remove it entirely from the spidermonkey build on all platforms: servo/mozjs#185

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

All references to linking opengl32.lib need to be removed: paulrouget/winapi-rs@e3aaa6c

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

The OpenSSL DLLs are responsible for a bunch of forbidden API usage. I'm keeping an eye on microsoft/vcpkg#4267 which should bring up a version that supports UWP (openssl/openssl#8917).

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

The forbidden clipboard functions will disappear from the WACK report once #23440 is fixed.

@jdm
Copy link
Member Author

@jdm jdm commented Jun 12, 2019

API _Query_perf_counter in msvcp140.dll is not supported for this application type. simpleservo.dll calls this API.
API _Query_perf_frequency in msvcp140.dll is not supported for this application type. simpleservo.dll calls this API.
API _Thrd_sleep in msvcp140.dll is not supported for this application type. simpleservo.dll calls this API.
API _Xtime_get_ticks in msvcp140.dll is not supported for this application type. simpleservo.dll calls this API.

These may come from std::chrono (reference)? There is usage of that in mozjs in the WASM code.

@MouriNaruto
Copy link

@MouriNaruto MouriNaruto commented Jun 14, 2019

I wonder to provide you some interesting infomaton. (The talk between the maintainer from Microsoft/OpenSSL and me.)

Also I think we should keep the compatibility for earlier version of Windows, even compiled with the latest SDK. Because some developers like me need to support several versions of Windows 10.

Building with a new SDK still allows the binary to run on previous versions of Windows, so moving forward with the progress of the SDK doesn't prevent supporting older versions.

But after reading the source code, I realized that some functions will be linked to the new version of dynamic libraries if I am using the new version of Windows SDK because you used the conditional compilation. (It will not overwrite functions not supported by older versions if the new version of Windows SDK is used.)

Yes, while when using a new SDK we might be linking around newly exposed functions (specifically the ones that we override), they are already part of the previous versions of the OS. The apis weren't exposed in the Universal SDK and would fail the WACK certification, but as the SDK and WACK allow for more functions to be used they are also allowed on previous versions of the OS.

For more informaton, please read microsoft/openssl#59

Kenji Mouri

@MouriNaruto
Copy link

@MouriNaruto MouriNaruto commented Jun 14, 2019

Also, I wonder to provide a way to bypass the WACK check.

Here is an example. My friend use it in his UWP and publish to the Microsoft Store.
https://github.com/amamiya/SYEngine/blob/master/SYEngine/SYEngine.Shared/AutoLib.h

Also, I think maybe we can use some undocument way to get the kernel32.dll's HMOUDLE handle. (For example, the PEB stucture.)

Kenji Mouri

@jdm
Copy link
Member Author

@jdm jdm commented Jun 14, 2019

Yes, I have been following all of the openssl issues with great interest. Thank you for continuing to work on that :)

@MouriNaruto
Copy link

@MouriNaruto MouriNaruto commented Jun 14, 2019

This is a new issue which opened by myself for the next step UWP support in OpenSSL.
Some arguments need to solve. (But there are no people reply for them in recent four days.)

openssl/openssl#9125

Kenji Mouri

@jdm
Copy link
Member Author

@jdm jdm commented Jul 20, 2019

Need to see if we're using a version of mio that is uwp-compatible: tokio-rs/mio#912

@jdm
Copy link
Member Author

@jdm jdm commented Sep 19, 2019

I think we can call these investigations resolved, since we're building UWP app nightlies on CI.

@jdm jdm closed this Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.