Search code examples
c++kotlinkorge

Error "Unable to find library" thrown when compiling native with Korge


I'm trying to test out the Kotlin Game engine called Korge. I downloaded the default "Hello world!" template directly from their website. After downloading, I created a new project from existing files with IDEA and tried to run gradle's script called "runNativeDebug".

I'm currently running Manjaro

uname -a

Linux lifeordeath-pc 4.19.45-1-MANJARO #1 SMP PREEMPT Wed May 22 17:16:41 UTC 2019 x86_64 GNU/Linux

I've tried downloading openal, lib32-openal and freeglut from the AUR repositories. Libraries do get installed, which can be seen from the following

ls /usr/lib | grep -E "glu|openal"
libglui.a
libglui.so.2
libglut.so
libglut.so.3
libglut.so.3.10.0
libopenal.a
libopenal.so
libopenal.so.1
libopenal.so.1.19.1

This is the header file location

ls /usr/include/GL | grep gl
freeglut_ext.h
freeglut.h
freeglut_std.h
glcorearb.h
glew.h
glext.h
gl.h
gl_mangle.h
glu.h
glui.h
glu_mangle.h
glut.h
glxew.h
glxext.h
glx.h
glxint.h
glx_mangle.h
glxmd.h
glxproto.h
glxtokens.h
wglew.h

Download the Template and just run it.

I expected code to just run, but upon clicking the run button, I'm greeted by the following error:

/home/lifeordeath/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lGL
/home/lifeordeath/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lGLU
/home/lifeordeath/.konan/dependencies/clang-llvm-6.0.1-linux-x86-6 /bin/ld.lld: error: unable to find library -lglut
/home/lifeordeath/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lopenal
error: /home/lifeordeath/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld invocation reported errors

Furthermore, JS build of the template works flawlessly.


Solution

  • In the case someone else is facing this issue on Debian-based distros like Ubuntu:

    The solution is here: https://korlibs.soywiz.com/korge/targets/desktop/

    sudo apt-get -y install freeglut3-dev libopenal-dev