[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/19481] New: Binutils build failure when flex is missing

From: john.levin at tutanota dot com
Subject: [Bug gas/19481] New: Binutils build failure when flex is missing
Date: Sun, 17 Jan 2016 14:21:57 +0000


            Bug ID: 19481
           Summary: Binutils build failure when flex is missing
           Product: binutils
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: john.levin at tutanota dot com
  Target Milestone: ---

The binutils 2.26 branch fails to build unless flex (or lex) is installed on
the build system. make fails with the following error when configuring gas:

checking lex output file root... configure: error: cannot find output from
/test/binutils-gdb/missing flex; giving up

Steps to reproduce:
1) Get a copy of the source with correct timestamps on generated files.
   I did not find any tar snapshot or script (like gcc's contrib/gcc_update) so
I did a build with all necessary maintainer tools (bison, flex, ...) installed
to fix the timestamps.
2) Remove flex and lex from the build system so that configure won't find them
3) Configure and build gas in a new/empty build directory (so that build files
from step 1 won't affect the result):
   ../binutils-gdb/configure --prefix=/opt/binutils-test
   make all-gas

Actual results: make fails with the following error while configuring gas:
checking lex output file root... configure: error: cannot find output from
/test/binutils-gdb/missing flex; giving up

Expected results: make should not check for lex output file root when flex/lex
is missing, or at least ignore failure.

I tested on binutils-2_26-branch (commit
412d26bde8585eca3ec6b8bed70197205288cbdf), but the problem most likely exists
on master too.

The problem is caused by the new "lightweight" missing script introduced by
commit e30465112ed4c6320dd19107302057a5f7712cf2 (2014-11-16; Update from
upstream Automake).

Here is the sequence that leads to the failure:
1) The top-level configure finds neither flex nor lex:
checking for flex... no
checking for lex... no
2) The top-level configure sets LEX in the top-level Makefile to the missing
LEX = /test/binutils-gdb/missing flex
3) When gas/configure is run by the top-level Makefile, LEX has the value set
4) gas/configure uses AM_PROG_LEX to detect flex/lex
6) AC_PROG_LEX sees that LEX is set and assumes it is a valid flex/lex provided
by the user:
checking for flex... /test/binutils-gdb/missing flex
7) AC_PROG_LEX runs the program specified by LEX to detect the name of the
output file
8) The new "lightweight" missing script does not produce any output files so
the detection fails:
checking lex output file root... configure: error: cannot find output from
/test/binutils-gdb/missing flex; giving up

Please note that this also affects binutils/configure.ac and ld/configure.ac
because they too use AM_PROG_LEX.

The old missing script used in binutils 2.25.1 and earlier produced faked
output for the missing programs, which is why it worked before. Here is what
gas/configure outputs for 2.25.1:
checking for flex... /test/binutils-2.25.1/missing flex
checking lex output file root... lex.yy

I can create a patch, but I have no idea what is the most appropriate way of
fixing this. I would like to hear your opinions. Here are some suggestions I
came up with (not prioritized), other ideas are of course welcome too:
- Document flex/lex as a pre-requisite for building binutils, even for
- Change top-level configure to not set LEX if flex/lex is not found
  (might upset modules that use LEX without checking)
- In top-level Makefile, add "LEX=" as argument when calling configure of
modules that use AM_PROG_LEX. Should be done only when flex/lex is actually
missing, otherwise an in-tree flex will probably never be used
  (this is inspired by a similar fix in gcc, see below; I tested it by manually
changing the generated top-level Makefile and it appears to work)
- Change affected configure.ac to unset LEX if it is set to the missing script
(not sure how to detect that reliably, though)
- Change AM_PROG_LEX or AC_PROG_LEX to ignore LEX if it is set to a missing
script (this would be a change in autoconf/automake instead of in binutils, I

gcc apparently had the same issue with in-tree builds of gmp after updating to
the "lightweight" missing script, and it was solved (in r218025) by explicitly
passing LEX="touch lex.yy.c" to gmp/configure to override the missing script.
That solution of course means that an in-tree gmp will not use flex even if it
is available, but I guess not many people edit ".l" files in gmp before
building gcc.
For the same reason, building a recent gcc (like 5.3.0) with in-tree binutils
2.25.1 or earlier fails because it will use the "lightweight" missing script
from gcc instead of the older one in binutils.

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]