question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

native image fails to start due to missing libfreetype.so.6 library

See original GitHub issue

Describe the bug

Running a quarkus native application (2.5.0.Final) fails with following error at startup:

./application: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

With 2.4.2.Final it was working correctly

Expected behavior

The application should just start.

Actual behavior

The application can not start.

In the application.properties we have following settings for the native build:

quarkus.jib.base-native-image=quay.io/quarkus/quarkus-micro-image:1.0
quarkus.native.additional-build-args=\
  -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED

as build image we use quay.io/quarkus/ubi-quarkus-native-image:21.3-java17

and the build.gradle has following dependendies:

plugins {
    id 'java'
    id 'io.quarkus'
    id 'com.github.ben-manes.versions'
}

dependencies {
    implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")

    implementation 'io.quarkus:quarkus-jdbc-postgresql'
    implementation 'io.quarkus:quarkus-container-image-jib'
    implementation 'io.quarkus:quarkus-smallrye-openapi'
    implementation 'io.quarkus:quarkus-smallrye-health'
    implementation 'io.quarkus:quarkus-hibernate-orm-panache'
    implementation 'io.quarkus:quarkus-resteasy'
    implementation 'io.quarkus:quarkus-resteasy-jackson'
    implementation 'io.quarkus:quarkus-rest-client'
    implementation 'io.quarkus:quarkus-rest-client-jackson'
    implementation 'io.quarkus:quarkus-liquibase'
    implementation 'io.quarkus:quarkus-arc'
    implementation 'io.quarkus:quarkus-micrometer-registry-prometheus'
    implementation 'io.quarkus:quarkus-scheduler'

    implementation 'org.apache.commons:commons-lang3'
    implementation 'io.quarkiverse.hibernatetypes:quarkus-hibernate-types:0.2.0'

    compileOnly "org.projectlombok:lombok:$lombokVersion"
    annotationProcessor "org.projectlombok:lombok:$lombokVersion"
    testCompileOnly "org.projectlombok:lombok:$lombokVersion"
    testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"

    compileOnly 'org.osgi:osgi.annotation:8.0.1'
    testCompileOnly 'org.osgi:osgi.annotation:8.0.1'

    testImplementation 'at.favre.lib:bcrypt:0.9.0'
    testImplementation 'io.quarkus:quarkus-junit5'
    testImplementation 'io.rest-assured:rest-assured'
}

group 'com.qumea'

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

quarkusDev {
    workingDir = rootProject.projectDir
}

compileJava {
    options.encoding = 'UTF-8'
    options.compilerArgs << '-parameters'
    options.compilerArgs << '-Xlint:all'
    options.compilerArgs << '-Xlint:-exports'
    options.compilerArgs << '-Xlint:-requires-automatic'
    options.compilerArgs << '-Xlint:-processing'
    options.deprecation = true
}

compileTestJava {
    options.encoding = 'UTF-8'
}

quarkusBuild {
    nativeArgs {
        containerBuild = System.env.BITBUCKET_BRANCH == null
        builderImage = "quay.io/quarkus/ubi-quarkus-native-image:21.3-java17"
    }
}

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

Java 17.0.1

GraalVM version (if different from Java)

quay.io/quarkus/ubi-quarkus-native-image:21.3-java17

Quarkus version or git rev

2.5.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 7.3

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Karmcommented, Dec 6, 2021

@wabrit @vladimirfx The fix in #20850 is pretty close to getting merged now 👍

2reactions
cescoffiercommented, Nov 26, 2021

Yes, that’s probably it. So, the approach would be to extend the runtime image to add the lib. Something like https://github.com/quarkusio/quarkus-quickstarts/blob/development/awt-graphics-rest-quickstart/src/main/docker/Dockerfile.native-distroless.

We should document that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linux Collector fails to install with error "libfreetype.so.6
It seems that your Linux distribution is missing the library libfreetype.so.6. To install this library run one of the following commands:
Read more >
libfreetype.so.6: cannot open shared object file - You.com
Your error message states that a shared library is missing. Let's find exactly what PhantomJS is looking for by installing it in a...
Read more >
Java - Docker fails to install dependencies - Html2Pdf library
I managed to do a workaround to this problem by using the native wkhtmltopdf library together with the wkhtmltopdf java wrapper.
Read more >
error while loading shared libraries: libtesseract.so.5
Answers related to “error while loading shared libraries: libtesseract.so.5: cannot open shared object file: No such file or directory'”.
Read more >
Getting Started - GraalVM
Native Image is a technology to compile Java code ahead-of-time to a binary ... standard-library classes, the language runtime, and statically-linked native ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found