tensorflow: Building TensorFlow for iOS failed on macOS Sierra and xCode 8.0
When running compile_ios_protobuf.sh
, it says:
checking whether we are cross compiling… configure: error: in ‘…/tensorflow/tensorflow/contrib/makefile/downloads/protobuf’:
configure: error: cannot run C compiled programs.
If you meant to cross compile, use --host'. See
config.log’ for more details
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 51 (8 by maintainers)
Commits related to this issue
- Fix building for iOS #4640 — committed to Gubarev/tensorflow by Gubarev 8 years ago
- Fix building for iOS #4640 (#5668) — committed to tensorflow/tensorflow by Gubarev 8 years ago
You must also make similar changes to
tensorflow/contrib/makefile/compile_ios_tensorflow.sh
to avoid building the X86_64 library and then also to avoid linking into the final artifact.This is perhaps an easier split view of the necessary work-around changes:
https://github.com/alphamule/tensorflow/commit/672da4fef637c5511fd2cf78a4ac8e710d0efbda?diff=split
@arundasan91 I am also of the opinion that this is an OS issue. My best guess is that, in the upgrade to Sierra, now when you link against the ios simulator libraries (sorry if this is the wrong nomenclature—I’m new to iOS dev) the resulting binary is not executable, whereas I presume it was in El Cap. Even using old simulator versions does not fix the problem. When I compile the same test binary as
./configure
but don’t use the simulator for-isysroot
, the binary runs fine.The only links to the mach-o error message from
config.log
I could find are:https://curl.haxx.se/mail/lib-2016-09/0079.html http://stack1.ocim.top/39762289/issue-with-executing-a-out-file-c-macos-sierra-10-12-1.html http://stackoverflow.com/questions/39762289/issue-with-executing-a-out-file-c-macos-sierra-10-12-1
But none seem to have satisfactory answers here.
Yeah, it’s not Xcode, as you’re still on the step before you can use Xcode (building the libraries).
Did you maybe misinterpret the deleted lines as empty lines?
It needs to look like this:
not
Or else, maybe did you remove one of those trailing backslashes?
From your error logs, I can tell that you are running the command:
which means that the second half of the command is getting cut off.
Downgrading to Xcode 8.0.0 -> 7.3.1 does not seem to fix it.
Same issue. Is there a workaround to build TensorFlow static library?
I modified the camera sample to let it run on photos and succeeded to build library in x86_64 on Sierra by following workaround. Also confirmed the library works in iPhone simulator. (By checking config.log, I found that “–enable-cross-compile” option is likely to become outdated on Sierra. To enable cross-compile, specify “–build” and “–host” with different value worked.)
Although actually doesn’t affect the build process, version values are picked from “15.0.0” => “brew info gcc; ls /usr/local/Cellar/gcc/*/bin” “16.4.0” => “uname -r”
For me, at least, the
compile_ios_protobuf.sh
script is only failing when compiling for-arch x86_64
. The other 4 targets - i386, armv7, armv7s, and arm64 - compile without an error.