Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android:tensorflow_demo build error - external/fft2d/fft/fftsg.c:641:10: fatal error: 'math.h' file not found #13729

Closed
bbongcol opened this issue Oct 15, 2017 · 5 comments
Labels
stat:community support Status - Community Support type:build/install Build and install issues

Comments

@bbongcol
Copy link

Hi

I succeeded build and install TensorFlow from sources with the link below.
https://www.tensorflow.org/install/install_sources

But, I could not build 'android: tensorflow_demo' under the guidance of the link below.
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android

bazel build -c opt //tensorflow/examples/android:tensorflow_demo

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): none
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): OSX 10.11.6
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below):
    tf.VERSION = 1.4.0-rc0
    tf.GIT_VERSION = b'v1.3.0-rc1-3399-g7cdd26f'
    tf.COMPILER_VERSION = b'v1.3.0-rc1-3399-g7cdd26f'
  • Python version: 3.6
  • Bazel version (if compiling from source): Build label: 0.6.1-homebrew
  • CUDA/cuDNN version: none
  • GPU model and memory: none
  • Exact command to reproduce:
    bazel build -c opt //tensorflow/examples/android:tensorflow_demo

Describe the problem

I could not build 'android: tensorflow_demo' under the guidance of the link below.
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android
bazel build -c opt //tensorflow/examples/android:tensorflow_demo

My System OSX system has 'math.h' header in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/math.h folder.

And I can check fftsg.o, fftsg.d file below path.
bazel-out/host/bin/external/fft2d/_objs/fft2d/external/fft2d/fft/

And fftsg.d have math.h path.

vi fftsg.d
bazel-out/host/bin/external/fft2d/_objs/fft2d/external/fft2d/fft/fftsg.o:
external/fft2d/fft/fftsg.c
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/math.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/cdefs.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/_symbol_aliasing.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/_posix_availability.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/Availability.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/AvailabilityInternal.h

By the way, why do errors occur when building tensorflow_demo?

Source code / logs

ERROR: /private/var/tmp/_bazel_leebongjun/3584e4473c72a5166d05587429923d11/external/fft2d/BUILD.bazel:21:1: C++ compilation of rule '@fft2d//:fft2d' failed (Exit 1).
external/fft2d/fft/fftsg.c:641:10: fatal error: 'math.h' file not found
#include <math.h>
^~~~~~~~
1 error generated.
Target //tensorflow/examples/android:tensorflow_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.271s, Critical Path: 0.39s

@drpngx drpngx added the type:build/install Build and install issues label Oct 16, 2017
@drpngx
Copy link
Contributor

drpngx commented Oct 16, 2017

It looks like there's something wrong in your toolchain. Did you follow the instructions for Mac?

/CC: @mhyttsten

@drpngx drpngx added the stat:community support Status - Community Support label Oct 16, 2017
@bbongcol
Copy link
Author

bbongcol commented Oct 21, 2017

I used the ndk-bundle (v16), which was downloaded via the sdk manager of the Android studio. This version seems to be a compatibility issue.

So I used the standalone Android NDK 14b as a guide.

The Android NDK is required to build the native (C/C++) TensorFlow code. The current recommended version is 14b, which may be found here.

Then build succeeded.

Incidentally, it only builds in Python2. In Python3, the build did not complete because of an execution error in resource_extractor.py.

Anyway, this is a problem with Android NDK version compatibility. I will close Issue.

@naktinis
Copy link

naktinis commented Mar 5, 2018

@bbongcol @drpngx I'm having a similar issue when building android:libtensorflow_inference.so: I can compile fine with NDK r14b and r15c, but not r16b (with the same '@fft2d//:fft2d' error) should I reopen this as a new issue? Or is there something basic I'm missing and this is a mistake on my side?

@linuxaged
Copy link

tensorflow still relies on GCC i think, since ndk-r15 GCC is no longer supported.

@japer21
Copy link

japer21 commented Jun 8, 2018

I get this error

vagrant@vagrant:~/tensorflow$ ../.bazel/bin/bazel build -c opt --copt="-DSELECTIVE_REGISTRATION" --copt="-DSUPPORT_SELECTIVE_REGISTRATION" //tensorflow/contrib/android:libtensorflow_inference.so --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --crosstool_top=//external:android/crosstool --cpu=armeabi-v7a --verbose_failures
WARNING: /home/vagrant/.cache/bazel/_bazel_vagrant/2608380002b7e82b3d07fef59e49e485/external/protobuf_archive/WORKSPACE:1: Workspace name in /home/vagrant/.cache/bazel/_bazel_vagrant/2608380002b7e82b3d07fef59e49e485/external/protobuf_archive/WORKSPACE (@com_google_protobuf) does not match the name given in the repository's definition (@protobuf_archive); this will cause a build error in future versions
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:batch_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:bounds_check.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_activations.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_attention.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_cuboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_pooling.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_softmax.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_volume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding_fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_base.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_op.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_search.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_decoder.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_loss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there
WARNING: /home/vagrant/tensorflow/tensorflow/core/BUILD:1525:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there
INFO: Analysed target //tensorflow/contrib/android:libtensorflow_inference.so (29 packages loaded).
INFO: Found 1 target...
ERROR: /home/vagrant/.cache/bazel/_bazel_vagrant/2608380002b7e82b3d07fef59e49e485/external/fft2d/BUILD.bazel:21:1: C++ compilation of rule '@fft2d//:fft2d' failed (Exit 1): false failed: error executing command 
  (cd /home/vagrant/.cache/bazel/_bazel_vagrant/2608380002b7e82b3d07fef59e49e485/execroot/org_tensorflow && \
  exec env - \
    PWD=/proc/self/cwd \
  /bin/false -MD -MF bazel-out/armeabi-v7a-opt/bin/external/fft2d/_objs/fft2d/external/fft2d/fft/fftsg.pic.d -fPIC -iquote external/fft2d -iquote bazel-out/armeabi-v7a-opt/genfiles/external/fft2d -iquote external/bazel_tools -iquote bazel-out/armeabi-v7a-opt/genfiles/external/bazel_tools -DSELECTIVE_REGISTRATION -DSUPPORT_SELECTIVE_REGISTRATION -c external/fft2d/fft/fftsg.c -o bazel-out/armeabi-v7a-opt/bin/external/fft2d/_objs/fft2d/external/fft2d/fft/fftsg.pic.o)
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
INFO: Elapsed time: 211.430s, Critical Path: 13.76s
INFO: 190 processes, local.
FAILED: Build did NOT complete successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:community support Status - Community Support type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants