From: Henrik Grimler Date: Sat, 28 Mar 2020 15:34:41 +0000 (+0100) Subject: lib/gvpr: compile mkdefs with $(HOSTCC) rather than $(CC) X-Git-Tag: stable_release_2.44.0~14^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=191596ef54a3fff1c45334bbde2f32eed8bd717d;p=graphviz lib/gvpr: compile mkdefs with $(HOSTCC) rather than $(CC) When cross-compiling graphviz the host tries to run mkdefs to generate gdefs.h, which then fails with something like: ``` /bin/sh: ./mkdefs: cannot execute binary file: Exec format error ``` To work around this we can introduce a variable $(HOSTCC), which expands to the standard compiler, `$(CC)`, unless the user has run `export HOSTCC=some-host-compiler` or similar before configuring. --- diff --git a/lib/gvpr/Makefile.am b/lib/gvpr/Makefile.am index ac3c0980f..d47752216 100644 --- a/lib/gvpr/Makefile.am +++ b/lib/gvpr/Makefile.am @@ -3,7 +3,7 @@ pdfdir = $(pkgdatadir)/doc/pdf pkgconfigdir = $(libdir)/pkgconfig - +HOSTCC ?= $(CC) GVPR_VERSION="2:0:0" AM_CPPFLAGS = \ @@ -21,7 +21,6 @@ AM_CPPFLAGS = \ -DDFLT_GVPRPATH="\".$(PATH_SEPARATOR)$(pkgdatadir)/gvpr\"" pkginclude_HEADERS = gvpr.h -noinst_PROGRAMS = mkdefs noinst_HEADERS = actions.h compile.h gprstate.h parse.h queue.h trieFA.h trie.c noinst_LTLIBRARIES = libgvpr_C.la lib_LTLIBRARIES = libgvpr.la @@ -54,7 +53,8 @@ if WITH_WIN32 libgvpr_la_LDFLAGS += -export-symbols-regex gvpr endif -mkdefs_SOURCES = mkdefs.c +mkdefs$(EXEEXT): + $(HOSTCC) $(srcdir)/mkdefs.c -o mkdefs$(EXEEXT) gdefs.h: $(top_srcdir)/lib/gvpr/gprdata mkdefs$(EXEEXT) ./mkdefs$(EXEEXT) gdefs.h < $(top_srcdir)/lib/gvpr/gprdata