[Picolibc] meson and ninja

Keith Packard keithp at keithp.com
Tue Apr 28 16:16:53 PDT 2020


Larry Doolittle <ldoolitt at recycle.lbl.gov> writes:

> Keith -
>
> Thanks for the prompt response!  Maybe we're in the same time zone.  ;-)
>
> On Tue, Apr 28, 2020 at 01:57:10PM -0700, Keith Packard wrote:
>> The meson.build file says >= 0.50. Meson *should* complain about having
>> the wrong version when you try to run it, but ...
>
> Maybe meson-0.49.2 crashed before it got to the version test.
> I get a python stack dump starting with
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/mesonbuild/mesonmain.py", line 112, in run
>     return options.run_func(options)
> proceeding through about 37 intermediate entries to
>   File "/usr/lib/python3/dist-packages/mesonbuild/mparser.py", line 405, in __init__
>     self.subdir = token.subdir
> AttributeError: 'TernaryNode' object has no attribute 'subdir'

Yeah, I'm afraid I don't want to try and debug older versions of
meson -- picolibc needs some new feature that didn't appear until meson
0.50. I don't even remember what it was ...

> Nice, that's a big help.  The key entry is -Dmultilib=false.

Yup. I guess I'm so focused on packaging picolibc for toolchains that
multilib=true seemed like the right default to me...
>
> The cross-foo.txt file you posted defines
>   cpu_family = 'riscv'
> That triggers a warning from meson
>   Unknown CPU family riscv, please report this at
> https://github.com/mesonbuild/meson/issues/new

I've been using 'riscv' because the build generates both riscv32 and
riscv64 results. I haven't noticed any troubles as a result; perhaps I
suggest a change in meson to allow 'riscv' as well.

> which seemed odd to me.
> Referring to meson github issue #5950, I changed it to riscv32.
> But that broke the picolibc ninja build!
>   [930/1037] Linking target test/printf/scanf
>   FAILED: test/printf/scanf 

It looks like there are a few places that should let you use 'riscv32'
instead of 'riscv'. I've added those.

> followed by a large number of
>   ... undefined reference to `__iob'
> error messages.
>
> Is this easily explainable?

Yes, there are a bunch of bits of picolibc which are
architecture-specific. These are selected based on the cpu_family value
found in the configuration. When you specified 'riscv32', all of the
necessary RISC-V bits were missing.

> I can restore build success by adding riscv32 entries to
> the five meson.build files that have riscv entries.
> Plus cp test-riscv.ld test-riscv32.ld (?).

Yup, thanks for the suggestion; I've added riscv32 in various
meson.build files and duplicated test-riscv.ld as test-riscv32.ld (and
test-riscv64.ld, in case someone specifies cpu_family='riscv64')

Thanks for your reports; it's nice to make things work better for people
working in different ways from me.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://keithp.com/pipermail/picolibc/attachments/20200428/9d79c532/attachment.sig>


More information about the Picolibc mailing list