Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cocoapods #58

Open
ArshanKhanifar opened this issue Mar 31, 2024 · 11 comments
Open

Add support for cocoapods #58

ArshanKhanifar opened this issue Mar 31, 2024 · 11 comments

Comments

@ArshanKhanifar
Copy link

I want to use this library in my react native project, would be awesome if it was also packaged as a cocoapods package.

@davidkoski
Copy link
Collaborator

I am not familiar with cocoapods -- is that something you would be interested in contributing?

@ArshanKhanifar
Copy link
Author

Already had a jab at it following this blogpost on a fork I made, but had no luck when installing from cocoapods:

pod 'mlx-swift', :git => 'https://github.com/ArshanKhanifar/mlx-swift.git', :branch => 'main', :submodules => true

@ArshanKhanifar
Copy link
Author

Here was the error:

Errno::ENOENT - No such file or directory @ rb_check_realpath_internal - /Users/arshankhanifar/ritual/ritual-mlx/example/ios/Pods/mlx-swift/Source/Cmlx/include/mlx

@davidkoski
Copy link
Collaborator

That looks like it wasn't checked out with git submodules. Take a look at this:

@ArshanKhanifar
Copy link
Author

I ended up flattening the library, and re-running the build
here's the error now:

error: Multiple commands produce '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo.png'
    note: Target 'mlx-swift' (project 'Pods') has copy command from '/Users/arshankhanifar/ritual/ritual-mlx/example/ios/Pods/mlx-swift/Source/Cmlx/mlx-c/docs/src/_static/mlx_logo.png' to '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo.png'
    note: Target 'mlx-swift' (project 'Pods') has copy command from '/Users/arshankhanifar/ritual/ritual-mlx/example/ios/Pods/mlx-swift/Source/Cmlx/mlx/docs/src/_static/mlx_logo.png' to '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo.png'
error: Multiple commands produce '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo_dark.png'
    note: Target 'mlx-swift' (project 'Pods') has copy command from '/Users/arshankhanifar/ritual/ritual-mlx/example/ios/Pods/mlx-swift/Source/Cmlx/mlx-c/docs/src/_static/mlx_logo_dark.png' to '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo_dark.png'
    note: Target 'mlx-swift' (project 'Pods') has copy command from '/Users/arshankhanifar/ritual/ritual-mlx/example/ios/Pods/mlx-swift/Source/Cmlx/mlx/docs/src/_static/mlx_logo_dark.png' to '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo_dark.png'
ClangStatCache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk /Users/arshankhanifar/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphoneos17.4-21E210-99a79c02cfa501706f5b564e46d84afe.sdkstatcache
[build-log-2.log](https://github.com/ml-explore/mlx-swift/files/14817169/build-log-2.log)

I've also attached the full log:

@ArshanKhanifar
Copy link
Author

build-log-2.log

@ArshanKhanifar
Copy link
Author

Following this, might work now

@ArshanKhanifar
Copy link
Author

no luck, same errors
build-log-3.log

@davidkoski
Copy link
Collaborator

From looking at the build log it looks like cocoapods is trying to "build" all of the files in the repository -- pngs from the docs, .py files from the python integration, etc. In fact the error seems to be it picking up multiple copies of the logo (e.g. from the docs):

error: Multiple commands produce '/Users/arshankhanifar/Library/Developer/Xcode/DerivedData/RitualMlxExample-cqxikxirjkpdqfeyyjznhtlcwxgq/Build/Products/Debug-iphoneos/mlx-swift/mlx_logo.png'

The build process is fairly complex. If cocoapods can use the swiftpm build or the CMake build you will be much better off. Otherwise you will need to figure out how to get it to compile each of the targets along the same lines as the swiftpm build.

Is there a reason you can't just use the swiftpm build?

@ArshanKhanifar
Copy link
Author

I want to create a React Native wrapper for this library, and React Native only works with cocoapods. There's this issue to add support for SPM but they have their own challenges.

@tctrautman
Copy link

I'm also hoping to see this be available for React Native apps -- @ArshanKhanifar have you made any progress since this last post?

It sounds like getting cocoapods to work with SPM won't happen anytime soon, which leaves getting the CMake installation to work with cocoapods 😟. Anything you've learned would be appreciated -- my initial research made this sound pretty tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants