Build Tensorflow lite for Mac Catalyst - compilation

I'm fairly new to cross-compilation. I am developping a Swift App with a c++ backend that uses the tensorflow static lib on a Mac M1, I succeeded in compiling my own code to mac catalyst with meson.
But now I am struggling to compile the tensorflow static lib with bazel, and I didn't find any useful resources to help me in my task. I saw that apparently bazel does supports catalyst building.
I tried this command (among others):
bazel build -c opt --apple_platform_type catalyst //tensorflow/lite:libtensorflowlite.so
But I got this error that I don't fully understand:
error bazel build for mac catalyst
Any advice would be welcome !

Building TensorFlow Lite for Mac Catalyst involves several steps.
Install Xcode and the Mac Catalyst SDK:
Download and install Xcode from the Mac App Store.
In Xcode, open the Preferences window and go to the Components tab.
Install the Mac Catalyst SDK.
Clone the TensorFlow repository:
Open a Terminal window.
Clone the TensorFlow repository: git clone https://github.com/tensorflow/tensorflow.git
Navigate to the root directory of the TensorFlow repository: cd tensorflow
Configure the build:
Run the configuration script: ./configure
Select the appropriate options for your environment. For example, you may need to specify the location of the Xcode command line tools.
Build TensorFlow Lite:
Run the build command: bazel build --config=catalyst //tensorflow/lite:tensorflowlite.framework
This will build the TensorFlow Lite framework for Mac Catalyst.
Verify the build:
Navigate to the bazel-bin/tensorflow/lite directory: cd bazel-bin/tensorflow/lite
Verify that the tensorflowlite.framework directory exists.
You can now use the tensorflowlite.framework in your Mac Catalyst project. Note that you may need to modify your project settings to include the TensorFlow Lite framework and any other dependencies that it requires.

Related

How to install Google's ScaNN library on M1 mac?

I wanted to to use ScaNN for one of my projects but couldn't install it on my M1 air.
I have tried pip install scann but it doesn't work.
I tried compiling their open sourced code on my machine by installing the correct versions of tensorflow and bazel but receiving some certification error.
ps: I had to switch to google colab workspace to use ScaNN.

Quasar Electron build not working on M1 mac mini with arm64 architecture

I have a Quasar/Electron project and simply trying to build the app via yarn build (which equals to quasar build -m electron in package.json). Previous to my M1 Mac mini upgrade I used to get the following folder structure:
/dist/electron/MyApp-darwin-x86
/dist/electron/UnPackaged
Now I'm just getting:
/dist/electron/UnPackaged
I've tried running it with all sorts of flags/configurations but just can't seem to figure out how to build this on the new Mac. Has anyone else had similar issues?
I have the following dependencies:
OK well, I fixed it (sort of).
I basically switched from electron-packager to electron-builder and had to manually update the dmg-builder npm package to: 22.10.3 (latest package on 12/14/20)
Now after building I get my /dist/electron/Packaged folder as expected:

MAC OS project upgrades from Fabric to FirebaseCrashlytics (without CoCOPod)

We need to use Firebase Crashlytics in a project.
We do not use the CocoaPods libraries, and need a statically linked library (.a)
Could you help me with how to download Firebase Crashlytics library into our project?
Here is the error output from the build process:
Prepare build
Workspace PDF Reader Pro Edtition | Scheme PDF Reader Pro Edition | Destination My Mac
Using new build system
Building targets in parallel
Planning build
Constructing build description
Build target PDF Reader Pro Edition
Project PDF Reader Pro Edtion | Configuration Debug | Destination My Mac | SDK macOS 10.15
PDF Reader Pro Edition isn't code signed but requires entitlements. It is not possible to add entitlement...
OpenGL is deprecated. Consider migrating to Metal instead.
Building for macOS, but the linked framework 'FirebaseCrashlytics.framework' was built for Mac Catalyst.
Build failed 2020/6/28, 10:06 AM 2.9 seconds
1 error, 2 warnings
The GitHub project describes how to build the project without Cocoapods.
https://github.com/firebase/firebase-ios-sdk/tree/master/Crashlytics
Clone or download the project.
Run Crashlytics/generate_project.sh
open gen/FirebaseCrashlytics/FirebaseCrashlytics.xcworkspace

How to install openCV library on Mac OS X 10.6.8

I am new to openCV. How do I install this library on Mac OS X 10.6.8 and how do I include it in Xcode?
Start with one thing at a time:
Install OpenCV
Setup an XCode project
The easiest way is to install OpenCV is via MacPorts.
Make sure you've installed XCode's Command Line Tools first!
sudo port install opencv
note that you can also use ports variants (to add extra features e.g. python and QT support)
sudo port install opencv +qt4 +python27
As of very recently there should also be OpenNI support in MacPorts.
The other option is to build from source using Terminal. You'd also need CMake on top of XCode Command Line Tools
Regarding using OpenCV in XCode, it's a matter of making a c++ project and setting up the header and library search paths for the projects. If you use Macports those would be /opt/local/include/ and /opt/local/lib

Installing openCV on Lion OS 10.7.4 Xcode 4.3.2

I'm trying to install openCV on university's iMac,
but the problem is our university's network is so strict.
and I couldn't install openCV using MacPorts.
I tried google to look for a way to install but it all failed
i guess because it is kind of old ways and because my network is so strict.
So if anybody knows a way that I can download a ready framework with how to use it inside
Xcode. or at least a framework with how to install it to work with Xcode.
or a way to download from the source and compile it then install it in Xcode
please.
Because I tried the cmake way and I still have no luck to get it work.
thanks in advance.
sources I used:
http://salemsayed.me/?p=240
http://opencv.willowgarage.com/wiki/InstallGuide
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
http://www.ient.rwth-aachen.de/cms/software/opencv/
I'm using Lion + Xcode 4.x branch, with OpenCV svn trunk. Everything works fine. You have to install cmake first, then get the code from the svn following the instructions at http://code.opencv.org . The compilation process worked fine for me for all the core modules + the Qt module + the GPU module + TBB acceleration.
The instructions are the same as the Linux platform.
After setting up cmake configuration in a terminal (using ccmake for a more interactive tool),
I set the architecture to x86_64 (on my MBP Core 2 Duo), the target directory to /usr/local/(the default), and I have Intel TBB installed in /usr/local/.
Cmake generates the makefiles for you, so you just have to type make -j2 to compile, then sudo make install. If you're working on a workstation, then you have more CPU power, and you can replace the value 2 by more, e.g. 8.

Resources