Skip to contentSkip to conversation

trying to create simple example of "externalsrc" recipe

DISCUSSION Robert P. J. Day 3 participants 5 messages Jan 26, 2024 – Jan 27, 2024

lore
Share & tools
lore
#0 lore raw

i've been trying to put together a really basic example of a recipe
using "externalsrc" that refers to some local source, and cannot get it to work. so here's what i'm trying.

as a demo, i selected a random simple OE recipe -- in this case,
"dmidecode", whose recipe you can see here (and which seems conveniently simple for demonstration purposes):

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/dmidecode/dmidecode_3.5.bb?h=master

so to start, since the SRC_URI is a tarball, i downloaded the tarball so that i have the equivalent local source here:

  $ ls /home/rpjday/oe/srcs/dmidecode-3.5
  AUTHORS       dmioem.h     Makefile     util.c
  biosdecode.c  dmiopt.c     man          util.h
  config.h      dmiopt.h     NEWS         version.h
  dmidecode.c   dmioutput.c  ownership.c  vpddecode.c
  dmidecode.h   dmioutput.h  README       vpdopt.c
  dmioem.c      LICENSE      types.h      vpdopt.h
  $

as my first test, i set the build to the source directory in my
dmid_1.0.bb recipe file:

  inherit externalsrc
  EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5"
  EXTERNALSRC_BUILD = "${EXTERNALSRC}"

  do_install() {
    oe_runmake \
        DESTDIR="${D}" \
        prefix="${prefix}" \
        sbindir="${sbindir}" \
        docdir="${docdir}/${BPN}" \
        mandir="${mandir}" \
        install

then ran:

  $ bitbake dmid

sure enough, that build in the source directory, generating:

  AUTHORS       dmidecode.o  dmioutput.h  ownership*   version.h
  biosdecode*   dmioem.c     dmioutput.o  ownership.c  vpddecode*
  biosdecode.c  dmioem.h     LICENSE      ownership.o  vpddecode.c
  biosdecode.o  dmioem.o     Makefile     README       vpddecode.o
  config.h      dmiopt.c     man/         types.h      vpdopt.c
  dmidecode*    dmiopt.h     NEWS         util.c       vpdopt.h
  dmidecode.c   dmiopt.o     oe-logs@     util.h       vpdopt.o
  dmidecode.h   dmioutput.c  oe-workdir@  util.o

great, but i really want to build out-of-tree to preserve the
pristine state of the source, so i followed the instructions and allowed EXTERNALSRC_BUILD to default to ${WORKDIR}/${BPN}-${PV}:

inherit externalsrc
EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5" # EXTERNALSRC_BUILD = "${EXTERNALSRC}"

so I did a "make clean" in the source directory to start with the pristine source (also deleted the "oe-" symlinks), then:

$ bitbake dmid
... snip ...
| NOTE: make -j 8
DESTDIR=/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/image
prefix=/usr sbindir=/usr/sbin docdir=/usr/share/doc/dmid
mandir=/usr/share/man install
| make: *** No rule to make target 'install'.  Stop.
| ERROR: oe_runmake failed

from "bitbake -e dmid", i can see:

S="/home/rpjday/oe/srcs/dmidecode-3.5" WORKDIR="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0" B="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/dmid-1.0"

but there is nothing unloaded into the B directory; hence, the failure. in fact, the log file for the compile step is:

DEBUG: Executing python function externalsrc_compile_prefunc
NOTE: dmid: compiling from external source tree /home/rpjday/oe/srcs/dmidecode-3.5
DEBUG: Python function externalsrc_compile_prefunc finished
DEBUG: Executing python function fetcher_hashes_dummyfunc
DEBUG: Python function fetcher_hashes_dummyfunc finished
DEBUG: Executing shell function do_compile
NOTE: nothing to compile
DEBUG: Shell function do_compile finished

so ... what have i overlooked? did i grab an inappropriate sample
recipe that does not support building out-of-tree? the build directory is empty, so i'm perusing the externalsrc.bbclass to see what i have misunderstood.

rday

#1 lore raw

Note that there is a selftest for this in meta/lib/oeqa/selftest/cases/externalsrc.py, so you could check why that seems to work.

Alex

Quoted 111 lines · Robert P. J. Day

i've been trying to put together a really basic example of a recipe
using "externalsrc" that refers to some local source, and cannot get it to work. so here's what i'm trying.

as a demo, i selected a random simple OE recipe -- in this case,
"dmidecode", whose recipe you can see here (and which seems conveniently simple for demonstration purposes):

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/dmidecode/dmidecode_3.5.bb?h=master

so to start, since the SRC_URI is a tarball, i downloaded the tarball so that i have the equivalent local source here:

  $ ls /home/rpjday/oe/srcs/dmidecode-3.5
  AUTHORS       dmioem.h     Makefile     util.c
  biosdecode.c  dmiopt.c     man          util.h
  config.h      dmiopt.h     NEWS         version.h
  dmidecode.c   dmioutput.c  ownership.c  vpddecode.c
  dmidecode.h   dmioutput.h  README       vpdopt.c
  dmioem.c      LICENSE      types.h      vpdopt.h
  $

as my first test, i set the build to the source directory in my
dmid_1.0.bb recipe file:

  inherit externalsrc
  EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5"
  EXTERNALSRC_BUILD = "${EXTERNALSRC}"

  do_install() {
    oe_runmake \
        DESTDIR="${D}" \
        prefix="${prefix}" \
        sbindir="${sbindir}" \
        docdir="${docdir}/${BPN}" \
        mandir="${mandir}" \
        install

then ran:

  $ bitbake dmid

sure enough, that build in the source directory, generating:

  AUTHORS       dmidecode.o  dmioutput.h  ownership*   version.h
  biosdecode*   dmioem.c     dmioutput.o  ownership.c  vpddecode*
  biosdecode.c  dmioem.h     LICENSE      ownership.o  vpddecode.c
  biosdecode.o  dmioem.o     Makefile     README       vpddecode.o
  config.h      dmiopt.c     man/         types.h      vpdopt.c
  dmidecode*    dmiopt.h     NEWS         util.c       vpdopt.h
  dmidecode.c   dmiopt.o     oe-logs@     util.h       vpdopt.o
  dmidecode.h   dmioutput.c  oe-workdir@  util.o

great, but i really want to build out-of-tree to preserve the
pristine state of the source, so i followed the instructions and allowed EXTERNALSRC_BUILD to default to ${WORKDIR}/${BPN}-${PV}:

inherit externalsrc
EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5" # EXTERNALSRC_BUILD = "${EXTERNALSRC}"

so I did a "make clean" in the source directory to start with the pristine source (also deleted the "oe-" symlinks), then:

$ bitbake dmid
... snip ...
| NOTE: make -j 8
DESTDIR=/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/image
prefix=/usr sbindir=/usr/sbin docdir=/usr/share/doc/dmid
mandir=/usr/share/man install
| make: *** No rule to make target 'install'.  Stop.
| ERROR: oe_runmake failed

from "bitbake -e dmid", i can see:

S="/home/rpjday/oe/srcs/dmidecode-3.5" WORKDIR="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0" B="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/dmid-1.0"

but there is nothing unloaded into the B directory; hence, the failure. in fact, the log file for the compile step is:

DEBUG: Executing python function externalsrc_compile_prefunc
NOTE: dmid: compiling from external source tree /home/rpjday/oe/srcs/dmidecode-3.5
DEBUG: Python function externalsrc_compile_prefunc finished
DEBUG: Executing python function fetcher_hashes_dummyfunc
DEBUG: Python function fetcher_hashes_dummyfunc finished
DEBUG: Executing shell function do_compile
NOTE: nothing to compile
DEBUG: Shell function do_compile finished

so ... what have i overlooked? did i grab an inappropriate sample
recipe that does not support building out-of-tree? the build directory is empty, so i'm perusing the externalsrc.bbclass to see what i have misunderstood.

rday

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194356): https://lists.openembedded.org/g/openembedded-core/message/194356
Mute This Topic: https://lists.openembedded.org/mt/103974993/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 5 lines · Alexander Kanavin

Note that there is a selftest for this in meta/lib/oeqa/selftest/cases/externalsrc.py, so you could check why that seems to work.

Alex

ah, i had forgotten about the directory of selftests. my bad.

rday

#3 lore raw
In reply to Robert P. J. Day
Quoted 94 lines · Robert P. J. Day

i've been trying to put together a really basic example of a recipe
using "externalsrc" that refers to some local source, and cannot get it to work. so here's what i'm trying.

as a demo, i selected a random simple OE recipe -- in this case,
"dmidecode", whose recipe you can see here (and which seems conveniently simple for demonstration purposes):

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/dmidecode/dmidecode_3.5.bb?h=master

so to start, since the SRC_URI is a tarball, i downloaded the tarball so that i have the equivalent local source here:

  $ ls /home/rpjday/oe/srcs/dmidecode-3.5
  AUTHORS       dmioem.h     Makefile     util.c
  biosdecode.c  dmiopt.c     man          util.h
  config.h      dmiopt.h     NEWS         version.h
  dmidecode.c   dmioutput.c  ownership.c  vpddecode.c
  dmidecode.h   dmioutput.h  README       vpdopt.c
  dmioem.c      LICENSE      types.h      vpdopt.h
  $

as my first test, i set the build to the source directory in my
dmid_1.0.bb recipe file:

  inherit externalsrc
  EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5"
  EXTERNALSRC_BUILD = "${EXTERNALSRC}"

  do_install() {
    oe_runmake \
        DESTDIR="${D}" \
        prefix="${prefix}" \
        sbindir="${sbindir}" \
        docdir="${docdir}/${BPN}" \
        mandir="${mandir}" \
        install

then ran:

  $ bitbake dmid

sure enough, that build in the source directory, generating:

  AUTHORS       dmidecode.o  dmioutput.h  ownership*   version.h
  biosdecode*   dmioem.c     dmioutput.o  ownership.c  vpddecode*
  biosdecode.c  dmioem.h     LICENSE      ownership.o  vpddecode.c
  biosdecode.o  dmioem.o     Makefile     README       vpddecode.o
  config.h      dmiopt.c     man/         types.h      vpdopt.c
  dmidecode*    dmiopt.h     NEWS         util.c       vpdopt.h
  dmidecode.c   dmiopt.o     oe-logs@     util.h       vpdopt.o
  dmidecode.h   dmioutput.c  oe-workdir@  util.o

great, but i really want to build out-of-tree to preserve the
pristine state of the source, so i followed the instructions and allowed EXTERNALSRC_BUILD to default to ${WORKDIR}/${BPN}-${PV}:

inherit externalsrc
EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5" # EXTERNALSRC_BUILD = "${EXTERNALSRC}"

so I did a "make clean" in the source directory to start with the pristine source (also deleted the "oe-" symlinks), then:

$ bitbake dmid
... snip ...
| NOTE: make -j 8
DESTDIR=/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/image
prefix=/usr sbindir=/usr/sbin docdir=/usr/share/doc/dmid
mandir=/usr/share/man install
| make: *** No rule to make target 'install'.  Stop.
| ERROR: oe_runmake failed

from "bitbake -e dmid", i can see:

S="/home/rpjday/oe/srcs/dmidecode-3.5" WORKDIR="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0" B="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/dmid-1.0"

but there is nothing unloaded into the B directory; hence, the failure. in fact, the log file for the compile step is:

DEBUG: Executing python function externalsrc_compile_prefunc
NOTE: dmid: compiling from external source tree /home/rpjday/oe/srcs/dmidecode-3.5
DEBUG: Python function externalsrc_compile_prefunc finished
DEBUG: Executing python function fetcher_hashes_dummyfunc
DEBUG: Python function fetcher_hashes_dummyfunc finished
DEBUG: Executing shell function do_compile
NOTE: nothing to compile
DEBUG: Shell function do_compile finished

Quoted 4 lines

so ... what have i overlooked? did i grab an inappropriate sample
recipe that does not support building out-of-tree? the build directory is empty, so i'm perusing the externalsrc.bbclass to see what i have misunderstood.

externalsrc is as good as the components build system since that's what it relies on
so if the makery for that component does not support building out of source tree then
externalsrc will fail doing so too, in such cases you set EXTERNALSRC_BUILD = "${EXTERNALSRC}"
which is what you did in step 1.

Default is B = S in bitbake.conf, so that's what will be used for bare make based recipes like dmidecode.

The example you chose, does require you to build inside the source tree. If you want a
sample where S != B then use something other than dmidecode, maybe something like
https://github.com/jameskbride/cmake-hello-world

Quoted 13 lines

rday

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194356): https://lists.openembedded.org/g/openembedded-core/message/194356
Mute This Topic: https://lists.openembedded.org/mt/103974993/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 108 lines · Khem Raj
Quoted 94 lines · Robert P. J. Day

i've been trying to put together a really basic example of a recipe
using "externalsrc" that refers to some local source, and cannot get it to work. so here's what i'm trying.

as a demo, i selected a random simple OE recipe -- in this case,
"dmidecode", whose recipe you can see here (and which seems conveniently simple for demonstration purposes):

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/dmidecode/dmidecode_3.5.bb?h=master

so to start, since the SRC_URI is a tarball, i downloaded the tarball so that i have the equivalent local source here:

  $ ls /home/rpjday/oe/srcs/dmidecode-3.5
  AUTHORS       dmioem.h     Makefile     util.c
  biosdecode.c  dmiopt.c     man          util.h
  config.h      dmiopt.h     NEWS         version.h
  dmidecode.c   dmioutput.c  ownership.c  vpddecode.c
  dmidecode.h   dmioutput.h  README       vpdopt.c
  dmioem.c      LICENSE      types.h      vpdopt.h
  $

as my first test, i set the build to the source directory in my
dmid_1.0.bb recipe file:

  inherit externalsrc
  EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5"
  EXTERNALSRC_BUILD = "${EXTERNALSRC}"

  do_install() {
    oe_runmake \
        DESTDIR="${D}" \
        prefix="${prefix}" \
        sbindir="${sbindir}" \
        docdir="${docdir}/${BPN}" \
        mandir="${mandir}" \
        install

then ran:

  $ bitbake dmid

sure enough, that build in the source directory, generating:

  AUTHORS       dmidecode.o  dmioutput.h  ownership*   version.h
  biosdecode*   dmioem.c     dmioutput.o  ownership.c  vpddecode*
  biosdecode.c  dmioem.h     LICENSE      ownership.o  vpddecode.c
  biosdecode.o  dmioem.o     Makefile     README       vpddecode.o
  config.h      dmiopt.c     man/         types.h      vpdopt.c
  dmidecode*    dmiopt.h     NEWS         util.c       vpdopt.h
  dmidecode.c   dmiopt.o     oe-logs@     util.h       vpdopt.o
  dmidecode.h   dmioutput.c  oe-workdir@  util.o

great, but i really want to build out-of-tree to preserve the
pristine state of the source, so i followed the instructions and allowed EXTERNALSRC_BUILD to default to ${WORKDIR}/${BPN}-${PV}:

inherit externalsrc
EXTERNALSRC = "/home/rpjday/oe/srcs/dmidecode-3.5" # EXTERNALSRC_BUILD = "${EXTERNALSRC}"

so I did a "make clean" in the source directory to start with the pristine source (also deleted the "oe-" symlinks), then:

$ bitbake dmid
... snip ...
| NOTE: make -j 8
DESTDIR=/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/image
prefix=/usr sbindir=/usr/sbin docdir=/usr/share/doc/dmid
mandir=/usr/share/man install
| make: *** No rule to make target 'install'.  Stop.
| ERROR: oe_runmake failed

from "bitbake -e dmid", i can see:

S="/home/rpjday/oe/srcs/dmidecode-3.5" WORKDIR="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0" B="/home/rpjday/oe/builds/qemux86/tmp/work/core2-64-poky-linux/dmid/1.0/dmid-1.0"

but there is nothing unloaded into the B directory; hence, the failure. in fact, the log file for the compile step is:

DEBUG: Executing python function externalsrc_compile_prefunc
NOTE: dmid: compiling from external source tree /home/rpjday/oe/srcs/dmidecode-3.5
DEBUG: Python function externalsrc_compile_prefunc finished
DEBUG: Executing python function fetcher_hashes_dummyfunc
DEBUG: Python function fetcher_hashes_dummyfunc finished
DEBUG: Executing shell function do_compile
NOTE: nothing to compile
DEBUG: Shell function do_compile finished

Quoted 4 lines

so ... what have i overlooked? did i grab an inappropriate sample
recipe that does not support building out-of-tree? the build directory is empty, so i'm perusing the externalsrc.bbclass to see what i have misunderstood.

externalsrc is as good as the components build system since that's what it relies on
so if the makery for that component does not support building out of source tree then
externalsrc will fail doing so too, in such cases you set EXTERNALSRC_BUILD = "${EXTERNALSRC}"
which is what you did in step 1.

Quoted 8 lines

Default is B = S in bitbake.conf, so that's what will be used for bare make based recipes like dmidecode.

The example you chose, does require you to build inside the source tree. If you want a
sample where S != B then use something other than dmidecode, maybe something like
https://github.com/jameskbride/cmake-hello-world

thanks for clarifying that i picked a bad example -- that's what i
suspected, and thanks for pointing me at an appropriate demo.

rday