0

私は github https://github.com/openvinotoolkit/openvinoの指示に従ってmacOS でビルドし、それを実行しました。チェックする小さなコードを書いたときに、すべて明確かどうかを確認しました

#include <string>
#include <iostream>
#include <dlfcn.h>
#include <fstream>

#define USE_STATIC_IE

#define _CRT_SECURE_NO_WARNINGS

#include <ie_core.hpp>

using namespace :: std;

int main(){
    dlopen("/Users/nk/Documents/HZ/openvino/inference-engine/temp/tbb/lib/libtbb.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libngraph.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libinference_engine_transformations.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libinference_engine_legacy.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libinference_engine.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libinference_engine_lp_transformations.dylib", RTLD_LAZY);
    dlopen("/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/libMKLDNNPlugin.dylib", RTLD_LAZY);

    const std::string pluginsFilePath = "/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib/plugins.xml";
    InferenceEngine::Core ie(pluginsFilePath);
    const auto info = ie.GetVersions("CPU");

    if(!info.empty())
        cout << "Yes";

    return 0;
}

コマンドでコンパイルすると

g++ -std=c++11 -I/Users/nk/Documents/HZ/openvino/inference-engine/include testdll.cpp -o testdll && "/Users/nk/Documents/FelenaSoft/"testdll

それは私にエラーを与えました

Undefined symbols for architecture x86_64:
  "InferenceEngine::Core::Core(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in testdll-788073.o
  "InferenceEngine::Core::GetVersions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
      _main in testdll-788073.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

次に、.a libs を追加して、このコマンドを実行しました

g++ -std=c++11 -L/Users/nk/Documents/HZ/openvino/bin/intel64/Release/lib -lmkldnn -lpugixml -linference_engine_s -I/Users/nk/Documents/HZ/openvino/inference-engine/include testdll.cpp -o testdll && "/Users/nk/Documents/FelenaSoft/"testdll 

そして私はこれを手に入れました

Undefined symbols for architecture x86_64:
  "ngraph::as_output_vector(std::__1::vector<std::__1::shared_ptr<ngraph::Node>, std::__1::allocator<std::__1::shared_ptr<ngraph::Node> > > const&)", referenced from:
      ngraph::Node::generate_adjoints(ngraph::autodiff::Adjoints&, std::__1::vector<std::__1::shared_ptr<ngraph::Node>, std::__1::allocator<std::__1::shared_ptr<ngraph::Node> > > const&) in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::match_node(ngraph::pattern::Matcher*, ngraph::Output<ngraph::Node> const&)", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::match_value(ngraph::pattern::Matcher*, ngraph::Output<ngraph::Node> const&, ngraph::Output<ngraph::Node> const&)", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::constant_fold(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > >&, std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&)", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::set_arguments(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&)", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::clone_with_new_inputs(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&) const in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::set_output_type(unsigned long, ngraph::element::Type const&, ngraph::PartialShape const&)", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::clone_with_new_inputs(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&) const in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::m_next_instance_id", referenced from:
      std::__1::shared_ptr<ExecGraphInfoSerialization::ExecutionNode> std::__1::shared_ptr<ExecGraphInfoSerialization::ExecutionNode>::make_shared<>() in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::validate_and_infer_types()", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::evaluate(std::__1::vector<std::__1::shared_ptr<ngraph::runtime::HostTensor>, std::__1::allocator<std::__1::shared_ptr<ngraph::runtime::HostTensor> > > const&, std::__1::vector<std::__1::shared_ptr<ngraph::runtime::HostTensor>, std::__1::allocator<std::__1::shared_ptr<ngraph::runtime::HostTensor> > > const&)", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::~Node()", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::~ExecutionNode() in libinference_engine_s.a(ie_rtti.cpp.o)
      ExecGraphInfoSerialization::ExecutionNode::~ExecutionNode() in libinference_engine_s.a(ie_rtti.cpp.o)
      std::__1::__shared_ptr_emplace<ExecGraphInfoSerialization::ExecutionNode, std::__1::allocator<ExecGraphInfoSerialization::ExecutionNode> >::~__shared_ptr_emplace() in libinference_engine_s.a(ie_rtti.cpp.o)
      std::__1::__shared_ptr_emplace<ExecGraphInfoSerialization::ExecutionNode, std::__1::allocator<ExecGraphInfoSerialization::ExecutionNode> >::~__shared_ptr_emplace() in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::is_dynamic() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::description() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::is_constant() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_arguments() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_output_size() const", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::clone_with_new_inputs(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&) const in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::write_description(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned int) const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::copy_with_new_args(std::__1::vector<std::__1::shared_ptr<ngraph::Node>, std::__1::allocator<std::__1::shared_ptr<ngraph::Node> > > const&) const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_output_element_type(unsigned long) const", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::clone_with_new_inputs(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&) const in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_default_output_index() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_output_partial_shape(unsigned long) const", referenced from:
      ExecGraphInfoSerialization::ExecutionNode::clone_with_new_inputs(std::__1::vector<ngraph::Output<ngraph::Node>, std::__1::allocator<ngraph::Output<ngraph::Node> > > const&) const in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::get_autob() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "ngraph::Node::is_output() const", referenced from:
      vtable for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "typeinfo for ngraph::Node", referenced from:
      typeinfo for ExecGraphInfoSerialization::ExecutionNode in libinference_engine_s.a(ie_rtti.cpp.o)
  "vtable for ngraph::Node", referenced from:
      std::__1::shared_ptr<ExecGraphInfoSerialization::ExecutionNode> std::__1::shared_ptr<ExecGraphInfoSerialization::ExecutionNode>::make_shared<>() in libinference_engine_s.a(ie_rtti.cpp.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

誰かが私と同じ問題を抱えていて、誰かがそれを修正する方法を知っていましたか?

4

1 に答える 1

0

何よりもまず、ツールキットのインストールについてクロスチェックする必要があります。すでにモデルを実行しようとしているので、(最新バージョンは 2020.4 です): https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_macos.htmlのように適切にセットアップされていると思います。

取得しているエラー、アーキテクチャ x86_64 の未定義シンボルは、推論エンジンで何かを見逃したか、モデルを特定のリソースにリンクする方法が正しくないか、その他の理由を示す Xcode ビルドの失敗です。このエラーが続く限り、コードをコンパイルすることはできません。これが、リンカー コマンドが終了コード 1 で失敗した理由です。

ほとんどのエラーは、ユーザーが OpenVINO 環境変数を設定していないか、モデル オプティマイザーを正しく構成していないために発生します。これが、検証スクリプトを実行してインストールを検証し、サンプルをコンパイルすることが非常に重要である理由です。

カスタム モデルを実行する前に、Openvino 環境がしっかりと動作していることをお勧めします。そのため、こちらの例のようにデフォルト モデルを実行できるかどうかを確認してください https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_macos.html

デフォルトでは、ツールキットを正しく構成した場合に動作するサンプルであるオープン動物園モデル、モデル オプティマイザー、および推論エンジンを含む事前トレーニング済みのモデルが既にあるはずです。これらは、他のリソースとは別にインストールする必要のない、インストール済みのツールキットのディレクトリに既に配置されているはずです。

必要なことに注意してください: CMake 3.4 以降、Python 3.5 以降、Apple Xcodeコマンド ライン ツール*、(オプション) Apple Xcode* IDE (OpenVINO には必要ありませんが、開発には役立ちます)、

対応MAC OSはmacOS 10.14.4

繰り返しになりますが、Openvino 環境にあるものと、構成に使用した手順を公式ドキュメントhttps://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_macos.htmlでクロスチェックしてください。

ありがとう!

于 2020-07-23T03:29:43.653 に答える