我正在为ios编译tensorflow,并按照https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile 1的说明进行操作。
我能够通过前两步:
sh tensorflow/contrib/makefile/download_dependencies.sh
sh tensorflow/contrib/makefile/compile_ios_protobuf.sh
但是,我有重复的符号错误?我跑的时候
make -f tensorflow/contrib/makefile/Makefile \
TARGET=IOS \
IOS_ARCH=ARM64
任何人都可以提供帮助?谢谢
以下是错误:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a -arch arm64
-miphoneos-version-min=9.2 -framework Accelerate -Xlinker -S -Xlinker -x -Xlinker -dead_strip -all_load
L ~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/protobuf_ios/lib -lz -lstdc++ -lprotobuf -lz -lm
duplicate symbol __ZN10tensorflow7NodeDef10SharedDtorEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef10SharedCtorEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef5ClearEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow72protobuf_ShutdownFile_tensorflow_2fcore_2fframework_2fnode_5fdef_2eprotoEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow70protobuf_AssignDesc_tensorflow_2fcore_2fframework_2fnode_5fdef_2eprotoEv
in: ~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow67protobuf_AddDesc_tensorflow_2fcore_2fframework_2fnode_5fdef_2eprotoEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef8ByteSizeEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef16default_instanceEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef21InitAsDefaultInstanceEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef13IsInitializedEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef11GetMetadataEv in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefD2Ev in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC2Ev in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefD1Ev in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC1Ev in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefD0Ev in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef13SetCachedSizeEi in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef39InternalSerializeWithCachedSizesToArrayEbPh in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef8CopyFromERKS0_ in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef9MergeFromERKS0_ in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC2ERKS0_ in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC1ERKS0_ in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef24SerializeWithCachedSizesEPN6google8protobuf2io17CodedOutputStreamE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef27MergePartialFromCodedStreamEPN6google8protobuf2io16CodedInputStreamE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZTVN10tensorflow7NodeDefE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZTSN10tensorflow7NodeDefE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZTIN10tensorflow7NodeDefE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef8CopyFromERKN6google8protobuf7MessageE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef9MergeFromERKN6google8protobuf7MessageE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZNK10tensorflow7NodeDef3NewEPN6google8protobuf5ArenaE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC2EPN6google8protobuf5ArenaE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDefC1EPN6google8protobuf5ArenaE in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow81static_descriptor_initializer_tensorflow_2fcore_2fframework_2fnode_5fdef_2eproto_E in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
duplicate symbol __ZN10tensorflow7NodeDef17default_instance_E in:
~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/lib/ios_ARM64/libtensorflow-core.a(node_def.pb.o)
ld: 44 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [~/Documents/Projects/tensorflow/tensorflow/contrib/makefile/gen/bin/ios_ARM64/benchmark] Error 1
答案 0 :(得分:0)
可能有多个,
libtensorflow-core.a in your project.
因此,请尝试将其删除,然后重新制作。
项目中有一些重复的文件或方法或变量。因此,请尝试搜索并删除它们。
答案 1 :(得分:0)
在撰写本文时,TensorFlow的HEAD
无法很好地适用于iOS。如果关闭这样的短暂问题,它会有所帮助,所以这里有两个通用机制(如果我错过了要链接的相关问题,请帮助!):
HEAD
上的master
)的前沿,则期望中断。发布标签通常更稳定,并且应该很好地构建,以及缺少最新更改的成本。例如,git tag
列出了标记,通常可以选择vX.Y.Z
个模式。make -f tensorflow/contrib/makefile/Makefile clean
。此外,TensorFlow的官方构建系统依赖于Bazel,make
构建系统大部分时间都落后于:所有依赖make
的平台都有较高的破解风险HEAD
(再次,并非总是如此)。请注意make
构建系统位于tensorflow/contrib
目录中的方式,该目录已明确放在一边。