i follow the guide to Configuring the Arm NN SDK build environment for TensorFlow Lite at arm64, i need cross compile flatbuffers, otherwise i will got a error:
[ 77%] Linking CXX shared library ../../libarmnnTfLiteParser.so
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: /home/armnn2/flatbuffers/libflatbuffers.a(util.cpp.o):Relocations in generic ELF (EM: 62)
/home/armnn2/flatbuffers/libflatbuffers.a: error adding symbols: File in wrong format
Can anyone tell me how to cross-compile flatbuffers?
Sounds like this should be a question for TensorFlow people, or people that know about cross compiling for ARM.
Sounds like this should be a question for TensorFlow people, or people that know about cross compiling for ARM.
i tried to cross-compile flatbuffers for ARM, and the command i used:
CXX=aarch64-linux-gnu-g++ CC=aarch64-linux-gnu-gcc cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
I don't know if my command is correct,and when imakeit,i got the error:
[ 44%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/go_generator.cc.o
[ 46%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/java_generator.cc.o
[ 47%] Linking CXX executable flathash
[ 47%] Built target flathash
[ 50%] Linking CXX static library libflatbuffers.a
[ 50%] Linking CXX executable flatc
[ 50%] Built target flatbuffers
[ 50%] Built target flatc
[ 52%] Generating tests/monster_test_generated.h
./flatc: 8: ./flatc: Syntax error: "(" unexpected
make[2]: *** [CMakeFiles/flattests.dir/build.make:62:tests/monster_test_generated.h] error 2
make[1]: *** [CMakeFiles/Makefile2:289:CMakeFiles/flattests.dir/all] error 2
[ 55%] Generating samples/monster_generated.h
[ 55%] Generating samples/monster_generated.h
[ 57%] Generating samples/monster_generated.h
./flatc: 8: ./flatc: ./flatc: 8: ./flatc: Syntax error: "(" unexpected
Syntax error: "(" unexpected
make[2]: *** [CMakeFiles/flatsamplebinary.dir/build.make:62:samples/monster_generated.h] error 2
make[2]: *** [CMakeFiles/flatsampletext.dir/build.make:62:samples/monster_generated.h] eroor 2
make[1]: *** [CMakeFiles/Makefile2:141:CMakeFiles/flatsamplebinary.dir/all] error 2
make[1]: *** [CMakeFiles/Makefile2:215:CMakeFiles/flatsampletext.dir/all] error 2
./flatc: 8: ./flatc: Syntax error: "(" unexpected
make[2]: *** [CMakeFiles/flatsamplebfbs.dir/build.make:62:samples/monster_generated.h] error 2
make[1]: *** [CMakeFiles/Makefile2:252:CMakeFiles/flatsamplebfbs.dir/all] error 2
make: *** [Makefile:161:all] error 2
You are compiling flatc for arm and then using it on your build host (which I guess is not arm). This is not possible. Just build flatbuffers for yourself locally and use the headers on your arm target. If you want to cross-compile flatc or others as well make sure that you do not try to build the tests (set FLATBUFFERS_BUILD_TESTS to OFF).
您正在为arm编译flatc,然后在构建主机上使用它(我猜不是arm)。这是不可能的。只需在本地为自己构建Flatbuffer并使用arm目标上的标头即可。如果您也想交叉编译flatc或其他,请确保不要尝试构建测试(将FLATBUFFERS_BUILD_TESTS设置为OFF)。
thanks very much,Your method works well and Successfully solved my problem
Most helpful comment
You are compiling flatc for arm and then using it on your build host (which I guess is not arm). This is not possible. Just build flatbuffers for yourself locally and use the headers on your arm target. If you want to cross-compile flatc or others as well make sure that you do not try to build the tests (set FLATBUFFERS_BUILD_TESTS to OFF).