1

I am trying to use Doxygen to create documentation for my code. Following the Doxygen documentation, when I run cmake -G "Unix Makefiles" .. the compiler tells me

CMake Error at CMakeLists.txt:112 (message):
  Doxygen requires at least bison version 2.7 (installed: 2.3)

However, when I run bison -V, I see:

bison (GNU Bison) 3.8.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bison is included in my path by adding export PATH="/usr/local/opt/bison/bin:$PATH" to my ~/.zshrc. Why might the doxygen cmake command be referencing the old bison 2.3?

Enrique Avina
  • 973
  • 7
  • 20
  • On Cygwin I use also the mentioned version and don't get an error (and when debugging I do see that we get version 3.8.2 of Bison). Which version of CMake are you using? – albert Jan 21 '22 at 13:57
  • 2
    Maybe you have multiple Bison version on your system and depending on the used shell a different one is selected. Change the line 112 in your CMakeLists.txt into `message(SEND_ERROR "Doxygen requires at least bison version 2.7 (installed: ${BISON_VERSION}, from: ${BISON_EXECUTABLE})")` and see what happens. – albert Jan 21 '22 at 14:02
  • Does setting `-DBISON_ROOT=/usr/local/opt/bison` at the command line fix it? – Alex Reinking Jan 21 '22 at 21:14
  • @AlexReinking, no I am told that the dbison_root is already that path. – Enrique Avina Jan 22 '22 at 22:05
  • @albert, I am using cmake version `3.22.1`, and running that command with the updated CMakeLists.txt tells me `CMake Error at CMakeLists.txt:112 (message): Doxygen requires at least bison version 2.7 (installed: 2.3, from: /usr/bin/bison)` which is odd because `whereis bison` returns the same path. – Enrique Avina Jan 22 '22 at 22:08
  • 1
    What does `/usr/bin/bison -V` give? Looks like the bison version in `/usr/bin` is the old version and the version in `/usr/local/opt` is not seen. I don't know if the `-DBISON_ROOT=/usr/local/opt/bison` will help otherwise maybe the `-DBISON_EXECUTABLE=/usr/local/opt/bison` might do it. – albert Jan 23 '22 at 08:36
  • @albert `/usr/bin/bison -V` does indeed return the old version. How do I see the root and/or executable correctly? Is it a command line argument: `cmake -G "Unix Makefiles" -DBISON_EXECUTABLE=/usr/local/opt/bison ..` or do I add it into my `CMakeLists.txt`? Ie: `set( CMAKE_CXX_FLAGS "-DBISON_EXECUTABLE=/usr/local/opt/bison" )` – Enrique Avina Jan 23 '22 at 14:43
  • It is a command line argument. – albert Jan 23 '22 at 15:03
  • I may have user permission errors I can't circumvent. `bison -V` returns version 3.8, while `wheris bison` returns `/usr/bin/bison` and `/usr/bin/bison -V` returns version 2.3. I do not know where to go from here. Adding in those command line arguments did not help. – Enrique Avina Jan 24 '22 at 01:54
  • @RickyAvina were you able to solve the problem? I am in the same bout right now:) – Morcus Feb 27 '22 at 18:30
  • @Morcus, unfortunately, no. I'll give this another go from Windows in the future. – Enrique Avina Mar 05 '22 at 21:56

3 Answers3

1

In my case I did like the comments mentioned : using the -DBISON_ROOT=/usr/local/opt/bison argument in the command line.

But first I had the clear the CMake cache.

Here is the commands I ran :

rm CMakeCache.txt
cmake -G "Unix Makefiles" .. -DBISON_ROOT=/usr/local/opt/bison
Astariul
  • 2,190
  • 4
  • 24
  • 41
0

I encountered this today and actually found a relatively simple solution. Funnily enough the message export PATH="/usr/local/opt/bison/bin:$PATH" is tell you exactly what to do. Unfortunately the message doesn't tell you the order in which you need it to be. I added the line to my ~/.zshrc at line 3 or 4 before it started to run anything like ohmyzsh which I have installed. After that problem solved.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 30 '22 at 14:34
0

Cannot configure CMake to look for Homebrew installed version of Bison this post solved my problem. In my case, I changed the

BISON_EXECUTABLE:FILEPATH=/usr/bin/bison

to

BISON_EXECUTABLE:FILEPATH=/usr/local/opt/bison/bin/bison

and

FIND_PACKAGE_MESSAGE_DETAILS_BISON:INTERNAL=[/usr/bin/bison][v2.3()]

to

FIND_PACKAGE_MESSAGE_DETAILS_BISON:INTERNAL=[/usr/local/opt/bison/bin/bison][v3.8.2()]

in CMakeCache.txt and then it worked perfectly. (/usr/local/opt/bison/bin/bison is what "which bison" tells me)

CHEN
  • 1
  • 1
  • 1
    I don't think that you should change the CMakeCache.txt but use `-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison` on the cmake line. – albert Nov 03 '22 at 09:17