meson: 0.51.0 `native: true`/`native: false` mixing warning doesn't account for safe conditional usage

When building with meson-0.50.1 a lot of warnings are printed like:

WARNING:
                        Target eolian_gen is used as a generator, but is built for the host
                        machine. This means most cross builds will fail. You might want to
                        set `native: true` instead to build it for the build machine.

However, all of our executables that are used as generators are guarded like this:


eolian_gen_bin = executable('eolian_gen',
        eolian_gen_src,
        dependencies: eolian,
        install: true,
        c_args : package_c_args,
)

eolian_gen_path = eolian_gen_bin.full_path()

if meson.is_cross_build()
  _eolian_gen_bin = find_program('eolian_gen', native : true)
  eolian_gen_path = _eolian_gen_bin.path()
else
  _eolian_gen_bin = eolian_gen_bin
  eolian_gen_path = _eolian_gen_bin.full_path()
endif

eolian_gen = [_eolian_gen_bin, '-S']

I did a cross compile to a unrunnable arch on my laptop to verify we have no problem there.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (21 by maintainers)

Commits related to this issue

Most upvoted comments

I would just remove this. We have good error messages when the issue does happen so when people eventually encounter this they will know what to do.

In fact if you just do this:

e = executable('foo', 'foo.c')
g = generator(e, ..)

It will print this warning. That is bad UX. That should work just fine without warnings because that is the common case. Most people and projects don’t care about cross compilation and warning about this is confusing.

The warning itself is reasonable but there are just too many false positives.