On 7/6/2026 2:13 PM, Philippe Mathieu-Daudé wrote:
> Since commit 6beec3bcdaa ("target/hexagon: add build config for
> softmmu") we build the Hexagon target by default when system
> emulation is selected. This commit introduced a hard dependency
> on the 'bison' program for the idef parser. The binary provided
> by Darwin is too old, and the build now fails:
> 
>   $ ../configure
>   python determined to be '/opt/homebrew/bin/python3'
>   C compiler for the host machine: clang (clang 17.0.0 "Apple clang version 
> 17.0.0 (clang-1700.6.4.2)")
>   Program bison found: NO found 2.3 but need: '>=3.0' (/usr/bin/bison)
> 
>   ../target/hexagon/meson.build:300:8: ERROR: Program 'bison' not found or 
> not executable
> 
>   ERROR: meson setup failed
> 
> Since we use a lcitool generated vars file, we already install
> 'bison' from homebrew, but we don't have its path in our $PATH
> variable. Add it to the macos.yml PATH_EXTRA variable which will
> amend it to the global $PATH.
> 
> Fixes: 6beec3bcdaa ("target/hexagon: add build config for softmmu")
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
> This however doesn't help macOS users ... They need to manually
> register the homebrew bison path.
> ---
>  .gitlab-ci.d/macos.yml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.d/macos.yml b/.gitlab-ci.d/macos.yml
> index 53b6e6c4d8f..3a9e5f46702 100644
> --- a/.gitlab-ci.d/macos.yml
> +++ b/.gitlab-ci.d/macos.yml
> @@ -37,7 +37,7 @@ aarch64-macos-15-build:
>    variables:
>      QEMU_JOB_MACOS: 1
>      NAME: macos-15
> -    PATH_EXTRA: /opt/homebrew/gettext/bin
> +    PATH_EXTRA: /opt/homebrew/gettext/bin:/opt/homebrew/opt/bison/bin
>      PKG_CONFIG_PATH: 
> /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
>      CONFIGURE_ARGS:
>          --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
> @@ -54,7 +54,7 @@ aarch64-macos-26-build:
>      QEMU_JOB_MACOS: 1
>      NAME: macos-26
>      DYLD_LIBRARY_PATH: /opt/homebrew/opt/expat/lib/
> -    PATH_EXTRA: /opt/homebrew/gettext/bin
> +    PATH_EXTRA: /opt/homebrew/gettext/bin:/opt/homebrew/opt/bison/bin
>      PKG_CONFIG_PATH: 
> /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
>      CONFIGURE_ARGS:
>          --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu

It seems like to be a classic issue on MacOS, given that the base system
comes with an outdated bison version. The only idea I have to help users
would be to explicitly search for homebrew version in meson.

It should push user to do something intuitive:
- configure returns an error about bison version
- user check which bison is taken, and which version it has
- eventually googles this and finds it needs homebrew version
- user install homebrew version
- configure is now happy

It does not impact other OS since homebrew file won't be present.
It leaves out users with custom path for homebrew, but I'm not sure a
lot of people try to change it.

What do you think?

--- a/target/hexagon/meson.build
+++ b/target/hexagon/meson.build
@@ -297,7 +297,7 @@ if idef_parser_enabled and ('hexagon-linux-user' in
target_dirs or
     )

     bison = generator(
-        find_program('bison', version: '>=3.0'),
+        find_program(['bison', '/opt/homebrew/opt/bison/bin'], version:
'>=3.0'),
         output: ['@[email protected]', '@[email protected]'],
         arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
     )

Reply via email to