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

Joel Sherrill joel at rtems.org
Mon Sep 14 13:02:54 UTC 2020


On Mon, Sep 14, 2020 at 12:15 AM Chris Johns <chrisj at rtems.org> wrote:

> On 14/9/20 3:06 pm, Sebastian Huber wrote:
> > On 14/09/2020 01:46, Chris Johns wrote:
> >> 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.
> >
> > The goal should be to export the information in the new build system so
> that we
> > don't have to filter it.
>
> Yes. We should only export the machine flags in pkgconfig's CFLAGS.
>
> We can export other things from a BSP but they need to be plgconfig
> variables..
> An example would be mkimage arguments if the BSP can be booted by u-boot.
>
> >
> >>
> >> 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?
> >
> > It is just something that came up during the testing of the new build
> system.
>
> Ah OK.
>

Where is this even used? I can't imagine a lot of code using it. Wouldn't
this be
a case where narrowing down where it is used and addressing that point place
be the easiest? Then we can eliminate it.

Hopefully eliminate all -D's defined for Makefile builds.

>
> > I think this define can go away at some point in time.
>
> That would be great.
>
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200914/4dd757e6/attachment.html>


More information about the devel mailing list