No rule to make target 'install'

While compiling the minimal.cpp example of TensorFlow Lite with cmake on Yocto platform, we are having error as follows:

    Log data follows:
| DEBUG: Executing shell function do_install
| NOTE: make -j 4 DESTDIR=/home/student/fsl-release-bsp/build-analytics-tflite/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/minimal/1.0-r0/image install
| ERROR: oe_runmake failed
| make: *** No rule to make target 'install'.  Stop.
| ERROR: Function failed: do_install (log file is located at /home/student/fsl-release-bsp/build-analytics-tflite/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/minimal/1.0-r0/temp/log.do_install.2654)
ERROR: Task (/home/student/fsl-release-bsp/sources/meta-analytics-tflite/recipes-hello/patch/minimal.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1787 tasks of which 1786 didn't need to be rerun and 1 failed.

On the install line of our CMakeLists.txt file the idea is not clear in our mind about “TARGETS”. If you brighten up our mind it would be perfect.

  • The CMakeLists.txt file is as follows:
cmake_minimum_required(VERSION 3.6)

project(patch)

add_executable(minimal minimal.cc)

target_include_directories(minimal PUBLIC /home/student/fsl-release-bsp/build-analytics-tflite/tmp/sysroots/analytics/usr/include/tensorflow/contrib/lite/tools/make/downloads/flatbuffers/include)

target_link_libraries(minimal tensorflow-lite pthread ${CMAKE_DL_LIBS})

install(TARGETS patch DESTINATION git)

Your guidance and clarifications are important for us.

Thank you in advance !

You don’t have a patch target. Did you mean TARGETS minimal?

Exactly ! We fixed that but still having the same error.
About the DESTINATION should we address the full path of new created file ?

DESTINATION is the directory under ${CMAKE_INSTALL_PREFIX} to place the artifact(s). So you’ll have /usr/local/git/minimal (using the default CMAKE_INSTALL_PREFIX) here.

By commenting out the target_include_directories and target_link_libraries lines with a very minimal minimal.cc, I get an install target at least. Is there a cmake_install.cmake file in your build tree? What generator are you using?

Oh, I just read it much closer. Your minimal example is not representative of your error.

Somewhere in your build, you have an oe_runmake with a do_install target. There’s a Makefile in /home/student/… that doesn’t have an install target. Wherever that is specified needs more investigation as to what is trying to do that and/or why it isn’t available.

First of all thank you for your kind effort, we are working on Yocto platform and we have recipe(.bb) files which also includes do_install target. In our bitbake file we did not put do_install because we assume inherit cmake covers that tasks. Maybe the reason of error is that. Below you can find our .bb file;

SUMMARY = "Recipe for the Hello World program"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

DEPENDS += "opencv"
DEPENDS += "libconfig"
DEPENDS += "tensorflow-lite"

SRC_URI = "git://github.com/aniladar/patch.git;protocol=https;branch=main"

SRCREV = "${AUTOREV}"

# Here we specify the source directory, where we do all the building and expect sources to be placed
S = "${WORKDIR}/git"

inherit cmake

I’m not familiar with bitbake or Yocto myself. I’d track down other users of inherit cmake and try and strip them down to see what you’re missing. Other than that, the Yocto development lists are likely to be more helpful (though others might know some Yocto here, this feels more like a Yocto-using-CMake kind of question).