From: Gyorgy Sarvari <skandigraun@gmail.com>
To: yocto@lists.yoctoproject.org, joseph.maniaci@seagate.com
Subject: Re: [yocto] Environmental variable present in do_compile() {}, bitbake recipe -e, but is missing from do_configure() {} #bitbake
Date: Fri, 18 Jul 2025 09:43:36 +0200 [thread overview]
Message-ID: <d9a7a078-572b-4362-85c1-61a43dd8a89f@gmail.com> (raw)
In-Reply-To: <29250.1752776200152802991@lists.yoctoproject.org>
On 7/17/25 20:16, joseph.maniaci via lists.yoctoproject.org wrote:
> Okay, maybe one more question for the next poor soul that has the
> same-ish issue
>
> Why does this work:
>
> *** Prior to bitbake ***
>
> export ABC="AAAAAAAAAAAAAAAHHHHHHHHHHHHHHH"
> export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS ABC"
>
> *** bitbake recipe ***
> ....
> do_configure () {
> export ABC=${ABC} && cmake_do_configure } <<<--- Obviously
> referencing and seeing ${ABC}
> ....
>
> CMAKE configures and compiles successfully
>
> but this doesn't
Because of the extra export you added.
Adding ABC to BB_ENV_PASSTHROUGH_ADDITIONS will make the ${ABC} variable
available in the recipes - but only in the recipes, and not as an
environment variable.
When you write inside a task 'export ABC="${ABC}"' - this looks like
pure shell, a self-referencing tautological assignment: seems like it
says "create an env var called ABC and set it to the value of the ABC
env var"
But it's something else.
It goes through the bitbake parser first, and by the time it is
executed, it becomes 'export ABC="AAAAAAAAAAAAAAAHHHHHHHHHHHHHHH"' - the
original ${ABC} is nowhere to be found, because it's a bitbake variable
(just like SRC_URI, for example), not an env var, it was substituted
with the literal value of ${ABC}. And before executing that export
statement, the ABC env var doesn't exist in the build environment at all.
>
> *** bitbake recipe ***
> ....
> do_configure () {
> cmake_do_configure <<<--- ${ABC} doesn't make it to cmake
> }
> ....
>
> *** cmakelists.txt ***
>
> if( NOTDEFINEDENV{ABC})
> message(FATAL_ERROR "Undefined environmental variable: ABC\n")
> endif()
>
> *** bitbake output ***
> ....
> | DEBUG: Executing shell function do_configure
> ....
>
> *** cmake output ***
> | CMake Error at CMakeLists.txt:12 (message): | Undefined
> environmental variable: ABC
>
>
>
> Even doing something like the following makes it visible to CMAKE
>
> SOME_VAR = "${ABC}" do_configure () { export ABC=${SOME_VAR} &&
> cmake_do_configure }
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#65679): https://lists.yoctoproject.org/g/yocto/message/65679
> Mute This Topic: https://lists.yoctoproject.org/mt/114193163/6084445
> Mute #bitbake:https://lists.yoctoproject.org/g/yocto/mutehashtag/bitbake
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
next prev parent reply other threads:[~2025-07-18 7:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 21:20 Environmental variable present in do_compile() {}, bitbake recipe -e, but is missing from do_configure() {} #bitbake joseph.maniaci
2025-07-17 9:46 ` [yocto] " Alexander Kanavin
2025-07-17 16:24 ` joseph.maniaci
2025-07-17 16:29 ` Quentin Schulz
2025-07-17 16:48 ` joseph.maniaci
2025-07-17 17:20 ` Gyorgy Sarvari
2025-07-17 17:28 ` joseph.maniaci
2025-07-17 18:16 ` joseph.maniaci
2025-07-18 7:43 ` Gyorgy Sarvari [this message]
2025-07-18 15:16 ` joseph.maniaci
2025-07-18 15:17 ` joseph.maniaci
2025-07-18 15:40 ` Quentin Schulz
2025-07-17 16:27 ` joseph.maniaci
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=d9a7a078-572b-4362-85c1-61a43dd8a89f@gmail.com \
--to=skandigraun@gmail.com \
--cc=joseph.maniaci@seagate.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.