Compiling with rtems-libbsd

Chris Johns chrisj at
Wed Aug 9 22:16:04 UTC 2017

On 09/08/2017 21:13, mfg wrote:
> Hello guys,
> Thank you Chris for the reply, but I think I'm doing something wrong before the
> step that you describe to me.
> I want to do my own program using the new bsp (I can use the compiled examples
> without problems (atleast dhcpcd01)) but when I try to compile there are
> unreference errors like
> /home/marco/Desktop/Proyecto/prueba13/test_main.c:249: undefined reference to
> `rtems_bsd_setlogpriority'
> /home/marco/Desktop/Proyecto/prueba13/test_main.c:276: undefined reference to
> `rtems_bsd_initialize'
> o-optimize/test_main.o: In function `default_network_ifconfig_lo0':
> /home/marco/Desktop/Proyecto/prueba13/test_main.c:79: undefined reference to
> `rtems_bsd_command_ifconfig'
> I installed and configured the rtems-libbsd again but it's the same.
> For example, the funtion ”tems_bsd_setlogpriority” is defined in lane 250 of
> bsd.h (/arm-rtems4.12/xilinx_zynq_zedboard/lib/include/rtems/bsd/bsd.h) and I
> include that file in my program (#include <rtems/bsd/bsd.h>).
> Is the bsp not enough?

You need to specify the libbsd librarie when linking. The 'rtems_waf' package
contains '' which means you should be able to add an import to your
waf script where you include 'rtems_waf.rtems':

import rtems_waf.rtems as rtems
import rtems_waf.rtems_bsp as rtems_bsd

If you look in the source for '' you will see extra libraries are
added when linking. It has been a while since I used rtems_bsd.

> I assumed in the last step of waf (waf install),  all files that we need are
> copied:
> + install
> /home/marco/Prueba-rtems-libbsp3/sandbox/rtems-4.12/arm-rtems4.12/xilinx_zynq_zedboard/lib/libbsd.a
> (from build/arm-rtems4.12-xilinx_zynq_zedboard/libbsd.a)
> + install
> /home/marco/Prueba-rtems-libbsp3/sandbox/rtems-4.12/arm-rtems4.12/xilinx_zynq_zedboard/lib/include/mghttpd/mongoose.h
> (from rtemsbsd/mghttpd/mongoose.h)
> + install
> /home/marco/Prueba-rtems-libbsp3/sandbox/rtems-4.12/arm-rtems4.12/xilinx_zynq_zedboard/lib/include/bsm/audit.h
> (from freebsd/sys/bsm/audit.h)
> ...

Yes this is needed.

> Do I have to copy manually something more from the rtems-libbsd folder to bsp?
> Maybe the makefile is wrong, do I need link the libbsd.a library? How?

You can use 'rtems_bsd' as described above or you can add the library to your
waf script. The excellent Waf Book can help:

Look at the heading 'Fake libraries' and '10.3.3. Foreign libraries and flags'
for more detail.


More information about the users mailing list