Skip to content

'Undefined symbols for architecture x86_64' when running compile_ios_tensorflow.sh #28

Open
@ashleyjsands

Description

@ashleyjsands

I am trying to use the instruction in the README file to compile a Tensorflow static library that is compatible with my Mobilenet model file that is produced from tensorflow/examples/image_retraining/retrain.py. The error I get when I try to run this model file in the Tensorflow tf_camera_example app is No OpKernel was registered to support Op 'All' with these attrs.. I'm uncertain whether I should report this issue here or in the Tensorflow Issue tracker.

Here are all of the commands I execute, starting in Tensorflow root:

git checkout v1.4.0
export TF_ROOT=/Users/ashleysands/code/tensorflow-v1.4/
cd ~/code/iOS_Tensorflow_ObjectDetection_Example/config/
bash config.sh
cd $TF_ROOT
./configure
vim tensorflow/contrib/makefile/Makefile
bazel build tensorflow/python/tools:print_selective_registration_header
bazel-bin/tensorflow/python/tools/print_selective_registration_header \     --graphs=/Users/ashleysands/code/data/mobilenet_1.0_224_quantized.pb > ops_to_register.h
cp ops_to_register.h tensorflow/core/framework/
vim tensorflow/contrib/makefile/compile_ios_protobuf.sh
tensorflow/contrib/makefile/download_dependencies.sh
tensorflow/contrib/makefile/compile_ios_protobuf.sh
tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3  -DANDROID_TYPES=ANDROID_TYPES_FULL -DSELECTIVE_REGISTRATION -DSUPPORT_SELECTIVE_REGISTRATION"

The very last command I get this error:

Undefined symbols for architecture x86_64:
"nsync::nsync_mu_init(nsync::nsync_mu_s_)", referenced from:
tensorflow::mutex::mutex() in env.o
tensorflow::mutex::mutex() in random.o
"nsync::nsync_mu_lock(nsync::nsync_mu_s_
)", referenced from:
tensorflow::mutex::lock() in env.o
tensorflow::mutex::lock() in random.o
tensorflow::mutex::lock() in histogram.o
"nsync::nsync_mu_unlock(nsync::nsync_mu_s_*)", referenced from:
tensorflow::mutex::unlock() in env.o
tensorflow::mutex::unlock() in random.o
tensorflow::mutex::unlock() in histogram.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/ashleysands/code/tensorflow-v1.4/tensorflow/contrib/makefile/gen/host_bin/proto_text] Error 1

  • '[' 2 -ne 0 ']'
  • echo 'armv7 compilation failed.'
    armv7 compilation failed.
  • exit 1

I am using macOS 10.13.3 on a Macbook air (Mid 2012) with Bazel 0.8.1 and Xcode 9.2.

Here's my modified Makefile just in case I didn't change it correctly.
Makefile.txt

Here's my ops_to_register.h file:
ops_to_register.h.txt

I've been banging my head against this problem for over a week, and the README in this repo is the best resource I have found on the web for my exact problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions