From b40d318650ccde8893400c32814df6f4cdd24fe5 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 3 Jan 2017 13:07:21 -0800 Subject: Fixed cross compilations with the Autotools build Pull request #2517 caused cross compilations to start failing, because the js_embed binary was being built to run on the target platform instead of on the build machine. This change updates the Autotools build to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for the build machine and always use that when building js_embed. --- src/Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 37204ea0..5130d0b1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -484,13 +484,16 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ google/protobuf/compiler/csharp/csharp_wrapper_field.h -bin_PROGRAMS = protoc js_embed +bin_PROGRAMS = protoc protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la protoc_SOURCES = google/protobuf/compiler/main.cc # The special JS code for the well-known types is linked into the compiler via -# well_known_types_embed.cc, which is generated from .js source files. -js_embed_SOURCES = google/protobuf/compiler/js/embed.cc +# well_known_types_embed.cc, which is generated from .js source files. We have +# to build the js_embed binary using $(CXX_FOR_BUILD) so that it is executable +# on the build machine in a cross-compilation setup. +js_embed$(EXEEXT): google/protobuf/compiler/js/embed.cc + $(CXX_FOR_BUILD) -o $@ $< js_well_known_types_sources = \ google/protobuf/compiler/js/well_known_types/any.js \ google/protobuf/compiler/js/well_known_types/struct.js \ -- cgit v1.2.3