2016-08-29 64 views
1

我正在爲ios編譯tensorflow,並按照https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile1的說明操作。Tensorflow:ios編譯錯誤(重複符號)

我能順利通過前兩個步驟:

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

請格式化您的問題 –

+1

@bub謝謝,重新格式化 –

回答

0

有可能有多個,

libtensorflow-core.a in your project. 

所以嘗試刪除它,不是再次做到這一點。

您的項目中有一些重複的文件或方法或變量。所以請嘗試搜索並刪除它們。

+0

謝謝,這有點奇怪。我檢查了張量回購中最新的提交:4c49dbebef05442c7e72d6129a30574fcd13f0e1。不知何故,編譯錯誤消失了。 –

+0

歡迎兄弟。 @H。毛 – KAR

0

在撰寫本文時,TensorFlow的HEAD不適合iOS。它會幫助,如果這樣的瞬態問題被關閉,所以這裏有兩個通用機制(如果我錯過了一個相關的問題鏈接,請幫助!):

  • 如果要檢查出任何種類的最前沿(如果使用Git,通常是HEADmaster),期望中斷。發佈標籤往往更加穩定,應該建立良好,缺乏最新變化的代價。例如,git tag列出標籤,通常有vX.Y.Z模式可供選擇。
  • 如果您必須從源代碼重新構建,通常會更好 - 並非總是需要 - 先清理當前構建。清潔需要時間,所以您可以樂觀並直接構建,如果出現任何問題,則清理/構建。通常,命令看起來像make -f tensorflow/contrib/makefile/Makefile clean

此外,TensorFlow的正式構建系統依賴於巴澤爾和make構建系統是大多數時間滯後:依靠make所有平臺有更高的風險在HEAD(再次打破,這並非總是如此)。請注意0​​構建系統位於tensorflow/contrib目錄中,該目錄明確擱置。