libbsd configure removes -D flags from CFLAGS of pkg-config

Chris Johns chrisj at rtems.org
Sun Sep 13 23:46:39 UTC 2020


On 13/9/20 3:46 am, Sebastian Huber wrote:
> Hello,
> 
> I can't build the libbsd for powerpc/beatnik:
> 
> ---------------------------------------------
> Compiler version (powerpc-rtems6-gcc)
> 10.2.1 20200904 (RTEMS 6, RSB 47f32b8b1a597b5ed3475722bdc155249ef51115, Newlib
> a0d7982)
> Opening and load pkgconfig:
> /ramdisk/git-rtems-6/build/install/lib/pkgconfig/powerpc-rtems6-beatnik.pc
> -----------------------------------------
> CFLAGS ->
>    -qrtems -B/ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib
> -D__ppc_generic -mcpu=7400
> LDFLAGS ->
> pkconfig warning: Label not found: LDFLAGS
> 
> LIB ->
> pkconfig warning: Label not found: LIB
> 
> ---------------------------------------------
> Checking for a valid RTEMS BSP installation
> ==>
> #include <rtems.h>
> void Init(rtems_task_argument arg) { (void)arg; }
> #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> #define CONFIGURE_MAXIMUM_TASKS 1
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_INIT
> #include <rtems/confdefs.h>
> <==
> [1/2] Compiling build/.conf_check_261484d99ea5da27480d47dee9a30c04/test.c
> 
> ['/build/rtems/6/bin/powerpc-rtems6-gcc', '-qrtems',
> '-B/ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib', '-mcpu=7400',
> '-MMD', '../test.c', '-c',
> '-o/ramdisk/git-rtems-libbsd/build/.conf_check_261484d99ea5da27480d47dee9a30c04/testbuild/test.c.1.o']
> 
> err: In file included from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/libcpu/powerpc-utility.h:46,
> 
>                  from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/bsp/vectors.h:40,
> 
>                  from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/bsp.h:45,
>                  from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/rtems/confdefs/bsp.h:53,
> 
>                  from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/rtems/confdefs/extensions.h:45,
> 
>                  from
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/rtems/confdefs.h:67,
> 
>                  from ../test.c:7:
> /ramdisk/git-rtems-6/build/install/powerpc-rtems6/beatnik/lib/include/rtems/powerpc/powerpc.h:289:2:
> error: #error "Unsupported CPU Model"
>   289 | #error "Unsupported CPU Model"
>       |  ^~~~~
> 
> I haven't figured out why the "-D__ppc_generic" is removed from the CFLAGS.

There are multiple places filtering happens. It could be rtems_waf ...

https://git.rtems.org/rtems_waf/tree/rtems.py#n840

of pkgconfig in the RSB ...

https://git.rtems.org/rtems-source-builder/tree/rtems/config/rtems-bsp.cfg#n40
https://git.rtems.org/rtems-source-builder/tree/source-builder/sb/config.py#n512

Exporting of internal build flags by RTEMS to applications needs to be consider
a bug. This happens in a small number of cases like this one but the effort and
complexity involved in managing these cases outside of Makefile.inc is growing.

I am reluctant to support adding exceptions to the filtering of flags to manage
things like this because it is a slippery slope and fragile. The hack at the
moment is to take the flags and remove the warning ones. In rtems_waf the
filtering goes further to group the flags to isolate machine flags so the ABI
can be cleanly exported to the 3rd party libraries and applications.

I think using a command line -Dsomething to control a machine configuration
outside of the RTEMS build arena is fragile. Can this be added to the powerpc's
bspopts.h as a #define for this BSP?

Chris


More information about the devel mailing list