cjweeks / tensorflow-cmake

Integrate TensorFlow with CMake projects effortlessly
MIT License
331 stars 83 forks source link

Bazel can't find target in Step 1 #48

Open dtsmith2001 opened 4 years ago

dtsmith2001 commented 4 years ago

I'm following Step 1 in the README.

git checkout v1.13.2

I ran ./configure. However, I get

Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'build' from /opt/tmp/tensorflow/.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone --strategy=Genrule=standalone -c opt --announce_rc --define=grpc_no_ares=true --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include
INFO: Reading rc options for 'build' from /opt/tmp/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/lib/python3/dist-packages --python_path=/usr/bin/python3 --config=xla --action_env TF_CONFIGURE_IOS=0
INFO: Found applicable config definition build:xla in file /opt/tmp/tensorflow/.tf_configure.bazelrc: --define with_xla_support=true
INFO: Found applicable config definition build:v2 in file /opt/tmp/tensorflow/.tf_configure.bazelrc: --define=tf_api_version=2
ERROR: Skipping 'tensorflow:libtensorflow_all.so': no such target '//tensorflow:libtensorflow_all.so': target 'libtensorflow_all.so' not declared in package 'tensorflow' (did you mean 'libtensorflow_cc.so'?) defined by /opt/tmp/tensorflow/tensorflow/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '//tensorflow:libtensorflow_all.so': target 'libtensorflow_all.so' not declared in package 'tensorflow' (did you mean 'libtensorflow_cc.so'?) defined by /opt/tmp/tensorflow/tensorflow/BUILD
INFO: Elapsed time: 4.495s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)

I ran bazel clean and bazel shutdown, but I have the same problem. My command-line is

bazel build --config=v2 --local_ram_resources=1024 tensorflow:libtensorflow_all.so

Linux xxx 5.0.0-25-generic #26~18.04.1-Ubuntu SMP Thu Aug 1 13:51:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Ubuntu 18.04.3 LTS

I apply all updates regularly.

yohanderose commented 4 years ago

Same issue here.

ERROR: Skipping 'tensorflow:libtensorflow_all.so': no such target '//tensorflow:libtensorflow_all.so': target 'libtensorflow_all.so' not declared in package 'tensorflow' (did you mean 'libtensorflow_cc.so'?) defined by /home/yohan/tensorflow/tensorflow/BUILD WARNING: Target pattern parsing failed. ERROR: no such target '//tensorflow:libtensorflow_all.so': target 'libtensorflow_all.so' not declared in package 'tensorflow' (did you mean 'libtensorflow_cc.so'?) defined by /home/yohan/tensorflow/tensorflow/BUILD INFO: Elapsed time: 5.102s INFO: 0 processes. FAILED: Build did NOT complete successfully (1 packages loaded)

yohanderose commented 4 years ago

Oh my goodness, just fixed it man. We are appending to the wrong BUILD file, the relevant one is in tensorflow/tensorflow not the root directory and is much longer.

After cloning the repo do: cd tensorflow/tensorflow Append the BUILD file there with cc_binary( name = "libtensorflow_all.so", linkshared = 1, linkopts = ["-Wl,--version-script=tensorflow/tf_version_script.lds"], # Remove this line if you are using MacOS deps = [ "//tensorflow/core:framework_internal", "//tensorflow/core:tensorflow", "//tensorflow/cc:cc_ops", "//tensorflow/cc:client_session", "//tensorflow/cc:scope", "//tensorflow/c:c_api", ], ) Then return back to the root tensorflow and follow the rest of the instructions remembering ./configure.

Hope this helps.