mrousavy / react-native-fast-tflite

🔥 High-performance TensorFlow Lite library for React Native with GPU acceleration
https://mrousavy.com
MIT License
604 stars 26 forks source link

iOS does not build on x86 Simulators #35

Open mrousavy opened 5 months ago

mrousavy commented 5 months ago

On iOS, we currently build TensorFlowLiteC from source. This builds a fat iOS binary: https://github.com/mrousavy/react-native-fast-tflite/blob/5b8d61270e777dd5b66bbe06004e5109bac8f874/scripts/build-tensorflow-ios.sh#L16-L17

..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?

eedeebee commented 4 months ago

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.

mrousavy commented 4 months ago

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.

movila commented 4 months ago

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'

stereodenis commented 2 weeks ago

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

hydromoll commented 2 weeks ago

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

lucksp commented 5 days ago

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