Here’s what I have in my CMakeLists.txt:
link_directories( "/usr/local/lib" ) include(CheckLibraryExists) CHECK_LIBRARY_EXISTS( "libmali-midgard-t76x-r9p0-r0p0.so" "gbm_create_device" "" MALI )
Result:
Looking for gbm_create_device in libmali-midgard-t76x-r9p0-r0p0.so - not found
The symbol exists in that library:
$ nm -D /usr/local/lib/libmali-midgard-t76x-r9p0-r0p0.so | egrep gbm_create_device 001b245c T gbm_create_device
Why cmake doesn’t find that?
Advertisement
Answer
It was dependencies.
CHECK_LIBRARY_EXISTS
is much more complex than nm -D
. CMake actually creates a C project that references that library, and tries to link it.
I missed some dependencies used by that library (libdrm-dev, libxcb-dri2-0, libx11-xcb-dev), so the linker failed.
Resolved by looking what’s in CMakeFiles folder, it contains much more detailed logs.