0

While running a spring boot 3 native application on bellsoft-liberica-vm-core-openjdk17-22.3.0 I'm getting this following error after creating the image.

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

mvn -Pnative native:compile to create the image.

./target/blog to start the image.

Tanbin Mitul
  • 3
  • 1
  • 4
  • Could you post output of `ldd ./target/blog` please? Is it JDK 11 or 17? – peterz Jan 12 '23 at 14:18
  • @peterz I'm using bellsoft-liberica-vm-core-openjdk17-22.3.0. Only creates a problem when using spring-data-jpa. `linux-vdso.so.1 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 libfreetype.so => not found libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2` – Tanbin Mitul Jan 13 '23 at 10:54

1 Answers1

0

Might be a bit late, but I recently faced the same problem (using Ubuntu 22.04).

apt-get install libfreetype-dev will install the required library.


Or you might create a symlink to point to another installed version, as described here: https://stackoverflow.com/a/34257466

(libfreetype6 may already be installed, otherwise it may be via apt-get install libfreetype6).

  1. find the location of the installed library:
$ dpkg -L libfreetype6
/usr/lib/x86_64-linux-gnu/libfreetype.so.6
  1. create a symlink:
$ ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so.6 ~/tmp/lib/libfreetype.so
  1. provide the symlink when running the native-image:
$ LD_LIBRARY_PATH=~/tmp/lib ./build/native/nativeCompile/myAppNativeImage
fladdimir
  • 1,230
  • 1
  • 5
  • 12