Skip to content

Julia is unable to launch in the Universal Windows Platform (UWP) #52007

Open
@JanisErdmanis

Description

@JanisErdmanis

One of the prerequisites for applications to be accepted in the Microsoft marketplace is that they must run within a UWP containerised environment. This means that fullTrust capability should only be used if there is a good reason for doing so. Unfortunately now when Julia 1.9.3 on Windows 11 is started from the UWP environment Julia crashes at launch with the following error:

fatal: error thrown and no exception handler available.
InitError(mod=:Sys, error=ErrorException("could not load library "libpcre2-8"
The parameter is incorrect. "))
ijl_errorf at C:/workdir/src\rtutils.c:77
ijl_load_dynamic_library at C:/workdir/src\dlload.c:369
jl_get_library_ at C:/workdir/src\runtime_ccall.cpp:48
jl_get_library_ at C:/workdir/src\runtime_ccall.cpp:39 [inlined]
ijl_load_and_lookup at C:/workdir/src\runtime_ccall.cpp:61
jlplt_pcre2_compile_8_51593 at C:\Program Files\WindowsApps\JuliaUWP_0.1.0.0_neutral__s0by06ay2112j\lib\julia\sys.dll (unknown line)
compile at .\pcre.jl:161
compile at .\regex.jl:75
match at .\regex.jl:376
match at .\regex.jl:376 [inlined]
match at .\regex.jl:395 [inlined]
splitdrive at .\path.jl:38
joinpath at .\path.jl:264
joinpath at .\path.jl:327 [inlined]
abspath at .\path.jl:449 [inlined]
__init_build at .\sysinfo.jl:128
__init__ at .\sysinfo.jl:120
jfptr___init___34208 at C:\Program Files\WindowsApps\JuliaUWP_0.1.0.0_neutral__s0by06ay2112j\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1880 [inlined]
jl_module_run_initializer at C:/workdir/src\toplevel.c:75
_finish_julia_init at C:/workdir/src\init.c:855
jl_repl_entrypoint at C:/workdir/src\jlapi.c:711
mainCRTStartup at C:/workdir/cli\loader_exe.c:59
uaw_wcsrchr at C:\Windows\System32\KERNEL32.DLL (unknown line)
uaw_wcsrchr at C:\Windows\System32\KERNEL32.DLL (unknown line)
ZwWaitLowEventPair at C:\Windows\SYSTEM32\ntdll.dll (unknown line)

Introduction

To reproduce the error, let’s start with something that works, using a fullTrust capability. To do so, we can unzip Julia for Windows and, within it, place the following AppxManifest.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" 
         xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
         xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
         xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">

  <Identity Name="JuliaUWP" 
            Publisher="CN=JuliaUser" 
            Version="0.1.0.0" />

  <Properties>
    <DisplayName>JuliaUWP</DisplayName>
    <PublisherDisplayName>AppBundler</PublisherDisplayName>
    <Logo>assets\icon.png</Logo>
  </Properties>

  <Dependencies> 
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.10240.0" MaxVersionTested="10.0.19041.0" />
  </Dependencies>

  <Resources>
    <Resource Language="en-us" />
  </Resources>

  <Applications>
    <Application EntryPoint="Windows.FullTrustApplication" 
		 Executable="bin\julia.exe" 
		 Id="JuliaUWP" 
		 uap10:RuntimeBehavior="packagedClassicApp" 
		 uap10:Subsystem="console" 
		 uap10:SupportsMultipleInstances="true" 
		 uap10:TrustLevel="mediumIL">
		     
    <uap:VisualElements DisplayName="Julia UWP" 
                         Square150x150Logo="icon.png"
                         Square44x44Logo="icon.png"
                         BackgroundColor="transparent"
                         Description="Julia UWP">
       <uap:DefaultTile
           Wide310x150Logo="icon.png"
           ShortName="Julia UWP"
           Square71x71Logo="icon.png"
           Square310x310Logo="icon.png">
       </uap:DefaultTile>
     </uap:VisualElements>
    </Application>
  </Applications>

  <Capabilities>
    <rescap:Capability Name="runFullTrust"/>
  </Capabilities>

</Package>

This file shall be placed within a Julia directory from which a PowerShell can register it with

Add-AppPackage -register AppxManifest.xml

That adds a start menu item for Julia UWP which should work and open Julia console when launched.

Reproducing the Error

The resulting application with the full trust capability works so let’s take the next step. We can remove full trust capability from the AppxManifest.xml by setting EntryPoint="app", RuntimeBehavior="windowsApp" and TrustLevel="appContainer", which results in:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" 
         xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
         xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
         xmlns:uap11="http://schemas.microsoft.com/appx/manifest/uap/windows10/10" 
         xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">

  <Identity Name="JuliaUWP" 
            Publisher="CN=JuliaUser" 
            Version="0.1.0.0" />

  <Properties>
    <DisplayName>JuliaUWP</DisplayName>
    <PublisherDisplayName>AppBundler</PublisherDisplayName>
    <Logo>assets\icon.png</Logo>
  </Properties>

  <Dependencies> 
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.10240.0" MaxVersionTested="10.0.19041.0" />
  </Dependencies>

  <Resources>
    <Resource Language="en-us" />
  </Resources>

<Applications>
    <Application EntryPoint="app" 
		 Executable="bin\julia.exe" 
		 Id="JuliaUWP" 
		 uap10:RuntimeBehavior="windowsApp" 
		 uap10:Subsystem="console" 
		 uap10:SupportsMultipleInstances="true" 
		 uap10:TrustLevel="appContainer">
		     
    <uap:VisualElements DisplayName="Julia UWP" 
                         Square150x150Logo="icon.png"
                         Square44x44Logo="icon.png"
                         BackgroundColor="transparent"
                         Description="Julia UWP">
       <uap:DefaultTile
           Wide310x150Logo="icon.png"
           ShortName="Julia UWP"
           Square71x71Logo="icon.png"
           Square310x310Logo="icon.png">
       </uap:DefaultTile>
     </uap:VisualElements>
    </Application>
  </Applications>
</Package>

Adding it with Add-AppPackage -register AppxManifest.xml and launching it from the menu reproduces the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions