On Fri, Jan 26, 2024 at 4:46 AM Robert P. J. Day <rpj...@crashcourse.ca> wrote:
>
>
>   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.

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

>
> rday
>
>
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194402): 
https://lists.openembedded.org/g/openembedded-core/message/194402
Mute This Topic: https://lists.openembedded.org/mt/103974993/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to