mysql-connector fails to build if either CFLAGS or CXXFLAGS are unset in a misleading way throwing CMake Error at CMakeLists.txt:879 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. CMake Error at CMakeLists.txt:881 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. Reproducible: Always I suggest to add a direct check weather CFLAGS/CXXFLAGS are empty before proceeding with configure and if they are - throw a meaningful message like CFLAGS are empty, please configure CFLAGS/CXXFLAGS
I can confirm this REGEX problem with arm64, more specifically with 8.0.32-r1 ebuild. I fixed it by replacing STRING(REGEX REPLACE "-specs=/usr/lib/rpm/redhat/.*" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) STRING(REGEX REPLACE "-specs=/usr/lib/rpm/redhat/.*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) with STRING(REGEX REPLACE "-specs=/usr/lib/rpm/redhat/.*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") STRING(REGEX REPLACE "-specs=/usr/lib/rpm/redhat/.*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") Please note the added "". I hope someone benefit from this. Seeya.
I have edited the file: /var/tmp/portage/dev-db/mysql-connector-c-8.0.32-r1/work/mysql-8.0.32/CMakeLists.txt
Some websites that may help someone: https://forums.gentoo.org/viewtopic-t-1113956-start-0.html https://forums.gentoo.org/viewtopic-t-1118822-start-0.html