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

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

Closed
joggeli34 opened this issue Nov 26, 2021 · 15 comments · Fixed by #20850
Closed

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

joggeli34 opened this issue Nov 26, 2021 · 15 comments · Fixed by #20850
Labels
area/container-image kind/bug Something isn't working
Milestone

Comments

@joggeli34
Copy link
Contributor

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

@joggeli34 joggeli34 added the kind/bug Something isn't working label Nov 26, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 26, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Nov 26, 2021

cc @cescoffier

@cescoffier
Copy link
Member

The runtime image does not provide libfreetype.so.6 by default (to save space). Do you know which part of your app needs it?

@joggeli34
Copy link
Contributor Author

No, I have no idea where it is used. The app is more or less a simple CRUD-Application. It must be somewhere in the dependencies changed from quarkus 2.4.2.Final to 2.5.0.Final.

@joggeli34
Copy link
Contributor Author

Comparing the dependencies, I see that the quarkus-liquibase has now a dependency to quarkus-awt, which was not before.
I assume that awt could use the libfreetype, but it is just a guess.

+--- io.quarkus:quarkus-liquibase -> 2.5.0.Final
|    +--- io.quarkus:quarkus-core:2.5.0.Final (*)
|    +--- org.liquibase:liquibase-core:4.6.1
|    +--- org.yaml:snakeyaml:1.29
|    +--- io.quarkus:quarkus-jaxb:2.5.0.Final
|    |    +--- io.quarkus:quarkus-core:2.5.0.Final (*)
|    |    +--- io.quarkus:quarkus-jaxp:2.5.0.Final
|    |    |    \--- io.quarkus:quarkus-core:2.5.0.Final (*)
|    |    +--- io.quarkus:quarkus-awt:2.5.0.Final
|    |    |    \--- io.quarkus:quarkus-arc:2.5.0.Final (*)
|    |    +--- org.glassfish.jaxb:jaxb-runtime:2.3.3-b02 (*)
|    |    \--- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:2.0.0.Final
|    +--- io.quarkus:quarkus-agroal:2.5.0.Final (*)
|    +--- io.quarkus:quarkus-datasource-common:2.5.0.Final
|    \--- io.quarkus:quarkus-narayana-jta:2.5.0.Final (*)

@cescoffier
Copy link
Member

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.

@maxandersen
Copy link
Member

its unfortunate if we now require bundling of those files if not actually needed :/
@galderz you looked at this earlier. ideas?

@galderz
Copy link
Member

galderz commented Nov 29, 2021

its unfortunate if we now require bundling of those files if not actually needed :/ @galderz you looked at this earlier. ideas?

@Karm is working on improving it.

@wabrit
Copy link

wabrit commented Dec 3, 2021

I presume any quarkus native app which relies on the liquibase extension is not going to run under Quarkus 2.5.x until this issue is fixed? Is there a workaround in the meantime?

@vladimirfx
Copy link

Workaround is build your own base image with needed libs. Actually is what we do in our company.
And yes, for applications that not using fonts or other graphics elements it is just annoying.

@Karm
Copy link
Member

Karm commented Dec 6, 2021

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

@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Dec 7, 2021
@Karm
Copy link
Member

Karm commented Dec 8, 2021

@vladimirfx
Copy link

Thanks, I will check today

@vladimirfx
Copy link

Checked on 2.6.0.CR1 - works fine.
Thank you!

@joggeli34
Copy link
Contributor Author

I checked it out on 2.6.0.CR1 too. Works greate.
Thanks a lot!

dcdh added a commit to dcdh/inner-friends-friends-service that referenced this issue Dec 16, 2021
dcdh added a commit to dcdh/inner-friends-messaging-service that referenced this issue Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container-image kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants