Devshell: Difference between revisions

From Openembedded.org
Jump to navigation Jump to search
(made it more cut&paste friendly; added BB_ENV_EXTRAWHITE warning)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Outdated}}
'''Q: I want to get a shell where all the variables OE and the recipe defines (CC, CFLAGS, ARCH, ...) are set.'''
'''Q: I want to get a shell where all the variables OE and the recipe defines (CC, CFLAGS, ARCH, ...) are set.'''


Line 30: Line 32:
   
   
  # Some common terminal programs to choose from
  # Some common terminal programs to choose from
  GNOME_TERMCMD = 'gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"'
  # for GNOME
  GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x $SHELLCMDS'
TERMCMD='gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"'
  SCREEN_TERMCMD = 'screen -D -m -t "$TERMWINDOWTITLE"'
  TERMCMDRUN='${GNOME_TERMCMD} -x $SHELLCMDS'
  SCREEN_TERMCMDRUN = '${SCREEN_TERMCMD} $SHELLCMDS'
  # for screen
  XTERM_TERMCMD = 'xterm -T "$TERMWINDOWTITLE"'
TERMCMD='screen -D -m -t "$TERMWINDOWTITLE"'
  XTERM_TERMCMDRUN = '${XTERM_TERMCMD} -e $SHELLCMDS'
  TERMCMDRUN='${SCREEN_TERMCMD} $SHELLCMDS'
  KONSOLE_TERMCMD = 'konsole -T "$TERMWINDOWTITLE"'
  # for xterm
  KONSOLE_TERMCMDRUN = '${KONSOLE_TERMCMD} -e $SHELLCMDS'
TERMCMD='xterm -T "$TERMWINDOWTITLE"'
  TERMCMDRUN='${XTERM_TERMCMD} -e $SHELLCMDS'
  # for KONSOLE
TERMCMD='konsole -T "$TERMWINDOWTITLE"'
  TERMCMDRUN='${KONSOLE_TERMCMD} -e $SHELLCMDS'
 
If you set these from e.g. your .bashrc do not forget to add them to BB_ENV_EXTRAWHITE
E.g.
  export BB_ENV_EXTRAWHITE="TERMCMD SCREEN_TERMCMD"
 
 
== How to get a Screen-Devshell working ==
 
Using the above variables create you a devshell. Unfortunatelly you can't see anything because a new screen session is created - not a new tab in the existing session. Just use a new (SSH) connection to your (remote) account and list your screen sessions with screen -list. The last one should be your devshell and you can connect to it with screen -r <id>.


== X11 connection rejected because of wrong authentication ==
== X11 connection rejected because of wrong authentication ==

Latest revision as of 07:04, 22 November 2012

NOTE: This page has been identified as having content that is significantly out-of-date, usually because it refers to OpenEmbedded-Classic - for new projects, you should use OpenEmbedded-Core.

See OpenEmbedded Wiki Update Project for more details.

Q: I want to get a shell where all the variables OE and the recipe defines (CC, CFLAGS, ARCH, ...) are set.

When a build fails, it is often useful to interactively build the part that is failing. Because OE sets up the build environment, it may not be obvious how to quickly reproduce such an environment. This is where the interactive devshell can help you.

Background

One technique that can be use is:

  • cd into tmp/work/<failing package dir>/<failing package build dir>
  • copy ../temp/run.do_compile.. x (or do_install or whatever task is failing)
  • edit x and replace the do_compile (at the end of the file) function call w/ bash
  • ./bash --norc (you now have a shell w/ the environment set up properly for doing a build)
  • make (debug issues, etc)
  • exit (when done to go back to shell without run.do_compile settings)

Setup devshell

The above is mainly for illustration purposes. A better/quicker way to set up a development shell is this.

  • Add 'devshell' to your local.conf's INHERIT variable and enjoy the power of devshell by running it like this:
bitbake -c devshell <target>
  • You now have all the environment variables set up to correctly to run configure, make, etc.

The following variables affect the terminal handling:

TERMCMD = "${SCREEN_TERMCMD}"
TERMCMDRUN = "${SCREEN_TERMCMDRUN}"

# Some common terminal programs to choose from
# for GNOME
TERMCMD='gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"'
TERMCMDRUN='${GNOME_TERMCMD} -x $SHELLCMDS'
# for screen
TERMCMD='screen -D -m -t "$TERMWINDOWTITLE"'
TERMCMDRUN='${SCREEN_TERMCMD} $SHELLCMDS'
# for xterm
TERMCMD='xterm -T "$TERMWINDOWTITLE"'
TERMCMDRUN='${XTERM_TERMCMD} -e $SHELLCMDS'
# for KONSOLE
TERMCMD='konsole -T "$TERMWINDOWTITLE"'
TERMCMDRUN='${KONSOLE_TERMCMD} -e $SHELLCMDS'

If you set these from e.g. your .bashrc do not forget to add them to BB_ENV_EXTRAWHITE E.g.

 export BB_ENV_EXTRAWHITE="TERMCMD SCREEN_TERMCMD"


How to get a Screen-Devshell working

Using the above variables create you a devshell. Unfortunatelly you can't see anything because a new screen session is created - not a new tab in the existing session. Just use a new (SSH) connection to your (remote) account and list your screen sessions with screen -list. The last one should be your devshell and you can connect to it with screen -r <id>.

X11 connection rejected because of wrong authentication

Sometimes if you try to run devshell remote over SSH with X11 redirection this error occurs:

X11 connection rejected because of wrong authentication.
ERROR: function do_devshell failed

The problem seems to be the XAUTHORITY handling. The following part in .profile helped some users.

if [ -e "$HOME/.Xauthority" ] ; then
    export XAUTHORITY="$HOME/.Xauthority"
fi