2017-10-02 2 views
-1

Lorsque je tente d'exécuter le script shell suivant à (https://github.com/renmengye/rec-attend-public):erreur de compilation en utilisant stdlibC++ - symbole (s) non trouvé pour l'architecture x86_64

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') 
g++ -std=c++11 -stdlib=libc++ -shared hungarian.cc -o hungarian.so -fPIC -I $TF_INC -D_GLIBCXX_USE_CXX11_ABI=0 

Je reçois les erreurs suivantes:

11 warnings generated. 
Undefined symbols for architecture x86_64: 
    "tensorflow::DEVICE_CPU", referenced from: 
     ___cxx_global_var_init.7 in hungarian-8050bd.o 
    "tensorflow::TensorShape::DestructorOutOfLine()", referenced from: 
     tensorflow::TensorShape::~TensorShape() in hungarian-8050bd.o 
    "tensorflow::TensorShape::AddDim(long long)", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
    "tensorflow::TensorShape::TensorShape()", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
    "tensorflow::register_op::OpDefBuilderReceiver::OpDefBuilderReceiver(tensorflow::register_op::OpDefBuilderWrapper<true> const&)", referenced from: 
     ___cxx_global_var_init in hungarian-8050bd.o 
    "tensorflow::OpDefBuilder::Input(tensorflow::StringPiece)", referenced from: 
     tensorflow::register_op::OpDefBuilderWrapper<true>::Input(tensorflow::StringPiece) in hungarian-8050bd.o 
    "tensorflow::OpDefBuilder::Output(tensorflow::StringPiece)", referenced from: 
     tensorflow::register_op::OpDefBuilderWrapper<true>::Output(tensorflow::StringPiece) in hungarian-8050bd.o 
    "tensorflow::OpDefBuilder::OpDefBuilder(tensorflow::StringPiece)", referenced from: 
     tensorflow::register_op::OpDefBuilderWrapper<true>::OpDefBuilderWrapper(char const*) in hungarian-8050bd.o 
    "tensorflow::kernel_factory::OpKernelRegistrar::InitInternal(tensorflow::KernelDef const*, tensorflow::StringPiece, tensorflow::OpKernel* (*)(tensorflow::OpKernelConstruction*))", referenced from: 
     tensorflow::kernel_factory::OpKernelRegistrar::OpKernelRegistrar(tensorflow::KernelDef const*, tensorflow::StringPiece, tensorflow::OpKernel* (*)(tensorflow::OpKernelConstruction*)) in hungarian-8050bd.o 
    "tensorflow::OpKernelContext::allocate_output(int, tensorflow::TensorShape const&, tensorflow::Tensor**)", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
    "tensorflow::OpKernelContext::CtxFailureWithWarning(tensorflow::Status)", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
    "tensorflow::OpKernelContext::input(int)", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
    "tensorflow::KernelDefBuilder::Device(char const*)", referenced from: 
     ___cxx_global_var_init.7 in hungarian-8050bd.o 
    "tensorflow::KernelDefBuilder::KernelDefBuilder(char const*)", referenced from: 
     tensorflow::register_kernel::Name::Name(char const*) in hungarian-8050bd.o 
    "tensorflow::OpDef::~OpDef()", referenced from: 
     tensorflow::OpRegistrationData::~OpRegistrationData() in hungarian-8050bd.o 
    "tensorflow::OpKernel::OpKernel(tensorflow::OpKernelConstruction*)", referenced from: 
     HungarianOp::HungarianOp(tensorflow::OpKernelConstruction*) in hungarian-8050bd.o 
    "tensorflow::OpKernel::~OpKernel()", referenced from: 
     HungarianOp::~HungarianOp() in hungarian-8050bd.o 
    "tensorflow::internal::LogMessage::MinVLogLevel()", referenced from: 
     HungarianOp::MinWeightedBipartiteCover(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::GetEqualityGraph(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&) in hungarian-8050bd.o 
     HungarianOp::MaxBipartiteMatching(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::Augment(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&) in hungarian-8050bd.o 
    "tensorflow::internal::LogMessage::LogMessage(char const*, int, int)", referenced from: 
     HungarianOp::MinWeightedBipartiteCover(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::GetEqualityGraph(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&) in hungarian-8050bd.o 
     HungarianOp::MaxBipartiteMatching(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::Augment(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&) in hungarian-8050bd.o 
    "tensorflow::internal::LogMessage::~LogMessage()", referenced from: 
     HungarianOp::MinWeightedBipartiteCover(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::GetEqualityGraph(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1> const&) in hungarian-8050bd.o 
     HungarianOp::MaxBipartiteMatching(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::Augment(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&) in hungarian-8050bd.o 
    "tensorflow::internal::LogMessageFatal::LogMessageFatal(char const*, int)", referenced from: 
     tensorflow::core::RefCounted::~RefCounted() in hungarian-8050bd.o 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
     tensorflow::TensorShape::dims() const in hungarian-8050bd.o 
     HungarianOp::MinWeightedBipartiteCover(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::MaxFlow(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&) in hungarian-8050bd.o 
     HungarianOp::Augment(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&) in hungarian-8050bd.o 
     tensorflow::KernelDefBuilder::~KernelDefBuilder() in hungarian-8050bd.o 
     ... 
    "tensorflow::internal::LogMessageFatal::~LogMessageFatal()", referenced from: 
     tensorflow::core::RefCounted::~RefCounted() in hungarian-8050bd.o 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
     tensorflow::TensorShape::dims() const in hungarian-8050bd.o 
     HungarianOp::MinWeightedBipartiteCover(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in hungarian-8050bd.o 
     HungarianOp::MaxFlow(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&) in hungarian-8050bd.o 
     HungarianOp::Augment(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&, Eigen::Matrix<float, -1, -1, 1, -1, -1>&) in hungarian-8050bd.o 
     tensorflow::KernelDefBuilder::~KernelDefBuilder() in hungarian-8050bd.o 
     ... 
    "tensorflow::internal::CheckOpMessageBuilder::ForVar2()", referenced from: 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* tensorflow::internal::MakeCheckOpString<int, int>(int const&, int const&, char const*) in hungarian-8050bd.o 
    "tensorflow::internal::CheckOpMessageBuilder::NewString()", referenced from: 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* tensorflow::internal::MakeCheckOpString<int, int>(int const&, int const&, char const*) in hungarian-8050bd.o 
    "tensorflow::internal::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)", referenced from: 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* tensorflow::internal::MakeCheckOpString<int, int>(int const&, int const&, char const*) in hungarian-8050bd.o 
    "tensorflow::internal::CheckOpMessageBuilder::~CheckOpMessageBuilder()", referenced from: 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* tensorflow::internal::MakeCheckOpString<int, int>(int const&, int const&, char const*) in hungarian-8050bd.o 
    "tensorflow::TensorShape::CheckDimsEqual(int) const", referenced from: 
     Eigen::DSizes<long, 3> tensorflow::TensorShape::AsEigenDSizes<3>() const in hungarian-8050bd.o 
     Eigen::DSizes<long, 2> tensorflow::TensorShape::AsEigenDSizes<2>() const in hungarian-8050bd.o 
    "tensorflow::TensorShape::CheckDimsAtLeast(int) const", referenced from: 
     Eigen::DSizes<long, 3> tensorflow::TensorShape::AsEigenDSizesWithPadding<3>() const in hungarian-8050bd.o 
     Eigen::DSizes<long, 2> tensorflow::TensorShape::AsEigenDSizesWithPadding<2>() const in hungarian-8050bd.o 
    "tensorflow::TensorShape::dim_size(int) const", referenced from: 
     HungarianOp::Compute(tensorflow::OpKernelContext*) in hungarian-8050bd.o 
     HungarianOp::ComputeHungarianBatch(tensorflow::Tensor const&, tensorflow::Tensor*, tensorflow::Tensor*, tensorflow::Tensor*) in hungarian-8050bd.o 
     HungarianOp::ComputeHungarian(tensorflow::Tensor const&, tensorflow::Tensor*, tensorflow::Tensor*, tensorflow::Tensor*) in hungarian-8050bd.o 
     Eigen::DSizes<long, 3> tensorflow::TensorShape::AsEigenDSizesWithPadding<3>() const in hungarian-8050bd.o 
     HungarianOp::CopyInput(tensorflow::Tensor const&) in hungarian-8050bd.o 
     HungarianOp::CopyOutput(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, tensorflow::Tensor*) in hungarian-8050bd.o 
     Eigen::DSizes<long, 2> tensorflow::TensorShape::AsEigenDSizesWithPadding<2>() const in hungarian-8050bd.o 
     ... 
    "tensorflow::Tensor::tensor_data() const", referenced from: 
     HungarianOp::CopyInput(tensorflow::Tensor const&) in hungarian-8050bd.o 
    "tensorflow::Tensor::CheckTypeAndIsAligned(tensorflow::DataType) const", referenced from: 
     tensorflow::TTypes<float, 3ul, long>::ConstTensor tensorflow::Tensor::tensor<float, 3ul>() const in hungarian-8050bd.o 
     tensorflow::TTypes<float, 3ul, long>::Tensor tensorflow::Tensor::tensor<float, 3ul>() in hungarian-8050bd.o 
     tensorflow::TTypes<float, 2ul, long>::Tensor tensorflow::Tensor::tensor<float, 2ul>() in hungarian-8050bd.o 
    "typeinfo for tensorflow::OpKernel", referenced from: 
     typeinfo for HungarianOp in hungarian-8050bd.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

J'ai examiné les questions suivantes, rien ne semble fonctionner:

Si je change à libstdc++:

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') 
g++ -std=c++11 -stdlib=libstdc++ -shared hungarian.cc -o hungarian.so -fPIC -I $TF_INC -D_GLIBCXX_USE_CXX11_ABI=0 

Je reçois l'erreur suivante:

clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] 
In file included from hungarian.cc:15: 
/Users/xyz/tensorflow012/lib/python2.7/site-packages/tensorflow/include/tensorflow/core/framework/op.h:20:10: fatal error: 'unordered_map' file not found 
#include <unordered_map> 
     ^
1 error generated. 

Avant downvoting/fermeture, s'il vous plaît lire la question dans son intégralité.

Répondre

0

Je l'ai compris. Depuis que je cours sur Mac, g ++ a besoin de ce drapeau -undefined dynamic_lookup