mrousavy/react-native-fast-tflite

iOS does not build on x86 Simulators

mrousavy opened this issue ยท 6 comments

On iOS, we currently build TensorFlowLiteC from source. This builds a fat iOS binary:

bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteC_framework
bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteCCoreML_framework

..for some reason users have reported that this does not work when running the app on an iOS Simulator on a Intel x86 Mac.

I don't have such Mac anymore, but I am not sure what's going wrong - maybe there is a way to also build for x86?

Hey thanks for this project!

I am seeing a similar build failure on an M2 (pro) mac as well that seems related and separately I have an Intel based mac (i9) and it is able to build for an IOS simulator just fine. I can build for physical device no problem on both.

here's the error message from the build on an iPhone 15 Pro Max simulator on the M2 mac; perhaps there is a caching issue?

Building for iOS Simulator, but linking in object file built for iOS, file '/Users/XXX/Repos/notewize-player/node_modules/react-native-fast-tflite/ios/TensorFlowLiteC.framework/TensorFlowLiteC' for architecture arm64

I can paste up more of the build log if that is helpful!

I'm happy to help debug if you can give me any pointers as to where to start or look.

Honestly not sure why this is failing, might be interesting to see if TFLite works for Simulators or if they have some patches for that.

I got similar error as follow ld: building for 'iOS-simulator', but linking in object file (/Users/XXX/rn-test/node_modules/react-native-fast-tflite/ios/TensorFlowLiteC.framework/TensorFlowLiteC) built for 'iOS'

Me too
Building for 'iOS-simulator', but linking in object file (.../node_modules/react-native-fast-tflite/ios/TensorFlowLiteC.framework/TensorFlowLiteC) built for 'iOS'

Solved my adding arm64
and this to podFile ๐Ÿ‘‡๐Ÿป
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'i386 arm64'
end
end

xcode_screenshot

Honestly not sure why this is failing, might be interesting to see if TFLite works for Simulators or if they have some patches for that.

@mrousavy there are issues with iOS Simulators it seems, #74