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

Peter Dufault dufault at hda.com
Fri Apr 30 08:41:52 UTC 2021


I updated to the latest "Simple Open EtherCAT Master" (SOEM) git and the build failed because gcc couldn't find <net/bpf.h>.  This is weird because:

- <net/bpf.h> is where it shoud be;
- "gcc" had already compiled a source file that included <net/if.h> just before it failed to find <net/bpf.h>.

To debug I turned off the "-j" (just because, it's irrelevant), saw the build fail, then cut-and-pasted the "do-build" script to start debugging, and it built and installed fine!

I verified my environment is squeaky-clean with a simple path and no environment variables set that affect RTEMS or "make".

Here's what happened.  I'm including the patch because I just noticed the one file that is patched is the one that doesn't compile the first time.

++++++++++++
RTEMS Tools Project - Source Builder Error Report
 Build: error: building soem-powerpc-rtems6-1
 Command Line: /home/dufault/development/rtems/rtems-source-builder/source-builder/sb-set-builder --log=log_powerpc_soem --prefix=/opt/flatland/opt/rtems-6 --with-tools=/opt/flatland/opt/rtems-6 --host=powerpc-rtems6 --with-rtems-bsp=beatnik --no-clean --jobs=1 net/soem
 Python: 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
 git://git.rtems.org/rtems-source-builder.git/origin/0d8c97323fd4ba024ad35896cee6670c4981543a
 Linux gen6 3.10.0-1160.21.1.el7.x86_64 #1 SMP Tue Mar 16 18:28:22 UTC 2021 x86_64
Tail of the build log:

(...)

script: 92: cd ${build_top}
warning: soem.diff: no hash found
making dir: /home/dufault/development/rtems/rtems-source-builder/source-builder/patches
script: 93: /bin/cat /home/dufault/development/rtems/rtems-source-builder/source-builder/patches/soem.diff | /usr/bin/patch  -p1

(...)


rtems.cmake
-- Building for RTEMS
-- OS is rtems
-- LIB_DIR: /opt/flatland/opt/rtems-6/powerpc-rtems6/beatnik/lib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dufault/development/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/build-xc
+ make all
Scanning dependencies of target soem
[  7%] Building C object CMakeFiles/soem.dir/soem/ethercatbase.c.obj
[ 15%] Building C object CMakeFiles/soem.dir/soem/ethercatcoe.c.obj
[ 23%] Building C object CMakeFiles/soem.dir/soem/ethercatconfig.c.obj
[ 30%] Building C object CMakeFiles/soem.dir/soem/ethercatdc.c.obj
[ 38%] Building C object CMakeFiles/soem.dir/soem/ethercateoe.c.obj
[ 46%] Building C object CMakeFiles/soem.dir/soem/ethercatfoe.c.obj
[ 53%] Building C object CMakeFiles/soem.dir/soem/ethercatmain.c.obj
[ 61%] Building C object CMakeFiles/soem.dir/soem/ethercatprint.c.obj
[ 69%] Building C object CMakeFiles/soem.dir/soem/ethercatsoe.c.obj
[ 76%] Building C object CMakeFiles/soem.dir/osal/rtems/osal.c.obj
[ 84%] Building C object CMakeFiles/soem.dir/oshw/rtems/nicdrv.c.obj
/home/dufault/development/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/soem/oshw/rtems/nicdrv.c:37:10: fatal error: net/bpf.h: No such file or directory
   37 | #include <net/bpf.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/soem.dir/oshw/rtems/nicdrv.c.obj] Error 1
make[1]: *** [CMakeFiles/soem.dir/all] Error 2
make: *** [all] Error 2
shell cmd failed: /bin/sh -ex  /home/dufault/development/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/do-build
error: building soem-powerpc-rtems6-1
---------

Note that it had already compiled "osal/rtems/osal.c" and that includes <net/if.h>.

I cut-and-pasted the "do-build" line and it worked.

*The one thing I just noticed* is the single file I patch is the file that fails to compile, that's why I don't apply it a second time in "do-build".  It does apply fine the first time around.  Is that a clue?

++++++++++
[dufault at gen6 lou_files]$ /home/dufault/development/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/do-build
=> soem-powerpc-rtems6-1: BUILD
==> %prep:
patching file soem/oshw/rtems/nicdrv.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file soem/oshw/rtems/nicdrv.c.rej
==> clean %{buildroot}: /home/dufault/development/rtems/rtems-source-builder/rtems/build/tmp/soem-powerpc-rtems6-1-root-dufault
==> %build:
rtems.cmake
rtems.cmake
-- Building for RTEMS
-- OS is rtems
-- LIB_DIR: /opt/flatland/opt/rtems-6/powerpc-rtems6/beatnik/lib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dufault/development/rtems/rtems-source-builder/rtems/build/soem-powerpc-rtems6-1/build-xc
[  7%] Building C object CMakeFiles/soem.dir/soem/ethercatbase.c.obj
[ 15%] Building C object CMakeFiles/soem.dir/soem/ethercatcoe.c.obj
[ 23%] Building C object CMakeFiles/soem.dir/soem/ethercatconfig.c.obj
[ 30%] Building C object CMakeFiles/soem.dir/soem/ethercatdc.c.obj
[ 38%] Building C object CMakeFiles/soem.dir/soem/ethercateoe.c.obj
[ 46%] Building C object CMakeFiles/soem.dir/soem/ethercatfoe.c.obj
[ 53%] Building C object CMakeFiles/soem.dir/soem/ethercatmain.c.obj
[ 61%] Building C object CMakeFiles/soem.dir/soem/ethercatprint.c.obj
[ 69%] Building C object CMakeFiles/soem.dir/soem/ethercatsoe.c.obj
[ 76%] Building C object CMakeFiles/soem.dir/osal/rtems/osal.c.obj
[ 84%] Building C object CMakeFiles/soem.dir/oshw/rtems/nicdrv.c.obj
[ 92%] Building C object CMakeFiles/soem.dir/oshw/rtems/oshw.c.obj
[100%] Linking C static library libsoem.a
[100%] Built target soem
==> %install:

(...)
-------------

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/20210430/85e3ce24/attachment.bin>


More information about the devel mailing list