Bug #113444 Contribution by Tencent:-DBISON_EXECUTABLE may cause compile error
Submitted: 16 Dec 2023 16:23 Modified: 17 Dec 2023 13:28
Reporter: Xiaodong Huang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.2.0 OS:CentOS
Assigned to: CPU Architecture:x86
Tags: bison

[16 Dec 2023 16:23] Xiaodong Huang
Description:
If an older Bison version is in the system path, specifically less than 3.0.4, and the -DBISON_EXECUTABLE points to a different Bison version that is greater or equal to 3.0.4, the compilation may encounter errors. These errors can be found in the file generated by Bison, as the higher version may use other installation files from the lower version.

Root Cause:

Here are all the installation files for Bison:

.
└── usr
    └── local
        ├── bin
        │   ├── bison
        │   └── yacc
        ├── lib
        │   └── liby.a
        └── share
            ├── aclocal
            ├── bison
            ├── doc
            ├── info
            ├── locale
            └── man

The lower version of Bison is installed in the system root path "/", while the higher version of Bison is installed in a user-specific path, for example: "/user/home/xxx/bison/install".

If the -DBISON_EXECUTABLE is set to "/user/home/xxx/bison/install/usr/local/bin/bison" and the "/user/home/xxx/bison/install/usr/local/share" is not set in the environment variables in the shell, the BISON_EXECUTABLE Bison will invoke "/usr/local/share/bison" files. This may lead to unexpected errors.

How to repeat:
1. Remove the previous installation files of bison in the system path;
2. Install Bison 2.7 in the system and install another version, 3.1, in "/user/home/xxx/bison/install";
3. cd "source code root directory" and mkdir build;
4. Run the following command: "cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_DEBUG=1 -DWITH_BOOST=“boost path" -DBISON_EXECUTABLE=/user/home/xxx/bison/install/usr/local/bin/bison .."
5. Running "make -j" will report an error.

Suggested fix:
-DBISON_ EXECUTBLE should be specified as an Bison install root directory instead of an bison executable file path
[17 Dec 2023 13:28] MySQL Verification Team
Hello Xiaodong,

Thank you for the report and feedback.

regards,
Umesh