tensorflowにサードパーティのCライブラリを追加して、例の1つでそれを使用することができます。従うべき例がないように思われるので、どんな援助も感謝するでしょう。テンソルフローにサードパーティのCライブラリを追加するには?
私の仕事は、サードパーティのCライブラリとしてevent2を使用しています。
私はイベント2 /ヘッダを提供するために、 'LN -s' tensorflowで/ THIRD_PARTYを作成しました:
ls -al ~/code/tensorflow/third_party/event2
lrwxr-xr-x 1 XXXX staff 25 May 17 16:03 ~/code/tensorflow/third_party/event2 -> /usr/local/include/event2
/usr/local/include> ls event2
BUILD bufferevent_struct.h event_compat.h listener.h thread.h
buffer.h dns.h event_struct.h rpc.h util.h
buffer_compat.h dns_compat.h http.h rpc_compat.h visibility.h
bufferevent.h dns_struct.h http_compat.h rpc_struct.h
bufferevent_compat.h event-config.h http_struct.h tag.h
bufferevent_ssl.h event.h keyvalq_struct.h tag_compat.h
THIRD_PARTY /イベント2/BUILD:tensorflow /例で
licenses(["notice"])
cc_library(
name = "event2",
srcs = glob([ "*.h" ]),
visibility = [ "//visibility:public" ],
)
/label_image/BUILD、libeventへの参照とevents2ライブラリを使用する私のテストファイルを追加しました:
cc_binary(
name = "label_image",
srcs = [
"main.cc",
"my_new_file_using_events.c",
"my_new_file_using_events.h",
],
linkopts = ["-lm", ],
copts = [ "-Ithird_party", ],
deps = [
"//tensorflow/cc:cc_ops",
"//tensorflow/core:framework_internal",
"//tensorflow/core:tensorflow",
"//third_party/event2:event2",
],
)
罰金mpilesしかし、私は、バイナリを実行したとき、私は次のエラーを取得:
dyld: lazy symbol binding failed: Symbol not found: _event_base_new
Referenced from: /Users/XXXX/code/tensorflow/bazel-bin/tensorflow/examples/label_image/label_image
Expected in: flat namespace
dyld: Symbol not found: _event_base_new
Referenced from: /Users/XXXX/code/tensorflow/bazel-bin/tensorflow/examples/label_image/label_image
Expected in: flat namespace
[1] 41395 trace trap bazel-bin/tensorflow/examples/label_image/label_image
libevent.a、libevent.dylibおよびその他のlibevent * LIBSには、/ usr/local/libにあります。 nmによると、event_baseは未定義です。
nm -f label_image | grep event_base
U _event_base_dispatch
U _event_base_new
どのようにこのリンクエラーを解決できますか?ありがとう。