Topics

Problem with recipe that depends on a binary that is generated during its build


Matteo Iervasi
 

Hi!

I'm trying to integrate the Icinga (https://github.com/Icinga/icinga2) in our Yocto project. As there are no ready recipes for it, I'm trying to write my own, starting from the one used for Nagios which is the original project Icinga forked from.
Icinga uses CMake for the compile process. Problem is that the compilation relies on two binaries, mkclass and mkunity, that get built by the process itself and obviously the compilation stops because those commands cannot be found.

Searching the web I found only this hint in the Technical FAQ https://wiki.yoctoproject.org/wiki/Technical_FAQ#I_have_some_software_which_needs_to_build_a_binary_that_it_then_runs_as_part_of_its_own_build_process.2C_how_do_I_make_this_work.3F, but the problem is still there.

How can I get around this?


Best regards
Matteo Iervasi


Matteo Iervasi
 

Ok I've found a solution by myself. Basically I just used the trick showed in the Technical FAQ and put a bunch of install commands in the do_install task.
Now the only problem I have is that the do_install task for target complains that needs administrative privileges (maybe I'm just doing it wrong, I'm still not that experienced with Yocto).

| [100%] Built target boosttest-test-livestatus
| make[1]: Leaving directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/recipe-sysroot-native/usr/bin/cmake -E cmake_progress_start /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build/CMakeFiles 0
| make -f CMakeFiles/Makefile2 preinstall
| make[1]: Entering directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| make[1]: Nothing to be done for 'preinstall'.
| make[1]: Leaving directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| Install the project...
| /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/recipe-sysroot-native/usr/bin/cmake -P cmake_install.cmake
| -- Install configuration: "Release"
| CMake Error at cmake_install.cmake:36 (file):
|   file cannot create directory: /usr/share/doc/icinga2.  Maybe need
|   administrative privileges.
|
|
| Makefile:74: recipe for target 'install' failed
| make: *** [install] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_install (log file is located at /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/temp/log.do_install.25788)
ERROR: Task (/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/../layers/meta-boxio-colibri-imx6ull/recipes-extended/icinga-core/icinga-core_2.12.0.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3457 tasks of which 3447 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory

The recipe that now compiles ok is attached here.

Thanks
Matteo Iervasi


Khem Raj
 

On 11/25/20 12:37 AM, Matteo Iervasi wrote:
Ok I've found a solution by myself. Basically I just used the trick showed in the Technical FAQ and put a bunch of install commands in the do_install task.
Now the only problem I have is that the do_install task for target complains that needs administrative privileges (maybe I'm just doing it wrong, I'm still not that experienced with Yocto).
| [100%] Built target boosttest-test-livestatus
| make[1]: Leaving directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/recipe-sysroot-native/usr/bin/cmake -E cmake_progress_start /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build/CMakeFiles 0
| make -f CMakeFiles/Makefile2 preinstall
| make[1]: Entering directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| make[1]: Nothing to be done for 'preinstall'.
| make[1]: Leaving directory '/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/build'
| Install the project...
| /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/recipe-sysroot-native/usr/bin/cmake -P cmake_install.cmake
| -- Install configuration: "Release"
| CMake Error at cmake_install.cmake:36 (file):
|   file cannot create directory: /usr/share/doc/icinga2.  Maybe need
|   administrative privileges.
|
this just means that its not able to relocate the install location to ${D} which is what default do_install should do. So the package needs some work to respect an option to relocate the installation directory once you have that then you can specify that vi OE_EXTRACMAKE += "-D...=${D}" or some such. That could be a fix sent to upstream as well otherwise your fix it ok too for your needs.

|
| Makefile:74: recipe for target 'install' failed
| make: *** [install] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_install (log file is located at /home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/tmp-glibc/work/cortexa7t2hf-neon-angstrom-linux-gnueabi/icinga-core/2.12.0-r0/temp/log.do_install.25788)
ERROR: Task (/home/matteo/boxio/toradex/colibri-imx6ull/build-boxio-colibri-imx6ull/../layers/meta-boxio-colibri-imx6ull/recipes-extended/icinga-core/icinga-core_2.12.0.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3457 tasks of which 3447 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
The recipe that now compiles ok is attached here.
Thanks
Matteo Iervasi