[2/3] Fix igen build

Message ID 20210504145818.4088770-3-tromey@adacore.com
State New
Headers show
Series
  • Some minor sim fixes
Related show

Commit Message

Tom Tromey May 4, 2021, 2:58 p.m.
The igen build fails for me like:

gcc  -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o
In file included from ../../binutils-gdb/sim/igen/igen.c:26:
../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory

This patch fixes the problem by arranging for igen to find the
libiberty includes.

This seems slightly hacky to me, because libiberty is not a "build"
library, so it can't be linked against.  However, since igen currently
only includes the header, it seems relatively safe.

sim/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* Makefile.in: Rebuild.
	* Makefile.am (AM_CPPFLAGS): New variable.
---
 sim/ChangeLog   | 5 +++++
 sim/Makefile.am | 2 ++
 sim/Makefile.in | 1 +
 3 files changed, 8 insertions(+)

-- 
2.26.3

Comments

Mike Frysinger via Gdb-patches May 4, 2021, 5:38 p.m. | #1
On 04 May 2021 08:58, Tom Tromey wrote:
> The igen build fails for me like:

> 

> gcc  -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o

> In file included from ../../binutils-gdb/sim/igen/igen.c:26:

> ../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory

> 

> This patch fixes the problem by arranging for igen to find the

> libiberty includes.

> 

> This seems slightly hacky to me, because libiberty is not a "build"

> library, so it can't be linked against.  However, since igen currently

> only includes the header, it seems relatively safe.


since it's only hitting srcroot i think it's OK.  if it was hitting the
build paths, then we'd be in trouble.
-mike

Patch

diff --git a/sim/Makefile.am b/sim/Makefile.am
index a68a964d87a..6696adc304a 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -35,6 +35,8 @@  CLEANFILES =
 DISTCLEANFILES =
 MOSTLYCLEANFILES = core
 
+AM_CPPFLAGS = -I$(srcroot)/include
+
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 
diff --git a/sim/Makefile.in b/sim/Makefile.in
index 890adab5072..5c997b0c118 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -682,6 +682,7 @@  CLEANFILES = testsuite/common/bits-gen testsuite/common/bits32m0.c \
 DISTCLEANFILES = 
 MOSTLYCLEANFILES = core $(am__append_3) site-srcdir.exp testrun.log \
 	testrun.sum
+AM_CPPFLAGS = -I$(srcroot)/include
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 @SIM_ENABLE_IGEN_TRUE@igen_libigen_a_SOURCES = \