Currently m2 requires that GNU flex is installed, it would be good to commit the built flex file into git and only rebuild this file if maintainer is specified.
flex is required for building GCC from git even without m2. gengtype-lex.l needs to be processed by flex.
https://gcc.gnu.org/install/prerequisites.html Flex version 2.5.4 (or later) Necessary when modifying *.l files. Necessary to build GCC during development because the generated output files are not included in the version-controlled source repository. They are included in releases.
Fixing m2 is not going to change you still need flex to build so closing as invalid.
(In reply to Andrew Pinski from comment #1) > flex is required for building GCC from git even without m2. > > gengtype-lex.l needs to be processed by flex. Yes, I was surprised to see FX ask for this because it's definitely needed... (ref. https://inbox.sourceware.org/gcc/F2B9E804-0226-4851-969C-2EC584B62FDB@gmail.com/). See also PR106899. But really, I don't see how needing flex is a big problem.
But flex should not be needed to build releases. So --enable-generated-files-in-srcdir should work here ...
From maintainer-scripts/gcc_release : contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \ -c "--enable-generated-files-in-srcdir --disable-multilib" \ -m "-j$num_cpus" build || \ error "Could not rebuild GCC"
(In reply to Andrew Pinski from comment #6) > From maintainer-scripts/gcc_release : > contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \ > -c "--enable-generated-files-in-srcdir --disable-multilib" \ > -m "-j$num_cpus" build || \ > error "Could not rebuild GCC" wait that does not enable m2 ... maybe that is the issue.