Reputation: 1328
I'm trying to build a recipe in yocto / bitbake, but I'm having trouble with build dependencies. Some of these build dependencies are not going to be deployed on target-- they just get statically linked in while building. So, my project needs to have certain static libraries and projects built before it is built. These are specified in the recipe as "DEPENDS" and they get built correctly.
However, when my project tries to run the cmake portion in do_configure, the cmake output complains that it can't find the libraries which have already been generated. Is there any way I can reference the packages in the recipe so bitbake can find the libraries? Or, is there a better way to somehow let cmake know where to find the files it needs?
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
SRC_URI = "git://[path to git project].git;protocol=ssh"
# Modify these as desired
PV = "[Version]+git"
SRCREV = "[Revision]"
S = "${WORKDIR}/git"
DEPENDS = "libnl libtins cmake protobuf protobuf-c libnl jsoncpp"
noinst_LIBRARIES = "
inherit cmake
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
do_configure () {
cd ${S}
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" .
}
Output:
Log data follows:
| DEBUG: Executing python function externalsrc_configure_prefunc
| DEBUG: Python function externalsrc_configure_prefunc finished
| DEBUG: Executing shell function do_configure
| Protobuf autogeneration STARTED
| Protobuf autogeneration FINISHED
| -- Found Protobuf: Protobuf_LIBRARY-NOTFOUND;-lpthread (found version "2.6.1")
| -- Found Protobuf: Protobuf_LIBRARY-NOTFOUND;-lpthread;-lpthread (found version "2.6.1")
| CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
| Please set them or make sure they are set and tested correctly in the CMake files:
| GENL_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| JSON_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| NL_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| Protobuf_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| TINS_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
|
| -- Configuring incomplete, errors occurred!
| See also "[yocto dir]/build/workspace/sources/[my project]/CMakeFiles/CMakeOutput.log".
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at [yocto dir]/build/tmp/work/[target]/[my project]/[version]+git-r0/temp/log.do_configure.24245)
Upvotes: 1
Views: 2061
Reputation: 1929
Invoking cmake manually in do_configure isn't a good practice. See the the manual:
When you use CMake, your recipe needs to inherit the cmake class and your recipe does not have to contain a do_configure task. You can make some adjustments by setting EXTRA_OECMAKE to pass any needed configure options that are specific to the recipe.
The reason that OE is adding important parameters like paths and toolchain file to the invocation of cmake, see cmake.bbclass.
Please try with do_configure
removed and add your custom arguments to EXTRA_OECMAKE
.
Upvotes: 1