All of lore.kernel.org
 help / color / mirror / Atom feed
* Environment Variables being unset by bitbake?
@ 2014-07-09 20:58 Allen Kennedy Jr.
  2014-07-09 23:11 ` Patrick Doyle
  2014-07-10  8:29 ` Nicolas Dechesne
  0 siblings, 2 replies; 7+ messages in thread
From: Allen Kennedy Jr. @ 2014-07-09 20:58 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

I am trying to run java program from a recipe.

I get an error that JAVA_HOME is not set.
I can verify that JAVA_HOME is set by echo $JAVA_HOME.

I can then run the program without issue, but from within a recipe it
seems that $JAVA_HOME is unset.

I have verified this with 'bbnote "java is here: ${JAVA_HOME}"' from within
a recipe.

Any ideas why or how this is getting unset, and how to fix?
I couldn't find any documentation that talks about this.

Thanks

[-- Attachment #2: Type: text/html, Size: 584 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
  2014-07-09 20:58 Environment Variables being unset by bitbake? Allen Kennedy Jr.
@ 2014-07-09 23:11 ` Patrick Doyle
  2014-07-10  8:29 ` Nicolas Dechesne
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick Doyle @ 2014-07-09 23:11 UTC (permalink / raw)
  To: Allen Kennedy Jr.; +Cc: yocto

Oh!  I think I know the answer to this one!

Check out BB_ENV_EXTRAWHITE at
http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#var-BB_ENV_EXTRAWHITE.
If you set that to something like JAVA_HOME, that might do what you
want.

--wpd


On Wed, Jul 9, 2014 at 4:58 PM, Allen Kennedy Jr.
<allen@kennedystuff.com> wrote:
> I am trying to run java program from a recipe.
>
> I get an error that JAVA_HOME is not set.
> I can verify that JAVA_HOME is set by echo $JAVA_HOME.
>
> I can then run the program without issue, but from within a recipe it
> seems that $JAVA_HOME is unset.
>
> I have verified this with 'bbnote "java is here: ${JAVA_HOME}"' from within
> a recipe.
>
> Any ideas why or how this is getting unset, and how to fix?
> I couldn't find any documentation that talks about this.
>
> Thanks
>
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
  2014-07-09 20:58 Environment Variables being unset by bitbake? Allen Kennedy Jr.
  2014-07-09 23:11 ` Patrick Doyle
@ 2014-07-10  8:29 ` Nicolas Dechesne
  2014-07-10 13:46   ` Allen Kennedy Jr.
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Dechesne @ 2014-07-10  8:29 UTC (permalink / raw)
  To: Allen Kennedy Jr.; +Cc: Yocto list discussion

On Wed, Jul 9, 2014 at 10:58 PM, Allen Kennedy Jr.
<allen@kennedystuff.com> wrote:
> Any ideas why or how this is getting unset, and how to fix?
> I couldn't find any documentation that talks about this.

by the way, this is not a bug, and doesn't need to be 'fixed'. this is
purposely done this way to avoid leaking too much information from
your environment into the build environment. bitbake tries to isolate
as much as possible from the host.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
  2014-07-10  8:29 ` Nicolas Dechesne
@ 2014-07-10 13:46   ` Allen Kennedy Jr.
  2014-07-10 13:58     ` Nicolas Dechesne
  0 siblings, 1 reply; 7+ messages in thread
From: Allen Kennedy Jr. @ 2014-07-10 13:46 UTC (permalink / raw)
  To: Nicolas Dechesne; +Cc: Yocto list discussion

[-- Attachment #1: Type: text/plain, Size: 1788 bytes --]

Nicholas,
  Thanks for your response.  I tried the following permutations:
I added this: BB_ENV_EXTRAWHITE += " JAVA_HOME" to the top of my recipe.
I added this: BB_ENV_EXTRAWHITE += "JAVA_HOME" to the top of my recipe.
I added this: BB_ENV_EXTRAWHITE = "JAVA_HOME" to the top of my recipe.
I added this: export BB_ENV_EXTRAWHITE="JAVA_HOME" to the top of my recipe
I added this: export BB_ENV_EXTRAWHITE="JAVA_HOME" to a function in my
recipe

All with no joy.  I did a bit of google-fu and came up with this one:
on the command line: BB_ENV_EXTRAWHITE="JAVA_HOME" bitbake myRecipe

Which almost works, but not really.  my bbnote in my recipe exclaims: NOTE:
java is here: /usr/local/java/jdk
which is right, but then in the shell script that gets called after that,
the first lines are:
if [ -z "$JAVA_HOME" ]; then
    echo "JAVA_HOME is not set"
    exit 1
fi

Which turns out the error that JAVA_HOME is not set.

again, this shell script works perfectly fine outside of the bitbake system.

Any other ideas?
thanks,
-allen




On Thu, Jul 10, 2014 at 3:29 AM, Nicolas Dechesne <
nicolas.dechesne@linaro.org> wrote:

> On Wed, Jul 9, 2014 at 10:58 PM, Allen Kennedy Jr.
> <allen@kennedystuff.com> wrote:
> > Any ideas why or how this is getting unset, and how to fix?
> > I couldn't find any documentation that talks about this.
>
> by the way, this is not a bug, and doesn't need to be 'fixed'. this is
> purposely done this way to avoid leaking too much information from
> your environment into the build environment. bitbake tries to isolate
> as much as possible from the host.
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

[-- Attachment #2: Type: text/html, Size: 2670 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
  2014-07-10 13:46   ` Allen Kennedy Jr.
@ 2014-07-10 13:58     ` Nicolas Dechesne
       [not found]       ` <CAO-21LM=ucVNUPAwDgXA5FkB0dsi=ASQrgTSAaq+fFRhhkWaRA@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Dechesne @ 2014-07-10 13:58 UTC (permalink / raw)
  To: Allen Kennedy Jr.; +Cc: Yocto list discussion

On Thu, Jul 10, 2014 at 3:46 PM, Allen Kennedy Jr.
<allen@kennedystuff.com> wrote:
> All with no joy.  I did a bit of google-fu and came up with this one:
> on the command line: BB_ENV_EXTRAWHITE="JAVA_HOME" bitbake myRecipe

the manual says "You must set this variable in the external
environment in order for it to work.", so you really need to set it
before calling bitbake, not in the recipe.

>
> Which almost works, but not really.  my bbnote in my recipe exclaims: NOTE:
> java is here: /usr/local/java/jdk
> which is right, but then in the shell script that gets called after that,
> the first lines are:
> if [ -z "$JAVA_HOME" ]; then
>     echo "JAVA_HOME is not set"
>     exit 1
> fi
>
> Which turns out the error that JAVA_HOME is not set.
>
> again, this shell script works perfectly fine outside of the bitbake system.

you need to explicitely export the bitbake variable for the shell. in
your recipe:
export JAVA_HOME="${JAVA_HOME}"


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
       [not found]       ` <CAO-21LM=ucVNUPAwDgXA5FkB0dsi=ASQrgTSAaq+fFRhhkWaRA@mail.gmail.com>
@ 2014-07-10 14:23         ` Nicolas Dechesne
  2014-07-10 14:29           ` Allen Kennedy Jr.
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Dechesne @ 2014-07-10 14:23 UTC (permalink / raw)
  To: Allen Kennedy Jr., Yocto list discussion

+list. please let's discuss on the list.

On Thu, Jul 10, 2014 at 4:01 PM, Allen Kennedy Jr.
<allen@kennedystuff.com> wrote:
> That did it.  thanks.
>
> Is there is no way to add this to the layer?  Must I distrubute my layer
> with instructions to set BB_ENV_EXTRAWHITE variable before running bitbake?
> I would think there would be someway to make it easy for the user?

well, i don't think so. at this point, i think you need to think about
why you need that in the first place... i have not done any JAVA + OE
stuff, so i cannot really comment on that... but explicitly
contaminating your build environment with host 'stuff' sounds wrong to
me.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Environment Variables being unset by bitbake?
  2014-07-10 14:23         ` Nicolas Dechesne
@ 2014-07-10 14:29           ` Allen Kennedy Jr.
  0 siblings, 0 replies; 7+ messages in thread
From: Allen Kennedy Jr. @ 2014-07-10 14:29 UTC (permalink / raw)
  To: Nicolas Dechesne; +Cc: Yocto list discussion

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

Thanks again.

Perhaps I'll write a shell script that calls bitbake after properly setting
up the environment.


On Thu, Jul 10, 2014 at 9:23 AM, Nicolas Dechesne <
nicolas.dechesne@linaro.org> wrote:

> +list. please let's discuss on the list.
>
> On Thu, Jul 10, 2014 at 4:01 PM, Allen Kennedy Jr.
> <allen@kennedystuff.com> wrote:
> > That did it.  thanks.
> >
> > Is there is no way to add this to the layer?  Must I distrubute my layer
> > with instructions to set BB_ENV_EXTRAWHITE variable before running
> bitbake?
> > I would think there would be someway to make it easy for the user?
>
> well, i don't think so. at this point, i think you need to think about
> why you need that in the first place... i have not done any JAVA + OE
> stuff, so i cannot really comment on that... but explicitly
> contaminating your build environment with host 'stuff' sounds wrong to
> me.
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

[-- Attachment #2: Type: text/html, Size: 1693 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-10 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 20:58 Environment Variables being unset by bitbake? Allen Kennedy Jr.
2014-07-09 23:11 ` Patrick Doyle
2014-07-10  8:29 ` Nicolas Dechesne
2014-07-10 13:46   ` Allen Kennedy Jr.
2014-07-10 13:58     ` Nicolas Dechesne
     [not found]       ` <CAO-21LM=ucVNUPAwDgXA5FkB0dsi=ASQrgTSAaq+fFRhhkWaRA@mail.gmail.com>
2014-07-10 14:23         ` Nicolas Dechesne
2014-07-10 14:29           ` Allen Kennedy Jr.

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.