mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.53k stars 1.61k forks source link

`ERROR: Unknown options: "b_pie"` when project already configured #13651

Open emilyyyylime opened 3 weeks ago

emilyyyylime commented 3 weeks ago

To Reproduce

$ mkdir build
$ echo "project('placeholder')" > meson.build
$ meson setup -D b_pie=true build
The Meson build system
Version: 1.5.1
Source dir: tmp
Build dir: tmp/build
Build type: native build
Project name: foo
Project version: undefined
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 0

foo undefined

  User defined options
    b_pie: true

Found ninja-1.12.1 at /usr/bin/ninja
$ meson setup -D b_pie=true build
Directory already configured.

Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
Run "meson setup --reconfigure to force Meson to regenerate.

If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.

ERROR: Unknown options: "b_pie"

(seemingly you're also missing a closing quote)

Expected behaviour / use-case The only reason I'm facing this issue is because I'm running meson as part of an automated build/installation process (specifically an AUR package), and it should seamlessly work the first time as well as on repeated invocations (for example when some of the code is updated but we would like to keep previous build artifacts for faster compile-time). I don't mind the warning—the only issue is that meson is quitting with nonzero status making the packaging pipeline consider it as failed. Do you think changing this could be feasible?

amcn commented 2 weeks ago

After looking into this, it seems to be due to b_pie being an option which is added to the internal options list by a compiler, but because the project() in the example does not specify a language, meson has not yet made an attempt to detect any compilers. This definitely seemed like a bug to me and after searching around it has been noticed before: #12923.

If you manually add a language in the project definition, it should avoid the behaviour that you are encountering:

$ echo "project('placeholder', 'c')" > meson.build

Would this be an acceptable workaround for the time being until a solution for #12923 can be worked on?