编译libtensorflow for ios问题:找不到Eigen/Core

bqf10yzr  于 5个月前  发布在  iOS
关注(0)|答案(6)|浏览(54)

Click to expand!

Issue Type

Build/Install

Source

source

Tensorflow Version

tf 2.10

Custom Code

No

OS Platform and Distribution

MacOs ventura 13.0

Mobile device

  • No response*

Python version

  • No response*

Bazel version

5.3.2

GCC/Compiler version

clang 14.0 (Xcode shipped)

CUDA/cuDNN version

  • No response*

GPU model and memory

  • No response*

Current Behaviour?

Hello !

I am not able to build libtensorflow.so for ios.
I just `./configure` and accepted all defaults.

I can build for my mac:
`bazel build -c opt //tensorflow:libtensorflow.so`
but cross compiling for ios
`bazel build -c opt --config=ios //tensorflow:libtensorflow.so`

gives me this error

`
ERROR: /Users/SX/Documents/soundx-ai/vendor/tensorflow/tensorflow/cc/saved_model/BUILD:319:11: Compiling tensorflow/cc/saved_model/metrics.cc failed: (Aborted): wrapped_clang_pp failed: error executing command external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG ... (remaining 32 arguments skipped)
In file included from tensorflow/cc/saved_model/metrics.cc:16:
In file included from ./tensorflow/cc/saved_model/metrics.h:25:
In file included from ./tensorflow/core/lib/monitoring/counter.h:19:
In file included from ./tensorflow/tsl/lib/monitoring/counter.h:85:
In file included from ./tensorflow/tsl/lib/monitoring/collection_registry.h:109:
In file included from ./tensorflow/tsl/lib/monitoring/collected_metrics.h:28:
In file included from ./tensorflow/tsl/lib/monitoring/metric_def.h:24:
In file included from ./tensorflow/tsl/lib/monitoring/types.h:22:
In file included from ./tensorflow/tsl/platform/types.h:21:
In file included from ./tensorflow/tsl/platform/bfloat16.h:20:
./third_party/eigen3/Eigen/Core:1:10: fatal error: 'Eigen/Core' file not found
#include "Eigen/Core"

I have a eigen3 lib installed with brew, in my /opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3/Eigen/Core , but I did not get how I could give this information to bazel. I'm not able to play with the path directly.
Any clue to solve this problem ?
Thank you!

### Standalone code to reproduce the issue

```shell
bazel build -c opt --config=ios //tensorflow:libtensorflow.so

Relevant log output

  • No response*
rpppsulh

rpppsulh1#

我相信你指出的链接没有引用我正在尝试构建的版本,即iOS,而不是macOS。MacOS构建得很好:)

t3irkdon

t3irkdon2#

我可以更具体地说。一个失败的项目是
saved_model:util
bazel build -c opt //tensorflow/cc/saved_model:util 有效
bazel build -c opt //tensorflow/cc/saved_model:util --config=ios 无效

mwecs4sa

mwecs4sa3#

你好,@simdax ,

请问在为以下配置选项 ./configure 选择时,您选择了哪个选项?

Do you wish to build TensorFlow with iOS support? [y/N]:

如果您没有选择 y ,那么它可能不支持 IOS。请仔细检查并尝试使用 y 选项进行上述配置部分,如果仍然遇到问题,请告知我们。

谢谢!

mctunoxg

mctunoxg4#

是的,我可以确认这一点。其中一个问题与bazel中的"if_mobile"选项有关。使用它构建的所有源文件都失败了。
我认为TensorFlow假设为iOS构建需要使用TFlite,但这并非我的情况?

fnvucqvd

fnvucqvd5#

_好的,我成功地解决了我的问题。我不得不手动调用bazel规则"install_eigen_headers",它位于third_party/eigen3目录下。

这是我自己调用它的正常情况吗?_

抱歉,事实上,编译顺序发生了变化,但错误仍然存在:/

hgc7kmma

hgc7kmma6#

@simdax,

请尝试使用编译器Clang from xcode 10.14Bazel 5.1.1安装TensorFlow v2.10,因为它们是经过测试的构建配置。请查看此官方文档链接以获取参考,并检查您是否遇到了相同的错误。谢谢!

相关问题