jbake-org / jbake

Java based open source static site/blog generator for developers & designers.
http://jbake.org
MIT License
1.13k stars 327 forks source link

An API incompatibility was encountered while executing org.jbake:jbake-maven-plugin:2.7.0-rc.6:generate: java.lang.UnsatisfiedLinkError #769

Closed kwin closed 1 year ago

kwin commented 2 years ago

When running the maven plugin on Mac OS (12.6 with Apple Silicon M1 Pro) I encounter the following error

[ERROR] Failed to execute goal org.jbake:jbake-maven-plugin:2.7.0-rc.6:generate (default-generate) on project sling-site: Execution default-generate of goal org.jbake:jbake-maven-plugin:2.7.0-rc.6:generate failed: An API incompatibility was encountered while executing org.jbake:jbake-maven-plugin:2.7.0-rc.6:generate: java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: Unable to execute or load jffi binary stub from `/var/folders/f8/_3c0rvgd00n324sqjc8y_3wr0000gn/T/`. Set `TMPDIR` or Java property `java.io.tmpdir` to a read/write path that is not mounted "noexec".
[ERROR] Can't load library: /Users/konradwindszus/git/sling/sling-site/jffi15806522402867392943.dylib
[ERROR]     at com.kenai.jffi.internal.StubLoader.tempLoadError(StubLoader.java:448)
[ERROR]     at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:433)
[ERROR]     at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:300)
[ERROR]     at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:511)
[ERROR]     at java.base/java.lang.Class.forName0(Native Method)
[ERROR]     at java.base/java.lang.Class.forName(Class.java:398)
[ERROR]     at com.kenai.jffi.Init.load(Init.java:68)
[ERROR]     at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:50)
[ERROR]     at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:46)
[ERROR]     at com.kenai.jffi.Foreign.getInstance(Foreign.java:104)
[ERROR]     at com.kenai.jffi.Platform$ArchHolder.determineCPU(Platform.java:210)
[ERROR]     at com.kenai.jffi.Platform$ArchHolder.<clinit>(Platform.java:197)
[ERROR]     at com.kenai.jffi.Platform.getCPU(Platform.java:311)
[ERROR]     at com.kenai.jffi.Platform.addressMask(Platform.java:345)
[ERROR]     at com.kenai.jffi.MemoryIO.<clinit>(MemoryIO.java:46)
[ERROR]     at com.orientechnologies.common.directmemory.OPointer.createNativeBuffer(OPointer.java:57)
[ERROR]     at com.orientechnologies.common.directmemory.OPointer.getNativeByteBuffer(OPointer.java:31)
[ERROR]     at com.orientechnologies.common.directmemory.OByteBufferPool.acquireDirect(OByteBufferPool.java:145)
[ERROR]     at com.orientechnologies.orient.core.storage.memory.ODirectMemoryOnlyDiskCache$MemoryFile.addNewPage(ODirectMemoryOnlyDiskCache.java:501)
[ERROR]     at com.orientechnologies.orient.core.storage.memory.ODirectMemoryOnlyDiskCache$MemoryFile.access$200(ODirectMemoryOnlyDiskCache.java:463)
[ERROR]     at com.orientechnologies.orient.core.storage.memory.ODirectMemoryOnlyDiskCache.allocateNewPage(ODirectMemoryOnlyDiskCache.java:245)
[ERROR]     at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationBinaryTracking.commitChanges(OAtomicOperationBinaryTracking.java:534)
[ERROR]     at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager.endAtomicOperation(OAtomicOperationsManager.java:338)
[ERROR]     at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager.executeInsideAtomicOperation(OAtomicOperationsManager.java:165)
[ERROR]     at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.create(OAbstractPaginatedStorage.java:667)
[ERROR]     at com.orientechnologies.orient.core.db.OrientDBEmbedded.internalCreate(OrientDBEmbedded.java:768)
[ERROR]     at com.orientechnologies.orient.core.db.OrientDBEmbedded.create(OrientDBEmbedded.java:640)
[ERROR]     at com.orientechnologies.orient.core.db.OrientDB.createIfNotExists(OrientDB.java:269)
[ERROR]     at com.orientechnologies.orient.core.db.OrientDB.createIfNotExists(OrientDB.java:256)
[ERROR]     at org.jbake.app.ContentStore.startup(ContentStore.java:95)
[ERROR]     at org.jbake.app.Oven.bake(Oven.java:160)
[ERROR]     at org.jbake.maven.GenerateMojo.reRender(GenerateMojo.java:81)
[ERROR]     at org.jbake.maven.GenerateMojo.executeInternal(GenerateMojo.java:74)
[ERROR]     at org.jbake.maven.GenerateMojo.execute(GenerateMojo.java:70)
kwin commented 2 years ago

The reason is that two different versions of jffi are referenced and the older one ends up in the classpath. One as transitive one of ascidoctorj -> jruby -> jruby core (version 1.3.1) And the other one as transitive of jbake-core-> orientdb -> jna-posix -> jna-jffi (version 1.3.9)

The first one does not have support for Mac OS Aarch64 yet. One needs to manage the dependencies to use the newer one.

kwin commented 2 years ago

this is the full classpath of the Maven plugin:

collectTime=167597625, DefaultDependencyCollector.transformTime=4876500}
[DEBUG] org.jbake:jbake-maven-plugin:jar:2.7.0-rc.6
[DEBUG]    org.slf4j:slf4j-api:jar:1.7.32:runtime
[DEBUG]    org.slf4j:jul-to-slf4j:jar:1.7.32:runtime
[DEBUG]    org.slf4j:jcl-over-slf4j:jar:1.7.32:runtime
[DEBUG]    ch.qos.logback:logback-classic:jar:1.2.10:runtime
[DEBUG]    ch.qos.logback:logback-core:jar:1.2.10:runtime
[DEBUG]    org.jbake:jbake-core:jar:2.7.0-rc.6:runtime
[DEBUG]       commons-io:commons-io:jar:2.11.0:runtime
[DEBUG]       org.apache.commons:commons-configuration2:jar:2.7:runtime
[DEBUG]          org.apache.commons:commons-text:jar:1.8:runtime
[DEBUG]          commons-logging:commons-logging:jar:1.2:runtime
[DEBUG]       commons-beanutils:commons-beanutils:jar:1.9.4:runtime
[DEBUG]       org.apache.commons:commons-lang3:jar:3.12.0:runtime
[DEBUG]       com.googlecode.json-simple:json-simple:jar:1.1.1:runtime
[DEBUG]       com.orientechnologies:orientdb-core:jar:3.1.20:runtime
[DEBUG]          com.github.jnr:jnr-posix:jar:3.1.15:runtime
[DEBUG]             com.github.jnr:jnr-ffi:jar:2.2.11:runtime
[DEBUG]                org.ow2.asm:asm:jar:9.2:runtime
[DEBUG]                org.ow2.asm:asm-commons:jar:9.2:runtime
[DEBUG]                org.ow2.asm:asm-analysis:jar:9.2:runtime
[DEBUG]                org.ow2.asm:asm-tree:jar:9.2:runtime
[DEBUG]                org.ow2.asm:asm-util:jar:9.2:runtime
[DEBUG]                com.github.jnr:jnr-a64asm:jar:1.0.0:runtime
[DEBUG]                com.github.jnr:jnr-x86asm:jar:1.0.2:runtime
[DEBUG]             com.github.jnr:jnr-constants:jar:0.10.3:runtime
[DEBUG]          org.lz4:lz4-java:jar:1.4.0:runtime
[DEBUG]          com.ibm.icu:icu4j:jar:65.1:runtime
[DEBUG]          com.carrotsearch:hppc:jar:0.8.2:runtime
[DEBUG]          commons-lang:commons-lang:jar:2.6:runtime
[DEBUG]          javax.activation:javax.activation-api:jar:1.2.0:runtime
[DEBUG]       org.jsoup:jsoup:jar:1.14.3:runtime
[DEBUG]    com.sparkjava:spark-core:jar:2.9.3:runtime
[DEBUG]       org.eclipse.jetty:jetty-server:jar:9.4.31.v20200723:runtime
[DEBUG]          javax.servlet:javax.servlet-api:jar:3.1.0:runtime
[DEBUG]          org.eclipse.jetty:jetty-http:jar:9.4.31.v20200723:runtime
[DEBUG]             org.eclipse.jetty:jetty-util:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty:jetty-io:jar:9.4.31.v20200723:runtime
[DEBUG]       org.eclipse.jetty:jetty-webapp:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty:jetty-xml:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty:jetty-servlet:jar:9.4.31.v20200723:runtime
[DEBUG]             org.eclipse.jetty:jetty-security:jar:9.4.31.v20200723:runtime
[DEBUG]       org.eclipse.jetty.websocket:websocket-server:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty.websocket:websocket-common:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty.websocket:websocket-client:jar:9.4.31.v20200723:runtime
[DEBUG]             org.eclipse.jetty:jetty-client:jar:9.4.31.v20200723:runtime
[DEBUG]       org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.31.v20200723:runtime
[DEBUG]          org.eclipse.jetty.websocket:websocket-api:jar:9.4.31.v20200723:runtime
[DEBUG]    org.asciidoctor:asciidoctorj:jar:2.5.2:runtime
[DEBUG]       org.asciidoctor:asciidoctorj-api:jar:2.5.2:runtime
[DEBUG]       org.jruby:jruby:jar:9.2.17.0:runtime
[DEBUG]          org.jruby:jruby-core:jar:9.2.17.0:runtime
[DEBUG]             com.github.jnr:jnr-netdb:jar:1.2.0:runtime
[DEBUG]             com.github.jnr:jnr-enxio:jar:0.32.3:runtime
[DEBUG]             com.github.jnr:jnr-unixsocket:jar:0.38.5:runtime
[DEBUG]             com.github.jnr:jffi:jar:1.3.1:runtime
[DEBUG]             com.github.jnr:jffi:jar:native:1.3.1:runtime
[DEBUG]             org.jruby.joni:joni:jar:2.1.31:runtime
[DEBUG]             org.jruby.jcodings:jcodings:jar:1.0.46:runtime
[DEBUG]             org.jruby:dirgra:jar:0.3:runtime
[DEBUG]             com.headius:invokebinder:jar:1.11:runtime
[DEBUG]             com.headius:options:jar:1.4:runtime
[DEBUG]             com.jcraft:jzlib:jar:1.1.3:runtime
[DEBUG]             com.martiansoftware:nailgun-server:jar:0.9.1:runtime
[DEBUG]             joda-time:joda-time:jar:2.10.5:runtime
[DEBUG]             com.headius:backport9:jar:1.8:runtime
[DEBUG]             javax.annotation:javax.annotation-api:jar:1.3.1:runtime
[DEBUG]          org.jruby:jruby-stdlib:jar:9.2.17.0:runtime
[DEBUG]       com.beust:jcommander:jar:1.72:runtime
[DEBUG]    org.codehaus.groovy:groovy:jar:3.0.9:runtime
[DEBUG]    org.codehaus.groovy:groovy-templates:jar:3.0.9:runtime
[DEBUG]       org.codehaus.groovy:groovy-xml:jar:3.0.9:runtime
[DEBUG]    org.codehaus.groovy:groovy-dateutil:jar:3.0.9:runtime
[DEBUG]    org.freemarker:freemarker:jar:2.3.31:runtime
[DEBUG]    org.thymeleaf:thymeleaf:jar:3.0.14.RELEASE:runtime
[DEBUG]       ognl:ognl:jar:3.1.26:runtime
[DEBUG]          org.javassist:javassist:jar:3.20.0-GA:runtime
[DEBUG]       org.attoparser:attoparser:jar:2.0.5.RELEASE:runtime
[DEBUG]       org.unbescape:unbescape:jar:1.1.6.RELEASE:runtime
[DEBUG]    de.neuland-bfi:jade4j:jar:1.3.2:runtime
[DEBUG]       org.apache.commons:commons-jexl:jar:2.1.1:runtime
[DEBUG]       commons-collections:commons-collections:jar:3.2.2:runtime
[DEBUG]       com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.4.2:runtime
[DEBUG]    com.vladsch.flexmark:flexmark:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-ast:jar:0.62.2:runtime
[DEBUG]          org.jetbrains:annotations:jar:15.0:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-builder:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-collection:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-data:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-dependency:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-format:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-html:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-misc:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-sequence:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-util-visitor:jar:0.62.2:runtime
[DEBUG]    com.vladsch.flexmark:flexmark-profile-pegdown:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-abbreviation:jar:0.62.2:runtime
[DEBUG]          com.vladsch.flexmark:flexmark-util:jar:0.62.2:runtime
[DEBUG]             com.vladsch.flexmark:flexmark-util-options:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-anchorlink:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-aside:jar:0.62.2:runtime
[DEBUG]          com.vladsch.flexmark:flexmark-jira-converter:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-autolink:jar:0.62.2:runtime
[DEBUG]          org.nibor.autolink:autolink:jar:0.6.0:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-definition:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-emoji:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-escaped-character:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-footnotes:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-gfm-tasklist:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-ins:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-jekyll-front-matter:jar:0.62.2:runtime
[DEBUG]          com.vladsch.flexmark:flexmark-ext-yaml-front-matter:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-superscript:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-tables:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-toc:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-typographic:jar:0.62.2:runtime
[DEBUG]       com.vladsch.flexmark:flexmark-ext-wikilink:jar:0.62.2:runtime
[DEBUG]    io.pebbletemplates:pebble:jar:3.1.5:runtime
[DEBUG]    org.yaml:snakeyaml:jar:1.30:runtime
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.1:runtime
kwin commented 2 years ago

Using the following exclusions make the build succeed (obviously without supporting Ascidoctor markup):

      <plugin>
        <groupId>org.jbake</groupId>
        <artifactId>jbake-maven-plugin</artifactId>
        <version>2.7.0-rc.6</version>

        <executions>
          <execution>
            <id>default-generate</id>
            <phase>compile</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj</artifactId>
                <version>2.5.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
      </plugin>

Updating to ascidoctor-j 2.5.6 fixes that issue as well, as it uses a newer JRuby:

      <plugin>
        <groupId>org.jbake</groupId>
        <artifactId>jbake-maven-plugin</artifactId>
        <version>2.7.0-rc.6</version>

        <executions>
          <execution>
            <id>default-generate</id>
            <phase>compile</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj</artifactId>
                <version>2.5.6</version>
            </dependency>
        </dependencies>
      </plugin>