I'm a newbie, but I have successfully built the protocol buffers sources 
(version 3.1.0) on Ubuntu 14.04 x86_64 and installed, as 
per https://github.com/google/protobuf/blob/master/src/README.md
I am now attempting to cross-compile to an ARM target, using the 
cross-compiling info from the README above and the following as 
references: https://groups.google.com/forum/#!topic/protobuf/ZWuTzg-N0E0 
After running 'make clean' and re-configuring to use the 
arm-linux-gnueabihf compilers and the previously installed x64 protoc, I 
encounter a error that indicates it is attempting to use the js_embed 
binary built for ARM in the process.
Relevant info as follows:

$ which protoc js_embed
/usr/bin/protoc
/usr/bin/js_embed

$ file /usr/bin/protoc /usr/bin/js_embed
/usr/bin/protoc:   ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.24, 
BuildID[sha1]=637edeade5ad13f462551a45ae1285e55a2a1f3c, not stripped
/usr/bin/js_embed: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.24, 
BuildID[sha1]=e49255de4711facf660f838ad7bad9b01525cf12, not stripped

$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 4.8.4
$ arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 4.8.4

$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

$ make clean
$ ./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc 
CXX=arm-linux-gnueabihf-g++ --with-protoc=/usr/bin/protoc 
--prefix=/programs/protobuf
(Can post output if desired)

$ make
make  all-recursive
make[1]: Entering directory `/storage/tools/protobuf'
Making all in .
make[2]: Entering directory `/storage/tools/protobuf'
make[2]: Leaving directory `/storage/tools/protobuf'
Making all in src
make[2]: Entering directory `/storage/tools/protobuf/src'
/usr/bin/protoc -I. --cpp_out=. google/protobuf/any_test.proto 
google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto 
google/protobuf/map_lite_unittest.proto 
google/protobuf/map_proto2_unittest.proto 
google/protobuf/map_unittest.proto google/protobuf/unittest_arena.proto 
google/protobuf/unittest_custom_options.proto 
google/protobuf/unittest_drop_unknown_fields.proto 
google/protobuf/unittest_embed_optimize_for.proto 
google/protobuf/unittest_empty.proto 
google/protobuf/unittest_enormous_descriptor.proto 
google/protobuf/unittest_import_lite.proto 
google/protobuf/unittest_import.proto 
google/protobuf/unittest_import_public_lite.proto 
google/protobuf/unittest_import_public.proto 
google/protobuf/unittest_lite_imports_nonlite.proto 
google/protobuf/unittest_lite.proto google/protobuf/unittest_mset.proto 
google/protobuf/unittest_mset_wire_format.proto 
google/protobuf/unittest_no_arena_lite.proto 
google/protobuf/unittest_no_arena_import.proto 
google/protobuf/unittest_no_arena.proto 
google/protobuf/unittest_no_field_presence.proto 
google/protobuf/unittest_no_generic_services.proto 
google/protobuf/unittest_optimize_for.proto 
google/protobuf/unittest_preserve_unknown_enum2.proto 
google/protobuf/unittest_preserve_unknown_enum.proto 
google/protobuf/unittest.proto google/protobuf/unittest_proto3_arena.proto 
google/protobuf/unittest_proto3_arena_lite.proto 
google/protobuf/unittest_proto3_lite.proto 
google/protobuf/unittest_well_known_types.proto 
google/protobuf/util/internal/testdata/anys.proto 
google/protobuf/util/internal/testdata/books.proto 
google/protobuf/util/internal/testdata/default_value.proto 
google/protobuf/util/internal/testdata/default_value_test.proto 
google/protobuf/util/internal/testdata/field_mask.proto 
google/protobuf/util/internal/testdata/maps.proto 
google/protobuf/util/internal/testdata/oneofs.proto 
google/protobuf/util/internal/testdata/proto3.proto 
google/protobuf/util/internal/testdata/struct.proto 
google/protobuf/util/internal/testdata/timestamp_duration.proto 
google/protobuf/util/internal/testdata/wrappers.proto 
google/protobuf/util/json_format_proto3.proto 
google/protobuf/util/message_differencer_unittest.proto 
google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto
touch unittest_proto_middleman
depbase=`echo google/protobuf/compiler/js/embed.o | sed 
's|[^/]*$|.deps/&|;s|\.o$||'`;\
arm-linux-gnueabihf-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I..    -pthread 
-DHAVE_PTHREAD=1  -Wall -Wno-sign-compare -O2 -g -DNDEBUG -MT 
google/protobuf/compiler/js/embed.o -MD -MP -MF $depbase.Tpo -c -o 
google/protobuf/compiler/js/embed.o google/protobuf/compiler/js/embed.cc &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ../libtool  --tag=CXX   --mode=link arm-linux-gnueabihf-g++ 
-std=c++11 -pthread -DHAVE_PTHREAD=1  -Wall -Wno-sign-compare -O2 -g 
-DNDEBUG -pthread  -o js_embed google/protobuf/compiler/js/embed.o  
libtool: link: arm-linux-gnueabihf-g++ -std=c++11 -pthread -DHAVE_PTHREAD=1 
-Wall -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o js_embed 
google/protobuf/compiler/js/embed.o  -pthread
oldpwd=`pwd` && cd . && \
$oldpwd/js_embed google/protobuf/compiler/js/well_known_types/any.js 
google/protobuf/compiler/js/well_known_types/struct.js 
google/protobuf/compiler/js/well_known_types/timestamp.js > 
$oldpwd/google/protobuf/compiler/js/well_known_types_embed.cc
*/bin/bash: line 1: /tools/protobuf/src/js_embed: cannot execute binary 
file: Exec format error*
make[2]: *** [google/protobuf/compiler/js/well_known_types_embed.cc] Error 
126
make[2]: Leaving directory `/storage/tools/protobuf/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/storage/tools/protobuf'
make: *** [all] Error 2

$ file src/js_embed 
src/js_embed: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.32, 
BuildID[sha1]=74fb68528ae9db46637e1570eeda640ae9f318f1, not stripped

It's unclear how I can direct the compilation process to use the js_embed 
binary in /usr/bin, instead of the js_embed binary it builds for ARM. Any 
help or direction is appreciated. Thanks! 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to