I’ve been trying to build easyrpg-player 0.8.1 from source on my Gentoo Linux machine, as per the instructions provided in liblcf’s README.md and easyrpg-player’s BUILDING.md. It’s a simple process, but for some reason, whenever it comes time to run cmake . -DCMAKE_BUILD_TYPE=Release when building the latter, it tells me the liblcf config files for cmake are the wrong version…specifically, that they’re an unknown version, somehow, despite clearly stating in the relevant files that it’s v0.8.1 just like it should be.
Proof from /usr/lib/cmake/liblcf/liblcf-config.cmakethat everything is as it should be:
# For "simplicity" reasons depend on pkg-config when liblcf was compiled with autotools
include(CMakeFindDependencyMacro)
find_dependency(PkgConfig REQUIRED QUIET)
pkg_check_modules(liblcf REQUIRED QUIET IMPORTED_TARGET liblcf=0.8.1)
get_property(library_name TARGET PkgConfig::liblcf PROPERTY INTERFACE_LINK_LIBRARIES)
if (library_name MATCHES ".a$")
list(REMOVE_ITEM liblcf_STATIC_LIBRARIES lcf)
set_property(TARGET PkgConfig::liblcf APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "${liblcf_STATIC_LIBRARIES}")
set_property(TARGET PkgConfig::liblcf APPEND PROPERTY
INTERFACE_LINK_DIRECTORIES "${liblcf_STATIC_LIBRARY_DIRS}")
endif()
add_library(liblcf::liblcf ALIAS PkgConfig::liblcf)
And the output of cmake . -DCMAKE_BUILD_TYPE=Release, which claims otherwise:
-- The CXX compiler identification is GNU 15.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found SDL2: /usr/lib64/cmake/SDL2 (SDL2::SDL2, v2.32.8)
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:1093 (message):
The following required packages were not found:
- liblcf=0.8.1
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPkgConfig.cmake:1166 (_pkg_check_modules_internal)
/usr/lib/cmake/liblcf/liblcf-config.cmake:7 (pkg_check_modules)
builds/cmake/Modules/PlayerFindPackage.cmake:66 (find_package)
CMakeLists.txt:921 (player_find_package)
CMake Error at builds/cmake/Modules/PlayerFindPackage.cmake:66 (find_package):
Could not find a configuration file for package "liblcf" that is compatible
with requested version "0.8.1".
The following configuration files were considered but not accepted:
/usr/lib/cmake/liblcf/liblcf-config.cmake, version: unknown
The version found is not compatible with the version requested.
/lib/cmake/liblcf/liblcf-config.cmake, version: unknown
The version found is not compatible with the version requested.
Call Stack (most recent call first):
CMakeLists.txt:921 (player_find_package)
-- Configuring incomplete, errors occurred!
I’ve deleted and recompiled both liblcf and easyrpg-player multiple times, attempted to fudge the versions in the build files themselves, all to no avail. It seems like it should be a simple error somewhere in something, but I have absolutely no idea where or what it is. Has anyone else had this issue recently?
Strange. What does pkg-config --libs liblcf output? Expected output is -llcf. If this fails it must be a config error on your system (wrong PKG_CONFIG_PATH?). If it returns the correct value I have no idea
About building with CMake: Ah right. In source builds are discouraged in various projects.
…well, that’s interesting At least it’s throwing a different error when I try building with the version compiled with cmake:
dodec@franklin2 ~/easyrpg-player-0.8.1 $ cmake . -DCMAKE_BUILD_TYPE=Release
-- Found SDL2: /usr/lib64/cmake/SDL2 (SDL2::SDL2, v2.32.8)
-- Found inih: /usr/lib64/libinih.so
-- Found ICU: /usr/include (found version "78.2") found components: i18n uc data
CMake Error at builds/cmake/Modules/PlayerFindPackage.cmake:66 (find_package):
Found package configuration file:
/usr/local/lib64/cmake/liblcf/liblcf-config.cmake
but it set liblcf_FOUND to FALSE so package "liblcf" is considered to be
NOT FOUND.
Call Stack (most recent call first):
CMakeLists.txt:921 (player_find_package)
-- Configuring incomplete, errors occurred!
It turned out $PKG_CONFIG_PATH was empty so I fixed that, but it’s still giving the same error, even though pkg-config –libs liblcf now returns -L/usr/lib -llcf.
The offending /usr/local/lib64/cmake/liblcf/liblcf-config.cmake:
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was liblcf-config.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
include(CMakeFindDependencyMacro)
# Required to find our installed Findinih.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
if(1)
find_dependency(inih REQUIRED)
endif()
if(1 EQUAL 1)
find_dependency(ICU COMPONENTS i18n uc data REQUIRED)
endif()
if(1 EQUAL 1)
find_dependency(expat CONFIG REQUIRED)
elseif(1 EQUAL 2)
# Fallback to old expat detection
find_dependency(EXPAT REQUIRED)
endif()
## Create aliases for common expat target names
# The config file creates expat::expat
if (TARGET expat::expat AND NOT TARGET EXPAT::EXPAT)
add_library(EXPAT::EXPAT ALIAS expat::expat)
endif()
# The find module creates EXPAT::EXPAT
if (TARGET EXPAT::EXPAT AND NOT TARGET expat::expat)
add_library(expat::expat ALIAS EXPAT::EXPAT)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/liblcf-targets.cmake)
It…looks like it did, huh, I was able to run a game just fine after all that. Now I have to wonder whether it was compiling liblcf with cmake or fixing $PKG_CONFIG_PATH was what did it Marking this as solved, somehow…