RTEMS source builder: can't find RTEMS include files but then can?

dufault at hda.com dufault at hda.com
Thu May 27 13:36:55 UTC 2021



> On May 26, 2021, at 21:50 , Joel Sherrill <joel at rtems.org> wrote:
> 
> 
> 
> On Wed, May 26, 2021, 7:54 PM Chris Johns <chrisj at rtems.org> wrote:
> On 30/4/21 1:15 am, dufault at hda.com wrote:
> >
> >
> >> On Apr 30, 2021, at 05:03 , dufault at hda.com wrote:
> >>
> >> Can I override what to use as "cmake" in RSB to specify "cmake3"?
> >>
> >>> On Apr 30, 2021, at 04:41 , Peter Dufault <dufault at hda.com> wrote:
> >>>
> >>> I verified my environment is squeaky-clean with a simple path and no environment variables set that affect RTEMS or "make".
> >>
> >
> > I need help figuring out how to setup rtems-source-builder, SOEM, and cmake.  I got it to "work" but it's mis-configured.  At first it is not finding header files (is it looking at the Linux headers?), then it installs SOEM in the wrong place, etc.  I can get the build and install to "work" by re-running commands in a shell script - the second time a command is run it behaves differently.
> >
> > - *Notes*
> > -- This started when I updated SOEM and needed to change to "cmake3".
> > -- After the following convoluted process the testing I've done on the results are OK.
> >
> > - To simplify my path I make it simple except I add a directory with only a "cmake" bash script: "cmake3 $*" in order to pick up cmake3.
> 
> Maybe the --macros argument can help. Create a file `xyz.txt` containing ...
> 
> __cmake:             exe,     optional, 'cmake3'
> 
> then try running with `--macros=xyz.txt` If the recipe for the build using cmake
> uses `%{__cmake}` then this may work. I have not tested any of this. :)
> 
> This may be a stupid question but can you build it by hand?
> 
> --joel

I haven't built it by hand because the RTEMS SOEM came with source builder support.  Since my build is "working" it's gone to the back burner.  However, someone at my clients was just trying to build it (unsuccessfully) and I'd forgotten about all the jumping through hoops that I'd done so I should get back to it soon.

> 
> 
> Chris
> 
> >
> > - The first time I run "sb-set-builder" the SOEM build fails because it can't find <net/bpf.h>. This is just after it compiled a C file that includes <net/if.h>.  I'm not sure where it is looking for the headers, I'd expect it would fail earlier if it was trying to use Linux headers, it's all the way to the last file.
> >
> > - I then run the do-build script sb-set-builder created and it builds SOEM *but it installs it in the wrong place*.
> > -- The do-build script is in "${GITDIR}/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/do-build"
> > -- "do-build" installs SOEM in in "${GITDIR}/rtems-source-builder/rtems/build/tmp/soem-powerpc-rtems6-1-root-dufault/opt/flatland/opt/rtems-6" instead of "/opt/flatland/opt/rtems-6".
> >
> > - I then go to the generated directory "${GITDIR}/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/build-xc" and type "make install" The make succeeds, and *it installs SOEM in the correct place* and SOEM is "successfully" built and installed.
> >
> > - The last nit is that when I try to build the SOEM examples I need to export LDFLAGS="-lrtemsdefaultconfig -lm" to get the SOEM examples to configure. *Note* this was an issue before I switched to cmake3, this one is not new.
> >
> >
> > I hope this gives someone enough clues to suggest what must be done to set source builder up correctly.  For reference here's the script.
> >
> > #!/bin/sh
> > set -e
> > # Script to get SOEM to build and install "properly".  I just need to be insistent.
> >
> > HERE=$(pwd)
> > # Clean up environment  rsb-overrides only has a cmake shell script that is "cmake $*".
> > export PATH=${HOME}/bin/rsb-overrides:/usr/bin:/usr/sbin:/bin:/sbin
> > unset LD_IBRARY_PATH
> >
> > export RTEMS_GIT=/home/dufault/development/rtems
> > export RTEMS_VER=6
> > export RTEMS_SB=${RTEMS_GIT}/rtems-source-builder
> > export RTEMS_SB_BUILD=${RTEMS_SB}/rtems/build
> > export RTEMS_TOOLS=/opt/flatland/opt/rtems-${RTEMS_VER}
> > export RTEMS_ARCH=powerpc
> > export RTEMS_BSP=beatnik
> > # "soem-rtems" fetches waf-2.0.4.
> > SOEM_WAF=waf-2.0.4
> >
> > SOEM_TIDY_UP="\
> >     ${RTEMS_TOOLS}/share/rtems/rsb/soem-${RTEMS_ARCH}-rtems${RTEMS_VER}-1.txt \
> >     ${RTEMS_TOOLS}/share/rtems/rsb/soem-${RTEMS_ARCH}-rtems${RTEMS_VER}-1.xml \
> >     ${RTEMS_TOOLS}/${RTEMS_ARCH}-rtems${RTEMS_VER}/${RTEMS_BSP}/lib/share/soem \
> >     ${RTEMS_TOOLS}/${RTEMS_ARCH}-rtems${RTEMS_VER}/${RTEMS_BSP}/lib/include/soem"
> >
> >
> > # We have this setup: ${RTEMS_GIT}
> > #                                |-- soem-rtems
> > #                                |-- rtems
> > #                                |-- rtems-source-builder
> >
> > # First tidy-up so we always start in the same state.
> > rm -rf ${RTEMS_SB_BUILD} ${SOEM_TIDY_UP}
> > cd ${RTEMS_GIT}/soem-rtems
> > if [ ! -e ${SOEM_WAF} ]; then
> >     wget -P . https://waf.io/${SOEM_WAF}
> >     chmod u+x ${SOEM_WAF}
> >     git submodule init
> >     git submodule update
> > else
> >     ./${SOEM_WAF} distclean
> > fi
> >
> > cd ${RTEMS_SB}/rtems
> >
> > RTEMS_SB_DEBUG="--no-clean --jobs=1"
> >
> > # Now configure to build SOEM.
> > # This will fail with:
> > # ${RTEMS_SB_BUILD}soem-${RTEMS_ARCH}-rtems${RTEMS_VER}-1/soem/oshw/rtems/nicdrv.c:37:10:
> > #  fatal error: net/bpf.h: No such file or directory
> >
> > if ${RTEMS_SB}/source-builder/sb-set-builder \
> >     --log=log_${RTEMS_ARCH}_soem \
> >     --prefix=${RTEMS_TOOLS} \
> >     --with-tools=${RTEMS_TOOLS} \
> >     --host=${RTEMS_ARCH}-rtems${RTEMS_VER} \
> >     --with-rtems-bsp=${RTEMS_BSP} \
> >     ${RTEMS_SB_DEBUG} \
> >     net/soem ; \
> > then
> >         echo 2>&1 "*************************"
> >         echo 2>&1 "************************* Success with sb-set-builder for net/soem?  But I expect failure!"
> >         echo 2>&1 "*************************"
> >         exit 1
> > else
> >         echo "*************************"
> >         echo "************************* sb-set-builder failed because it can't find <net/bpf.h>.  Build again..."
> >         echo "*************************"
> > fi
> >
> > # Now we can manually do the build to finish the build.
> > # This won't quite work either, because it installs SOEM in the wrong place.
> > ${RTEMS_SB_BUILD}/soem-${RTEMS_ARCH}-rtems${RTEMS_VER}-1/do-build
> >
> > echo "*************************"
> > echo "************************* Finished do-build but it installed in the wrong place.  Redo install..."
> > echo "*************************"
> >
> > # so to finish up and install properly in the prefix
> > # I need to do another "make install" in the build-xc directory.
> > cd ${RTEMS_SB_BUILD}/soem-${RTEMS_ARCH}-rtems${RTEMS_VER}-1/build-xc/
> > make install
> >
> > # SOEM is "installed".  Now I can build the RTEMS SOEM examples.
> >
> > cd ${RTEMS_GIT}/soem-rtems
> >
> > export LDFLAGS="-lrtemsdefaultconfig -lm"
> >
> > echo "*************************"
> > echo "************************* XXX Why do I need to set LDFLAGS to ${LDFLAGS} before the ./${SOEM_WAF} configure?"
> > echo "*************************"
> >
> > ./${SOEM_WAF} configure \
> >     --prefix=${RTEMS_TOOLS} \
> >     --rtems-bsps=${RTEMS_ARCH}/${RTEMS_BSP} \
> >     --rtems-version=${RTEMS_VER}
> >
> > ./${SOEM_WAF}
> >
> > echo "*************************"
> > echo "************************* Done!"
> > echo "*************************"
> >
> >
> > Peter
> > -----------------
> > Peter Dufault
> > HD Associates, Inc.      Software and System Engineering
> >
> > This email is delivered through the public internet using protocols subject to interception and tampering.
> >
> >
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> >
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

This email is delivered through the public internet using protocols subject to interception and tampering.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210527/b33c59e6/attachment.bin>


More information about the devel mailing list