[Buildroot] [PATCH v6 03/10] package/newlib-bare-metal: new package

Yann E. MORIN yann.morin.1998 at free.fr
Wed Nov 1 13:42:05 UTC 2023


Neal, All,

On 2023-11-01 13:23 +0000, Frager, Neal via buildroot spake thusly:
[--SNIP--]
> Unfortunately, by making newlib a target package instead of host, the buildroot
> infrastructure does not seem to like that newlib was built for Xilinx MicroBlaze
> and not the expected AArch64 target architecture.
> 
> Below is an example of the error message:
> ERROR: architecture for "/usr/microblazeel-xilinx-elf/lib/libc.a" is "Xilinx MicroBlaze", should be "AArch64"
> 
> Is there a way around this, or do we need to keep newlib-bare-metal as a "host" package
> to avoid this issue?z

You can use _BIN_ARCH_EXCLUDE, see the manual:
    https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

However (but I haven't read all the previous reviews), why would that
file end up in target to beging with?

It is a static library, and from what I understand about this bare-metal
toolchain, the goal is to build firmwares for co-processors, and those
are alwys going to be statically linked, right?

Furthermore, newlib is always going to be a static library, never a
shared one, right?

As such, it should only need to be installed in staging/, not in
target/, and thus:
    NEWLIB_BARE_METAL_INSTALL_STAGING = YES
    NEWLIB_BARE_METAL_INSTALL_TARGET = NO

And then, the check-bin-arch would not find that file, because it would
not be in target/ anymore (and thus _BIN_ARCH_EXCLUDE would not be
needed either).

And then, thinking yet a bit more: it not not even need to be in
staging/ either, as staging/ is for stuff that actually runs on the
target's CPU, not co-procs.

So, I think the gcc-bare-metal package should be configured with a
special sysroot, and newlib-bare-metal installed in that sysroot, e.g.
somethig like:

    HOST_GCC_BARE_METAL_SYSROOT = $(HOST_DIR)/$(GCC_BARE_METAL_ARCH)-elf/sysroot

    HOST_GCC_BARE_METAL_CONF_OPTS = \
        [...]
        --with-sysroot=$(HOST_GCC_BARE_METAL_SYSROOT)

and then:

    NEWLIB_BARE_METAL_INSTALL_OPTS = DESTDIR=$(HOST_GCC_BARE_METAL_SYSROOT)

Totally untested, but this should give some hints as to where to install
stuff.

Thomas, what do you think?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list