msink / kotlin-libui

Kotlin/Native interop to libui: a portable GUI library
MIT License
650 stars 50 forks source link

"ld.lld: error: unable to find library" on CentOS7 #23

Closed komkomh closed 5 years ago

komkomh commented 5 years ago

Hello. I tried to work hello-ktx sample according to README in this project. But it doesn't work and output this error.

Task :samples:controlgallery:linkReleaseExecutableLinux FAILED /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lgtk-3 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lgdk-3 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -latk-1.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lgio-2.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lpangocairo-1.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lgdk_pixbuf-2.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lcairo-gobject /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lpango-1.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lcairo /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lgobject-2.0 /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: unable to find library -lglib-2.0 e: /home/komkomh/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld invocation reported errors FAILURE: Build failed with an exception.

My os version is CentOS Linux release 7.6.1810 (Core)

Please give me a hint. Thanks

msink commented 5 years ago

Maybe not documented here, but documented in upstream libui: https://github.com/andlabs/libui/blob/master/README.md#runtime-requirements Linux version requires GTK+ 3.10 or newer

If it is installed - what is output of pkg-config --libs gtk3 ?

komkomh commented 5 years ago

Hello

Thank you your quick response. I checked my gtk3 version.

pkg-config --modversion gtk+-3.0

3.22.30

pkg-config --libs gtk+-3.0

-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0

msink commented 5 years ago

Ok, it's installed properly. Well, now - where is it installed on CentOS? If - I can guess - in /usr/lib64 - please try add it to library path, and rebuild:

--- a/libui/src/nativeInterop/cinterop/libui.def
+++ b/libui/src/nativeInterop/cinterop/libui.def
@@ -7,7 +7,7 @@ libraryPaths = build libui/build

 linkerOpts.osx = -lobjc -framework Foundation -framework AppKit

-linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -L/usr/lib \
+linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -L/usr/lib \
     -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 \
     -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lm -ldl
komkomh commented 5 years ago

Thank you! I was able to solve the problem. I'm sorry for the basic questions.

msink commented 5 years ago

So -L/usr/lib64 helped on CentOS? If yes - I'll add it to next published version.

komkomh commented 5 years ago

Yes, I found gtk3 in -L/usr/lib64