javadockergraalvmgraalvm-native-imagegluonfx

Gluonfx build using docker fails, with error: Cannot run program "ie4uinit": CreateProcess error=2, The system cannot find the file specified


I'm building a native image using the Gluonfx plugin. I'm doing this procedure inside a docker container. The image builds the 7 steps, but doing the link throws an error complaining about missing ie4uinit.exe.

These are the error logs:

[Mon Mar 28 21:14:21 UTC 2022][INFO] Substrate is tested with the Gluon's GraalVM build which you can find at https://github.com/gluonhq/graal/releases.
While you can still use other GraalVM builds, there is no guarantee that these will work properly with Substrate
[Mon Mar 28 21:14:22 UTC 2022][INFO] ==================== LINK TASK ====================
[Mon Mar 28 21:14:22 UTC 2022][INFO] Default icon.ico image generated in C:\temp\target\gluonfx\x86_64-windows\gensrc\windows\assets.
Consider copying it to C:\temp\src\windows before performing any modification
[Mon Mar 28 21:14:22 UTC 2022][INFO] [SUB] Microsoft (R) Incremental Linker Version 14.31.31104.0
[Mon Mar 28 21:14:22 UTC 2022][INFO] [SUB] Copyright (C) Microsoft Corporation.  All rights reserved.
[Mon Mar 28 21:14:22 UTC 2022][INFO] [SUB]
[Mon Mar 28 21:14:22 UTC 2022][INFO] [SUB]    Creating library C:\temp\target\gluonfx\x86_64-windows\X XXX.lib and object C:\temp\target\gluonfx\x86_64-windows\X XXX.exp
java.io.IOException: Cannot run program "ie4uinit": CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
        at com.gluonhq.substrate.util.ProcessRunner.setupProcess(ProcessRunner.java:378)
        at com.gluonhq.substrate.util.ProcessRunner.runProcess(ProcessRunner.java:236)
        at com.gluonhq.substrate.util.ProcessRunner.runProcess(ProcessRunner.java:222)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.target.WindowsTargetConfiguration.clearExplorerCache(WindowsTargetConfiguration.java:276)
        at com.gluonhq.substrate.target.WindowsTargetConfiguration.link(WindowsTargetConfiguration.java:224)
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.SubstrateDispatcher.nativeLink(SubstrateDispatcher.java:443)
        at com.gluonhq.NativeLinkMojo.execute(NativeLinkMojo.java:47)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
        at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
[INFO] Total time:  06:39 min
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
[INFO] Finished at: 2022-03-28T21:14:25Z
[INFO] ------------------------------------------------------------------------
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)

I would like to know if it's possible to add this dependency to my docker image. Or, if not possible, a possible way to suppress the use of it in gluonfx through configuration.

Docker image:

# escape=`
# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]

RUN `
    # Download the Build Tools bootstrapper.
    curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
    `
    # Install Build Tools, excluding workloads and components with known issues.
    && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache modify `
        --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
        --add Microsoft.VisualStudio.Workload.AzureBuildTools `
        --add Microsoft.VisualStudio.Workload.VCTools `
        --add Microsoft.VisualStudio.Component.VC.140 `
        --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
        --add Microsoft.VisualStudio.Component.VC.CMake.Project `
        --add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
        --add Microsoft.VisualStudio.Component.VC.Llvm.Clang `
        --add Microsoft.Net.Component.4.8.SDK `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
        --remove Microsoft.VisualStudio.Component.Windows81SDK `
        || IF "%ERRORLEVEL%"=="3010" EXIT 0) `
    `
    # Cleanup
    && del /q vs_buildtools.exe

#Installing GraalVM
ADD https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-windows-amd64-22.0.0.2.zip /
RUN powershell -Command "expand-archive -Path 'c:\graalvm-ce-java11-windows-amd64-22.0.0.2.zip' -DestinationPath 'c:\'"

#ADD  https://download2.gluonhq.com/substrate/javafxstaticsdk/openjfx-18-ea+14-windows-x86_64-static.zip / C:\Users\ContainerAdministrator\.gluon\substrate\

#Installing Maven
ADD https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.zip /
RUN powershell -Command "expand-archive -Path 'c:\apache-maven-3.8.5-bin.zip' -DestinationPath 'c:\'"

ENV JAVA_HOME C:\graalvm-ce-java11-22.0.0.2\
ENV MAVEN_HOME C:\apache-maven-3.8.5\
ENV GRAALVM_HOME C:\graalvm-ce-java11-22.0.0.2\
ENV JAVA_OPTS -Xmx1g
RUN setx PATH "%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin"

WORKDIR C:/temp/

# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

Solution

  • Finally found the solution: Changing the base docker image to: mcr.microsoft.com/windows:1809-amd64

    This one contains the necessary dependencies to complete the build process. This is finally my Dockerfile (Anyways, if you know a lighter image or docker configuration to perform the build with gluonfx, please post in the comments. I will appreciate):

    # escape=`
    # Use A windows base image.
    FROM mcr.microsoft.com/windows:1809-amd64
    
    # Restore the default Windows shell for correct batch processing.
    SHELL ["cmd", "/S", "/C"]
    
    RUN `
        # Download the Build Tools bootstrapper.
        curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
        `
        # Install Build Tools, excluding workloads and components with known issues.
        && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
            --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
            --add Microsoft.VisualStudio.Workload.AzureBuildTools `
            --add Microsoft.VisualStudio.Workload.VCTools `
            --add Microsoft.VisualStudio.Component.VC.140 `
            --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
            --add Microsoft.VisualStudio.Component.VC.CMake.Project `
            --add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
            --add Microsoft.VisualStudio.Component.VC.Llvm.Clang `
            --add Microsoft.Net.Component.4.8.SDK `
            --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
            --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
            --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
            --remove Microsoft.VisualStudio.Component.Windows81SDK `
            || IF "%ERRORLEVEL%"=="3010" EXIT 0) `
        `
        # Cleanup
        && del /q vs_buildtools.exe
    
    #Installing GraalVM
    ADD https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-windows-amd64-22.0.0.2.zip /
    RUN powershell -Command "expand-archive -Path 'c:\graalvm-ce-java11-windows-amd64-22.0.0.2.zip' -DestinationPath 'c:\'"
    
    #Installing Maven
    ADD https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.zip /
    RUN powershell -Command "expand-archive -Path 'c:\apache-maven-3.8.5-bin.zip' -DestinationPath 'c:\'"
    
    ENV JAVA_HOME C:\graalvm-ce-java11-22.0.0.2\
    ENV MAVEN_HOME C:\apache-maven-3.8.5\
    ENV GRAALVM_HOME C:\graalvm-ce-java11-22.0.0.2\
    ENV JAVA_OPTS -Xmx1g
    RUN setx PATH "%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin"
    
    WORKDIR C:/temp/
    
    # Define the entry point for the docker container.
    # This entry point starts the developer command prompt and launches the PowerShell shell.
    ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]