gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
194 stars 39 forks source link

Current target does not support the following CPU features that are required by the image: [FP, ASIMD] #473

Closed tretonio closed 1 year ago

tretonio commented 1 year ago

Maven NetBeans Env.GRAALVM_HOME=/path/graalvm/graalvm-svm-java17-linux-gluon-22.1.0.1-Final/ Env.ANDROID_SDK=/path/Android/Sdk/ Env.ANDROID_NDK=/path/Android/Sdk/ndk-bundle/ Env.JAVA_HOME=/path/graalvm/graalvm-svm-java17-linux-gluon-22.1.0.1-Final

pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.gluonapplication4</groupId>
    <artifactId>gluonapplication4</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>GluonApplication4</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>11</maven.compiler.release>
        <javafx.version>21-ea+5</javafx.version>
        <attach.version>4.0.18</attach.version>
        <gluonfx.plugin.version>1.0.18</gluonfx.plugin.version>
        <javafx.plugin.version>0.0.8</javafx.plugin.version>
        <mainClassName>com.gluonapplication4.GluonApplication4</mainClassName>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq</groupId>
            <artifactId>charm-glisten</artifactId>
            <version>6.2.3</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>display</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>lifecycle</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>statusbar</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>storage</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>util</artifactId>
            <version>${attach.version}</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>Gluon</id>
            <url>https://nexus.gluonhq.com/nexus/content/repositories/releases</url>
        </repository> 
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>Sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>

            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>${javafx.plugin.version}</version>
                <configuration>
                    <mainClass>${mainClassName}</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <!-- Default configuration for running -->
                        <!-- Usage: mvn clean javafx:run -->
                        <id>default-cli</id>
                    </execution>
                    <execution>
                        <!-- Configuration for manual attach debugging -->
                        <!-- Usage: mvn clean javafx:run@debug -->
                        <id>debug</id>
                        <configuration>
                            <options>
                                <option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000</option>
                            </options>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Configuration for automatic IDE debugging -->
                        <id>ide-debug</id>
                        <configuration>
                            <options>
                                <option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
                            </options>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Configuration for automatic IDE profiling -->
                        <id>ide-profile</id>
                        <configuration>
                            <options>
                                <option>${profiler.jvmargs.arg1}</option>
                                <option>${profiler.jvmargs.arg2}</option>
                                <option>${profiler.jvmargs.arg3}</option>
                                <option>${profiler.jvmargs.arg4}</option>
                                <option>${profiler.jvmargs.arg5}</option>
                            </options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.gluonhq</groupId>
                <artifactId>gluonfx-maven-plugin</artifactId>
                <version>${gluonfx.plugin.version}</version>
                <configuration>
                    <target>${gluonfx.target}</target>
                    <attachList>
                        <list>display</list>
                        <list>lifecycle</list>
                        <list>statusbar</list>
                        <list>storage</list>
                    </attachList>
                    <reflectionList>
                        <list>com.gluonapplication4.views.PrimaryPresenter</list>
                        <list>com.gluonapplication4.views.SecondaryPresenter</list>
                    </reflectionList>
                    <mainClass>${mainClassName}</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ios</id>
            <properties>
                <gluonfx.target>ios</gluonfx.target>
            </properties>
        </profile>
        <profile>
            <id>android</id>
            <properties>
                <gluonfx.target>android</gluonfx.target>                 
            </properties>
        </profile>
    </profiles>
</project>

OS Linux Ubuntu 20.04 LTS Linux 5.15.0-71-generic #78~20.04.1-Ubuntu SMP Wed Apr 19 11:26:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux


sdkmanager --list

Installed packages:


  Path                                        | Version      | Description                                 | Location                                   
  -------                                     | -------      | -------                                     | -------                                    
  build-tools;30.0.3                          | 30.0.3       | Android SDK Build-Tools 30.0.3              | build-tools/30.0.3                         
  build-tools;31.0.0                          | 31.0.0       | Android SDK Build-Tools 31                  | build-tools/31.0.0                         
  cmdline-tools;latest                        | 9.0          | Android SDK Command-line Tools (latest)     | cmdline-tools/latest                       
  emulator                                    | 32.1.12      | Android Emulator                            | emulator                                   
  extras;android;m2repository                 | 47.0.0       | Android Support Repository                  | extras/android/m2repository                
  extras;google;auto                          | 2.0          | Android Auto Desktop Head Unit Emulator     | extras/google/auto                         
  extras;google;m2repository                  | 58           | Google Repository                           | extras/google/m2repository                 
  extras;google;simulators                    | 1            | Android Auto API Simulators                 | extras/google/simulators                   
  ndk-bundle                                  | 22.1.7171670 | NDK                                         | ndk-bundle                                 
  ndk;25.2.9519653                            | 25.2.9519653 | NDK (Side by side) 25.2.9519653             | ndk/25.2.9519653                           
  patcher;v4                                  | 1            | SDK Patch Applier v4                        | patcher/v4                                 
  platform-tools                              | 34.0.1       | Android SDK Platform-Tools                  | platform-tools                             
  platforms;android-31                        | 1            | Android SDK Platform 31                     | platforms/android-31                       
  skiaparser;3                                | 3            | Layout Inspector image server for API 31-34 | skiaparser/3                               
  sources;android-31                          | 1            | Sources for Android 31                      | sources/android-31                         
  system-images;android-28;google_apis;x86_64 | 11           | Google APIs Intel x86 Atom_64 System Image  | system-images/android-28/google_apis/x86_64
  system-images;android-31;google_apis;x86_64 | 13           | Google APIs Intel x86_64 Atom System Image  | system-images/android-31/google_apis/x86_64

```------

Emulator
./emulator -avd Nexus_6_API_31
INFO    | Android emulator version 32.1.12.0 (build_id 9751036) (CL:N/A)
INFO    | Found systemPath /path/Android/Sdk/system-images/android-31/google_apis/x86_64/

--------

mvn gluonfx:build -Pandroid            // work correct
mvn gluonfx:package  -Pandroid     // work correct
-rw-rw-r-- 1 jorge jorge 27609020 mai 16 16:57 GluonApplication4.aab
-rw-rw-r-- 1 jorge jorge 29844613 mai 16 16:56 GluonApplication4.apk

mvn gluonfx:install  -Pandroid          // transfer correct to virtual device 
mvn gluonfx:nativerun -Pandroid     // init app and close

[ter. mai. 16 17:41:40 BRT 2023][INFO] ==================== RUN TASK ====================
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] --------- beginning of system
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Slow operation: 83ms so far, now at startProcess: returned from zygote!
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Slow operation: 170ms so far, now at startProcess: done updating battery stats
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Slow operation: 175ms so far, now at startProcess: building log message
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Slow operation: 204ms so far, now at startProcess: starting to update pids map
[ter. mai. 16 17:41:41 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Slow operation: 360ms so far, now at startProcess: done updating pids map
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Unable to start service Intent { act=android.service.smartspace.SmartspaceService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiSmartspaceService } U=0: not found
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] W/ActivityManager(  503): Unbind failed: could not find connection for android.app.LoadedApk$ServiceDispatcher$InnerConnection@1746f46
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] --------- beginning of main
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onCreate start, using Android Logging v1
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onCreate done
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onStart
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onStart done
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onResume
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): onResume done
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): surfaceCreated for com.gluonhq.helloandroid.MainActivity@b98b1e1
[ter. mai. 16 17:41:42 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): loading substrate library
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): AndroidVM called JNI_OnLoad, vm = 0x70ba0307fc10, androidEnv = 0x70b9f307e690
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): loaded substrate library
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): nativeSetSurface called, env at 0x70b9f307e690 and size 8, surface at 0x7ffcc663d06c
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): native setSurface Ready, native window at 0x70bab30884c0
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): metrics = DisplayMetrics{density=3.5, width=1440, height=2392, scaledDensity=3.5, xdpi=560.0, ydpi=560.0}, density = 3.5
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): SurfaceReady, surface at 0x7ffcc663d04c
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): SurfaceReady, native window at 0x70bab30884c0
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): Surface created, native code informed about it, nativeWindow at 123947169907904
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): We will now launch Graal in a separate thread
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): graalStarted true
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): surfaceCreated done
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): [MainActivity] surfaceChanged, format = 4, width = 1440, height = 2308
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): nativeSetSurface called, env at 0x70b9f307e690 and size 8, surface at 0x7ffcc663d07c
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): native setSurface Ready, native window at 0x70bab30884c0
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): surfaceChanged done, metrics = DisplayMetrics{density=3.5, width=1440, height=2392, scaledDensity=3.5, xdpi=560.0, ydpi=560.0}, density = 3.5
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): SurfaceRedraw needed: ask native graal layer to redraw surface
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): launcher, nativeSurfaceRedrawNeeded called. Invoke method on glass_monocle
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): surfaceredraw needed part 1 done
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] D/GraalCompiled( 4642): s_glBindAttribLocation: bind attrib 0 name position
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] D/GraalCompiled( 4642): s_glBindAttribLocation: bind attrib 1 name color
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): launcher, nativeSurfaceRedrawNeeded called. Invoke method on glass_monocle
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] V/GraalActivity( 4642): surfaceredraw needed (and wait) done
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): Start GraalApp, DALVIK env at 0x70b9f30b6450
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): PAGESIZE = 4096
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): EnvVersion = 65542
[ter. mai. 16 17:41:43 BRT 2023][INFO] [SUB] E/GraalGluon( 4642): calling JavaMainWrapper_run with argsize: 23
[ter. mai. 16 17:41:44 BRT 2023][INFO] [SUB] D/GraalCompiled( 4642): Fatal error: Current target does not support the following CPU features that are required by the image: [FP, ASIMD]

 =======

I don't know if there is an incompatibility with the emulator version or if something is missing in the linux configuration.
Where inside the pom.xml do you configure the android sdk version?

Thanks
ShowMeTheStack commented 1 year ago

I am running into this issue. I am looking for help here and believe that I am probably missing something minor somewhere. I did everything the docs tell me. Thank you!

jperedadnr commented 1 year ago

Android emulator with architecture x86_64 won't work, you need aarch64. There was a similar issue with the old JavaFXPorts plugin, and correct emulator worked: https://stackoverflow.com/a/44544233/3956070