From 5c35517511356e694ba8249379ac128fa80bd4a4 Mon Sep 17 00:00:00 2001 From: Evgeniy Patlan Date: Wed, 19 Aug 2026 12:55:49 +0300 Subject: [PATCH] Skip innovation parser when its series is already bundled create_parser_plugin() names its targets after the major.minor of the parser version (mysql_9.7, gen_lex_hash_9.7). A plugin is built for every directory under yacc/ and then one more for the server the shell is built against, so when that server's series matches a bundled parser the configure step fails: add_executable cannot create target "gen_lex_hash_9.7" because another target with the same name already exists With 5.7.44, 8.0.36, 8.4.0 and 9.7.0 bundled, that rules out building against any 5.7, 8.0, 8.4 or 9.7 server, including the 8.4 LTS series and the mysql-9.7.0 that INSTALL.md instructs the reader to clone. Skip the extra plugin when a bundled parser already covers the series. --- mysqlshdk/libs/yparser/mysql/CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mysqlshdk/libs/yparser/mysql/CMakeLists.txt b/mysqlshdk/libs/yparser/mysql/CMakeLists.txt index 3eaec7060..175862686 100644 --- a/mysqlshdk/libs/yparser/mysql/CMakeLists.txt +++ b/mysqlshdk/libs/yparser/mysql/CMakeLists.txt @@ -343,14 +343,26 @@ endif() # build libraries for all bundled parsers set(PARSERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yacc") +set(BUNDLED_PARSER_SERIES) file(GLOB DIR_CONTENTS LIST_DIRECTORIES true "${PARSERS_DIR}/*") foreach(FULL_PATH ${DIR_CONTENTS}) get_filename_component(VERSION "${FULL_PATH}" NAME) if(IS_DIRECTORY "${FULL_PATH}" AND VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") create_parser_plugin(PATH "${FULL_PATH}" VERSION "${VERSION}") + GET_MAJOR_MINOR("${VERSION}" BUNDLED_SERIES) + list(APPEND BUNDLED_PARSER_SERIES "${BUNDLED_SERIES}") endif() endforeach() -# parser for the current innovation release -create_parser_plugin(PATH "${MYSQL_SOURCE_DIR}/sql" VERSION "${MYSQL_VERSION}") +# parser for the current innovation release, unless a bundled parser already +# covers that series: plugin and generator target names are keyed on +# major.minor, so building both would be a target name collision +GET_MAJOR_MINOR("${MYSQL_VERSION}" MYSQL_VERSION_SERIES) +list(FIND BUNDLED_PARSER_SERIES "${MYSQL_VERSION_SERIES}" _bundled_index) +if(NOT _bundled_index EQUAL -1) + message(STATUS "Parser for MySQL ${MYSQL_VERSION} is already bundled " + "(series ${MYSQL_VERSION_SERIES}), skipping") +else() + create_parser_plugin(PATH "${MYSQL_SOURCE_DIR}/sql" VERSION "${MYSQL_VERSION}") +endif()