JieHe96 / iOS_Tensorflow_ObjectDetection_Example

An iOS application of Tensorflow Object Detection with different models: SSD with Mobilenet, SSD with InceptionV2, Faster-RCNN-resnet101
128 stars 28 forks source link

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

Open ashleyjsands opened 6 years ago

ashleyjsands commented 6 years ago

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_mus)", referenced from: tensorflow::mutex::mutex() in env.o tensorflow::mutex::mutex() in random.o "nsync::nsync_mu_lock(nsync::nsync_mus)", 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_mus*)", 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.

avishayzanbar commented 6 years ago

hi @ashleyjsands, i have encountered the same issue now - have you managed to solve this error?

ashleyjsands commented 6 years ago

@avishayzanbar From memory, I don't think I ever got it to work on iOS.