Yocto Project Discussions
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Dave Hitchman <dave.hitchman@kymati.com>
Cc: "yocto@lists.yoctoproject.org" <yocto@lists.yoctoproject.org>
Subject: Re: [yocto] Using cmake... how?
Date: Tue, 17 Oct 2023 13:22:09 +0300	[thread overview]
Message-ID: <ZS5gUVkTwgjNi0Ad@nuoska> (raw)
In-Reply-To: <AM9PR03MB70124FE13C06B022A3C0BF5F92D6A@AM9PR03MB7012.eurprd03.prod.outlook.com>

Hi,

On Tue, Oct 17, 2023 at 10:09:42AM +0000, Dave Hitchman wrote:
> Thanks
> 
> So, first, I thought - as I had seen examples that I had to put these flags etc. in the configuration function but it appears that was a wrong thing.
> Now my recipe looks like:
> SUMMARY = "mylib"
> DESCRIPTION = "Fetch and build mylibi"
> LICENSE = "CLOSED"
> LIC_FILES_CHKSUM = ""
> 
> ##EXTRA_OECMAKE = "all"
> inherit cmake
> 
> python do_display_banner() {
>     bb.plain("***********************************************");
>     bb.plain("*                                             *");
>     bb.plain("*  mylibrecipe created by mei         *");
>     bb.plain("*                                             *");
>     bb.plain("***********************************************");
> }
> 
> addtask display_banner before do_build
> 
> # where and how to get source
> ## this is via git
> SRC_URI = "git://git@correct git - this works;"
> 
> # where to source is stored
> S = "${WORKDIR}/git"
> 
> ## was using target flags but Mikko suggested EXTRA_OECMAKE which at least doesnt complain
> ##TARGET_CFLAGS += "-DBUILD_PYTHON_BINDINGS=ON -DBUILD_SHARED=ON -DBUILD_TOOLS=ON"
> ##TARGET_CXXFLAGS += "-DBUILD_PYTHON_BINDINGS=ON -DBUILD_SHARED=ON -DBUILD_TOOLS=ON"
> EXTRA_OECMAKE += "-DBUILD_PYTHON_BINDINGS=ON -DBUILD_SHARED=ON -DBUILD_TOOLS=ON"
> 
> ## this I think is needed to ensure the correct compilers are used... I think anyway.
> export CXX="/usr/bin/arm-none-gnueabi-g++"
> export CMAKE_CXX_COMPILER="/usr/bin/arm-none-gnueabi-g++"

This is wrong. cmake.bbclass generates a toolchain file which is given
to cmake binary and this has all the compiler, binary, module, header file etc
search paths set correctly. It's up to the CMake scripts of the SW component to obey
these settings and not overwrite them. The SW component can amend them by appending
to them but not overwriting. An overwrite of any variable from toolchain.cmake
will break things in various ways. Run the "bitbake -c configure && bitbake -c compile" steps
manually and check the environment in a "bitbake -c devshell", for example.

> However:
> | DEBUG: Python function extend_recipe_sysroot finished
> | DEBUG: Executing shell function do_configure
> | -- The CXX compiler identification is GNU 9.4.0
> | -- The C compiler identification is GNU 9.4.0
> | -- Detecting CXX compiler ABI info
> | -- Detecting CXX compiler ABI info - failed
> | -- Check for working CXX compiler: /usr/bin/g++
> | -- Check for working CXX compiler: /usr/bin/g++ - broken
> | CMake Error at /home/dave/Documents/Kymati/yocto/build/tmp/work/cortexa53-crypto-phytec-linux/libkymati/1.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message):
> |   The C++ compiler
> |
> |     "/usr/bin/g++"
> |
> |   is not able to compile a simple test program.
> |
> 
> suggesting it is not using the c++ I thought it should be.

Yes, as said before, using the host compiled from the Linux machine instead of
yocto cross compiler for real target.

Cheers,

-Mikko


  reply	other threads:[~2023-10-17 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 11:22 [meta-rockchip][kirkstone][PATCH] bsp: rkbin: fix default COMPATIBLE_MACHINE matching all Quentin Schulz
2023-10-16 15:27 ` [yocto] Using cmake... how? Dave Hitchman
2023-10-16 19:48   ` Khem Raj
2023-10-17  5:49   ` Mikko Rapeli
2023-10-17  9:21     ` Dave Hitchman
2023-10-17  9:52       ` Mikko Rapeli
2023-10-17 10:09         ` Dave Hitchman
2023-10-17 10:22           ` Mikko Rapeli [this message]
2023-10-17 11:35             ` Dave Hitchman
2023-10-17 11:42               ` Mikko Rapeli
2023-10-17 11:53               ` Mikko Rapeli
2023-10-17 11:58                 ` Dave Hitchman
2023-10-17 12:23                   ` Mikko Rapeli
2023-10-17 13:32                   ` Ross Burton
2023-10-17 15:18                     ` Dave Hitchman
2023-10-25 13:43 ` [yocto] [meta-rockchip][kirkstone][PATCH] bsp: rkbin: fix default COMPATIBLE_MACHINE matching all Trevor Woerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZS5gUVkTwgjNi0Ad@nuoska \
    --to=mikko.rapeli@linaro.org \
    --cc=dave.hitchman@kymati.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox