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

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg" #6729

Closed
H-Lo opened this issue Jun 3, 2023 · 2 comments
Assignees

Comments

@H-Lo
Copy link

H-Lo commented Jun 3, 2023

EDIT: Duplicate of gluonhq/gluonfx-maven-plugin#377


Describe the issue
Installed app crashes with error

dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg"

Steps to reproduce the issue

  1. mvn -e -X -Pandroid gluonfx:build
  2. mvn -e -X -Pandroid gluonfx:package
  3. mvn -e -X -Pandroid gluonfx:install
  4. mvn -e -X -Pandroid gluonfx:nativerun

Environment

  • graalvm-svm-java17-linux-gluon-22.1.0.1-Final
  • JDK-11 or JDK-17 (tried both)
  • maven 3.8.8
  • JavaFX 17 LTS
  • Ubuntu 22.04 LTS
  • AMD64

More details
It seesm that not all dependencies are compiled or packaged. The problem is described here: StackOverflow.
Git repository is not public but please feel free to ask to manage access to it.

[INFO] [SUB] --------- beginning of crash
[INFO] [SUB] E/AndroidRuntime(28624): FATAL EXCEPTION: main
[INFO] [SUB] E/AndroidRuntime(28624): Process: com.thevegcat.TheVegCatApp, PID: 28624
[INFO] [SUB] E/AndroidRuntime(28624): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "JNI_OnLoad_javajpeg" referenced by "/data/app/~~MsvDADBiJ40PbJ6YgoWjVw==/com.thevegcat.TheVegCatApp-jeiDsmOewudHMN1dhopxxA==/lib/arm64/libsubstrate.so"...
[INFO] [SUB] E/AndroidRuntime(28624):   at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
[INFO] [SUB] E/AndroidRuntime(28624):   at java.lang.Runtime.loadLibrary0(Runtime.java:998)
[INFO] [SUB] E/AndroidRuntime(28624):   at java.lang.System.loadLibrary(System.java:1656)
[INFO] [SUB] E/AndroidRuntime(28624):   at com.gluonhq.helloandroid.MainActivity.surfaceCreated(MainActivity.java:107)

pom.xml

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
  <modelVersion>4.0.0</modelVersion>

  <name>The Vegan Catalog App</name>
  <description>The Best World Vegan Catalog by H.Lo</description>

  <groupId>com.thevegcat</groupId>
  <artifactId>TheVegCatApp</artifactId>

  <version>1.0.2</version>

  <packaging>jar</packaging>

  <developers>
    <developer>
      <id>HLo</id>
      <name>Hrvoje Lončar</name>
      <email>[email protected]</email>
    </developer>
  </developers>

  <properties>
    <java.version>17</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <main.class>com.thevegcat.app.TheVegCatApp</main.class>
    <launcher.class>com.thevegcat.app.Launcher</launcher.class>

                  <javafx.LTS.version>17.0.7</javafx.LTS.version>
                 <httpclient5.version>5.2.1</httpclient5.version>
               <jersey-client.version>3.1.2</jersey-client.version>
       <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
          <maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
            <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
       <maven-assembly-plugin.version>3.6.0</maven-assembly-plugin.version>
           <jakarta.ws.rs-api.version>3.1.0</jakarta.ws.rs-api.version>
      <jakarta.activation-api.version>2.1.2</jakarta.activation-api.version>
                      <lombok.version>1.18.28</lombok.version>
         <javafx-maven-plugin.version>0.0.8</javafx-maven-plugin.version>
                <webp-imageio.version>0.1.6</webp-imageio.version>
               <commons-lang3.version>3.12.0</commons-lang3.version>

<!-- BEGIN Android attempt -->

               <charm-glisten.version>6.2.3</charm-glisten.version>
                     <connect.version>2.0.1</connect.version>
                      <attach.version>4.0.18</attach.version>
              <gluonfx.plugin.version>1.0.18</gluonfx.plugin.version>

<!-- END Android attempt -->

  </properties>

  <dependencies>

    <dependency>
      <groupId>jakarta.platform</groupId>
      <artifactId>jakarta.jakartaee-web-api</artifactId>
      <version>10.0.0</version>
    </dependency>

<!-- BEGIN Android attempt -->

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-base</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-graphics</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>jakarta.json</artifactId>
      <version>1.1.6</version>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>2.3.1</version>
      <scope>runtime</scope>
    </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>device</artifactId>
      <version>${attach.version}</version>
    </dependency>

    <dependency>
      <groupId>com.gluonhq.attach</groupId>
      <artifactId>push-notifications</artifactId>
      <version>${attach.version}</version>
    </dependency>

    <dependency>
      <groupId>com.gluonhq.attach</groupId>
      <artifactId>runtime-args</artifactId>
      <version>${attach.version}</version>
    </dependency>

    <dependency>
      <groupId>com.gluonhq.attach</groupId>
      <artifactId>util</artifactId>
      <version>${attach.version}</version>
    </dependency>

<!-- END Android attempt -->

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-swing</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-media</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>${javafx.LTS.version}</version>
    </dependency>

    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>${jakarta.ws.rs-api.version}</version>
    </dependency>

    <dependency>
      <groupId>jakarta.activation</groupId>
      <artifactId>jakarta.activation-api</artifactId>
      <version>${jakarta.activation-api.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
      <version>${httpclient5.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>${jersey-client.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>${jersey-client.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-binding</artifactId>
      <version>${jersey-client.version}</version>
    </dependency>

    <dependency>
      <groupId>org.sejda.imageio</groupId>
      <artifactId>webp-imageio</artifactId>
      <version>${webp-imageio.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3.version}</version>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

  </dependencies>

  <build>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <release>${java.version}</release>
            <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>${javafx-maven-plugin.version}</version>
        <configuration>
          <mainClass>${main.class}</mainClass>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>project-classifier</shadedClassifierName>
              <outputFile>shade\TheVegCatApp.jar</outputFile>
              <transformers>
                <transformer implementation=
                  "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>${launcher.class}</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib/</classpathPrefix>
              <mainClass>${main.class}</mainClass>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${maven-assembly-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>lib/</classpathPrefix>
              <mainClass>${main.class}</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>

<!-- BEGIN Android attempt -->

      <plugin>
        <groupId>com.gluonhq</groupId>
        <artifactId>client-maven-plugin</artifactId>
        <version>0.1.31</version>
        <configuration>
          <mainClass>${main.class}</mainClass>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.gluonhq</groupId>
        <artifactId>gluonfx-maven-plugin</artifactId>
        <version>${gluonfx.plugin.version}</version>
        <configuration>
          <target>${gluonfx.target}</target>
          <mainClass>${main.class}</mainClass>
          <attachList>
            <list>display</list>
            <list>lifecycle</list>
            <list>statusbar</list>
            <list>storage</list>
            <list>device</list>
            <list>push-notifications</list>
            <list>runtime-args</list>
          </attachList>
          <reflectionList>
            <list>com.thevegcat.sample.User</list>
          </reflectionList>

          <!-- ugly fix for 'cannot locate symbol {} referenced by {}'
            caused by bad linking that is made by gluon or graalvm -->
          <!--
          <linkerArgs>
            <arg>android/missing_symbols.o</arg>
          </linkerArgs>
          -->

        </configuration>
      </plugin>

<!-- END Android attempt -->

    </plugins>

  </build>

<!-- BEGIN Android attempt -->

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

<!-- END Android attempt -->

</project>
@H-Lo
Copy link
Author

H-Lo commented Jun 3, 2023

Duplicate of gluonhq/gluonfx-maven-plugin#377

@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reaching out, this looks like a Gluon Substrate issue. please follow up with them on this issue. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants