kewlbear / Open3D-iOS

Swift package for using Open3D in iOS apps
MIT License
63 stars 33 forks source link

import Open3D-iOs in Xcode 14 #38

Open raphaelmaguet opened 1 year ago

raphaelmaguet commented 1 year ago

Hi, I try to import the Open3D-iOS dependencies in the new version of Xcode 14, bur Xcode can't include it. Can you help me to solve this issue? Below the import result.

Capture d’écran 2022-09-16 à 09 47 24
1agora commented 1 year ago

i've seen these in previous versions of xCode also, resetting package caches and cleaning build folder helps * compiles fine for me using xCode14

EDIT: same issue after my derived data was cleared. Do libraries need to be rebuilt using xcode14?

is this related? : 32-bit app support has been discontinued in Xcode 14

jeffrobot commented 1 year ago

I had the exact same issue. I downgraded the xcode version to 13.4 and it worked.

knsjoon commented 1 year ago

Does anyone have a clue on why it does not work on Xcode 14? I would like to know the reason at least in case of downgrading my xcode version to a lower version

masaldana2 commented 1 year ago

fix plox

1agora commented 1 year ago

issue seems to be in .binaryPackage names -> xcode14 does not like ".a" in the xcframework name

raphaelmaguet commented 1 year ago

@1agora, yes, i tested in my side and i confirm that work in Xcode 14 without ".a" like bellow : in Package.swift

// swift-tools-version:5.3 import PackageDescription

let package = Package( name: "Open3D-iOS", platforms: [ .iOS("16") ], products: [ .library( name: "Open3D-iOS", targets: [ "LinkOpen3D", "Open3DSupport", "Assimp", "Faiss", "IrrXML", "JPEG", "jsoncpp", "libOpen3D_3rdparty_liblzf", "libOpen3D_3rdparty_qhull_r", "libOpen3D_3rdparty_qhullcpp", "libOpen3D_3rdparty_rply", "libOpen3D", "png", "pybind", "TBB", ]), ], dependencies: [ .package(url: "https://github.com/kewlbear/NumPy-iOS.git", .branch("main")), .package(url: "https://github.com/kewlbear/LAPACKE-iOS.git", .branch("main")), .package(url: "https://github.com/kewlbear/BLAS-LAPACK-AppStore-Workaround.git", .branch("main")), ], targets: [ .binaryTarget(name: "Assimp", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/Assimp.xcframework.zip", checksum: "6904cc87d6001158a44caffb854e32b30e29adb606f46472d5f8ce00b9721a24"), .binaryTarget(name: "Faiss", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/Faiss.xcframework.zip", checksum: "1d223aee5b8c550f67e937da850e9a612fbfd358b2b9573b1c9e377f29e59a72"), .binaryTarget(name: "IrrXML", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/IrrXML.xcframework.zip", checksum: "fd60a0ad4f9330f7a6c9553621e0ba4cba1d678a89bbb2b5bfce730f8b39235b"), .binaryTarget(name: "JPEG", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/JPEG.xcframework.zip", checksum: "1a9cd104c1600703a52d6917a7c2213417f6c456ccef06688580b9f6b8bd4503"), .binaryTarget(name: "jsoncpp", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/jsoncpp.xcframework.zip", checksum: "350af41078a47080385fd60e5ecc2f33c2cb21a91557cb6b5233f38b306f50a4"), .binaryTarget(name: "libOpen3D_3rdparty_liblzf", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/libOpen3D_3rdparty_liblzf.a.xcframework.zip", checksum: "a652bd2ab0c76623bb27268acbd0832326031cb2acc71eda4bc0e36849f64e84"), .binaryTarget(name: "libOpen3D_3rdparty_qhull_r", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/libOpen3D_3rdparty_qhull_r.a.xcframework.zip", checksum: "55c0f90841fa15c7aa6e3de24e719936af7ea09bfe314eb3a1e44b97e0b49a76"), .binaryTarget(name: "libOpen3D_3rdparty_qhullcpp", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/libOpen3D_3rdparty_qhullcpp.a.xcframework.zip", checksum: "a5f2cd5c510dc92920aba4d23e7ee771c43e6f1187930707bccaeeac00e76a57"), .binaryTarget(name: "libOpen3D_3rdparty_rply", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/libOpen3D_3rdparty_rply.a.xcframework.zip", checksum: "9245503d7f4968faa706edce41da5cff5dd2330227234815d7b3855723e189e1"), .binaryTarget(name: "libOpen3D", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/libOpen3D.a.xcframework.zip", checksum: "84915b1c787bc97f52b8cc39f51c9452a39ca6c5b83677cf422fd9e876e0794d"), .binaryTarget(name: "png", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/png.xcframework.zip", checksum: "0fd051316b200e5663d6d92e2efb24d0c012b417119733be9a498559cae173ea"), .binaryTarget(name: "pybind", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/pybind.a.xcframework.zip", checksum: "56ca201fd48af360cdaed7ba860dd6c668a8eb56ad7d5b297b816c0a30b29f5c"), .binaryTarget(name: "TBB", url: "https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20220804014308/TBB.xcframework.zip", checksum: "9c5d9a4aa45ca15cec514a36faf10709a44af8e780441bf9c6d82a0fd0c64e60"), .target( name: "LinkOpen3D", dependencies: [ "NumPy-iOS", "LAPACKE-iOS", "Assimp", "Faiss", "IrrXML", "JPEG", "jsoncpp", "libOpen3D_3rdparty_liblzf", "libOpen3D_3rdparty_qhull_r", "libOpen3D_3rdparty_qhullcpp", "libOpen3D_3rdparty_rply", "libOpen3D", "png", "pybind", "TBB", "BLAS-LAPACK-AppStore-Workaround", ], linkerSettings: [ .linkedLibrary("stdc++"), ] ), .target( name: "Open3DSupport", resources: [.copy("site-packages")]), .testTarget( name: "Open3D-iOSTests", dependencies: ["Open3DSupport"]), ] )

knsjoon commented 1 year ago

@raphaelmaguet
Thank you for the answer. I have one more problem of how to change "package.swift" file. Do you simply clone this github repo and then change the package.swift with yours using text editor? I wonder as my error persists that saying "error project: downloaded archive of binary target 'libOpen3D_3rdparty_liblzf.a' does not contain expected binary artifact named 'libOpen3D_3rdparty_liblzf.a'"

HeoJinLareine commented 1 year ago

Still not working.. Does anyone know how to fix this?

bigdata-li commented 1 year ago

In XCode 14.1 I downloaded/imported the Open3D-iOS package locally and removed .a from those package names. But now I'm getting the following errors. It seems that they are python related "site-packages". Everything works fine in XCode 13.4 though. Any idea?

/Users/xxx/work/temp/Open3D-iOS/Sources/Open3DSupport/site-packages Couldn't load project at: /Users/xxx/work/temp/Open3D-iOS/Sources/Open3DSupport/site-packages

/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/SourcePackages/checkouts/Python-iOS/Sources/PythonSupport/lib Couldn't load project at: /Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/SourcePackages/checkouts/Python-iOS/Sources/PythonSupport/lib

/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/SourcePackages/checkouts/NumPy-iOS/Sources/NumPySupport/site-packages Couldn't load project at: /Users/xxxx/Library/Developer/Xcode/DerivedData/xxxx/SourcePackages/checkouts/NumPy-iOS/Sources/NumPySupport/site-packages

mainakbiswas commented 1 year ago

Same issue in Xcode 14.1.

mainakbiswas commented 1 year ago

The PR #39 works for me.

bigdata-li commented 1 year ago

It seems that 0.0.20221129003814 has missing assets files:

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_qhull_r.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_qhull_r.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_liblzf.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_liblzf.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_qhullcpp.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_qhullcpp.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_rply.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_rply.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D.a.xcframework.zip' which is required by binary target 'libOpen3D.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/pybind.a.xcframework.zip' which is required by binary target 'pybind.a': badResponseStatusCode(404)

naccib commented 1 year ago

It seems that 0.0.20221129003814 has missing assets files:

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_qhull_r.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_qhull_r.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_liblzf.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_liblzf.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_qhullcpp.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_qhullcpp.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D_3rdparty_rply.a.xcframework.zip' which is required by binary target 'libOpen3D_3rdparty_rply.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/libOpen3D.a.xcframework.zip' which is required by binary target 'libOpen3D.a': badResponseStatusCode(404)

failed downloading 'https://github.com/kewlbear/Open3D-iOS/releases/download/0.0.20221129003814/pybind.a.xcframework.zip' which is required by binary target 'pybind.a': badResponseStatusCode(404)

The last release has not included five 3rd party dependencies' binaries required, which are present in the other builds. Maybe a CI issue?

naccib commented 1 year ago

A current workaround is to clone the project locally, checkout to commit 7695829c1f2fe5cd353148cab1df9997d7246c28 and remove the .as manually as @raphaelmaguet instructed. Then, add the package as a local package from Xcode.

After that Xcode wouldn't resolve the package, so I had to run xcodebuild -resolvePackageDependencies from the project directory to force Xcode to resolve the dependencies and then resulting library from Xcode.

charliegarrison commented 1 year ago

I forked and made the changes @raphaelmaguet suggested, so until fixed you can import package from my fork: https://github.com/charliegarrison/Open3D-iOS.git

Weixuanf commented 1 year ago

I forked and made the changes @raphaelmaguet suggested, so until fixed you can import package from my fork: https://github.com/charliegarrison/Open3D-iOS.git

OMG you saved my life! @charliegarrison I have struggled so much with this issue. Thank you for making this fork version!!

willgittoes commented 1 year ago

@charliegarrison and @Weixuanf how did you get yours working? I can build just fine using that repo or by pinning the older commit, but no matter what I do I always get the error No module named 'open3d.cpu.pybind' (like this person: https://github.com/kewlbear/Open3D-iOS/issues/27 )

The example project works fine, so I have no idea what I'm doing wrong. I'm definitely calling

        PythonSupport.initialize()
        Open3DSupport.sitePackagesURL.insertPythonPath()

And importing numpy works fine.

zwopi commented 1 year ago

@willgittoes I have had the same problem - in general there seems to be a problem with the dependency packages:

When running the example from Charlie the correct package dependencies are present in the Packages.resolved in Open3D-iOS/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Packages.resolved

I managed to get it running by copying/adding the content of the resolved packages from Charlies Example to the Packages.resolved of my own project and it worked properly.

One part seems to be the open3d.cpu.pybind .so file which is present for python 3.8 - and the Python-iOS seems to be on 3.9 already. Python-iOs on branch 3.8_kivy-iOS is still on 3.8 so it is working with that package...

Another Option might be: use SPM with commit b7155b2c4dbb80e7cb079ca05c659e7a17b1eb1e of this repo - this has worked at least in some of my projects.

willgittoes commented 1 year ago

Thanks so much @zwopi ! I ended up just using via C++ and Objective C++ bridge as per the instructions here: https://github.com/kewlbear/Open3D-iOS/issues/15

boeboe26 commented 1 year ago

@charliegarrison I added your package from https://github.com/charliegarrison/Open3D-iOS.git

But I still got the error 'No module named 'open3d.cpu.pybind' because it is using Python 3.10 instead of 3.8

How can I force it to use the Python iOS branch with Python 3.8? This one here: https://github.com/kewlbear/Python-iOS/tree/3.8_kivy-ios

If I add it as package, I obtain errors like "Package Resolution Failed"...

seymoursy commented 12 months ago

@boeboe26 bo i have the same issue ,Did u fix this problem ? when i add 3.8_kivy_ios(Python ios),the system will show bug like : image

boeboe26 commented 12 months ago

I made it work, it was a though nut to crack 😜 Here's the Package.swift file with the dependencies that worked for me (remove the .txt extension which was necessary to upload the file). Package.swift.txt

thomas-graphopti commented 1 month ago

I forked and made the changes @raphaelmaguet suggested, so until fixed you can import package from my fork: https://github.com/charliegarrison/Open3D-iOS.git

Thanks, mate

KevinDallian commented 2 weeks ago

@boeboe26 How do you make it work? Do you simply edit Package.swift into the new ones? I downgraded the python-ios to 3.8_kivy_ios and edit the package.swift to match yours and it didn't worked, xcode still complains the undefined symbol from seymoursy