Skip to content

Alpine 3.19 + Java 8: Symbol not found: __xstat64 #7455

@bratkartoffel

Description

@bratkartoffel

steps

Running sbt with java 8 on alpine 3.19 fails due to java.lang.UnsatisfiedLinkError.
Try to invoke sbt when running on alpine 3.19, e.g. using docker:

docker run --rm -it alpine:3.19
# inside the container:
apk add openjdk8 bash
cd $(mktemp -d)
# download sbt
wget https://github.com/sbt/sbt/releases/download/v1.9.7/sbt-1.9.7.tgz
tar -xzf sbt-1.9.7.tgz
# create example project (crash)
yes "" | sbt/bin/sbt new scala/hello-world.g8

problem

sbt can't be run when using java 8 and latest musl libc. All invocations fail with the following stacktrace:

/tmp/tmp.aJhdoP # yes "" | sbt/bin/sbt new scala/hello-world.g8
[info] [launcher] getting org.scala-sbt sbt 1.9.7  (this may take some time)...
[info] [launcher] getting Scala 2.12.18 (for sbt)...
java.lang.UnsatisfiedLinkError: Error looking up function '__xstat64': Symbol not found: __xstat64
        at com.sun.jna.Function.<init>(Function.java:252)
        at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:620)
        at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:596)
        at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:582)
        at com.sun.jna.Library$Handler.invoke(Library.java:248)
        at com.sun.proxy.$Proxy0.__xstat64(Unknown Source)
        at sbt.internal.io.Linux64Milli$.$anonfun$getModifiedTimeNative$1(Milli.scala:215)
        at sbt.internal.io.MilliPosixBase.checkedIO(Milli.scala:100)
        at sbt.internal.io.Linux64Milli$.getModifiedTimeNative(Milli.scala:215)
        at sbt.internal.io.Linux64Milli$.getModifiedTimeNative(Milli.scala:210)
        at sbt.internal.io.MilliNative.getModifiedTime(Milli.scala:65)
        at sbt.internal.io.Milli$.getModifiedTime(Milli.scala:387)
        at sbt.io.IO$.$anonfun$getModifiedTimeOrZero$1(IO.scala:1436)
        at sbt.internal.io.Retry$.apply$mJc$sp(Retry.scala:47)
        at sbt.internal.io.Retry$.apply$mJc$sp(Retry.scala:29)
        at sbt.internal.io.Retry$.apply$mJc$sp(Retry.scala:24)
        at sbt.io.IO$.getModifiedTimeOrZero(IO.scala:1436)
        at sbt.internal.classpath.ClassLoaderCache$Key$$anonfun$$lessinit$greater$3.apply(ClassLoaderCache.scala:59)
        at sbt.internal.classpath.ClassLoaderCache$Key$$anonfun$$lessinit$greater$3.apply(ClassLoaderCache.scala:59)
        at scala.collection.immutable.List.map(List.scala:293)
        at sbt.internal.classpath.ClassLoaderCache$Key.<init>(ClassLoaderCache.scala:59)
        at sbt.internal.classpath.ClassLoaderCache$Key.<init>(ClassLoaderCache.scala:60)
        at sbt.internal.classpath.ClassLoaderCache.cachedCustomClassloader(ClassLoaderCache.scala:195)
        at sbt.State$StateOpsImpl$.initializeClassLoaderCache$extension(State.scala:417)
        at sbt.StandardMain$.initialState(Main.scala:286)
        at sbt.xMain$.$anonfun$run$9(Main.scala:112)
        at sbt.io.IO$.withTemporaryDirectory(IO.scala:496)
        at sbt.io.IO$.withTemporaryDirectory(IO.scala:506)
        at sbt.xMain$.run(Main.scala:102)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:59)
        at sbt.xMain.run(Main.scala:47)
        at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
        at xsbt.boot.Launch$.run(Launch.scala:149)
        at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
        at xsbt.boot.Launch$.launch(Launch.scala:159)
        at xsbt.boot.Launch$.apply(Launch.scala:44)
        at xsbt.boot.Launch$.apply(Launch.scala:21)
        at xsbt.boot.Boot$.runImpl(Boot.scala:78)
        at xsbt.boot.Boot$.run(Boot.scala:73)
        at xsbt.boot.Boot$.main(Boot.scala:21)
        at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.UnsatisfiedLinkError: Error looking up function '__xstat64': Symbol not found: __xstat64

expectation

Builds using java 8 on latest alpine release should be possible.

notes

When using Java 11 (openjdk11-jdk) / Java 17 (openjdk17-jdk) / Java 21 (openjdk21-jdk), everything is fine.
When using alpine:3.18, everything is fine too.

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