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

Open3D-based c++ app: builds OK, will not run [Xcode macOS arm64] #6923

Closed
3 tasks done
cwreynolds opened this issue Aug 21, 2024 · 4 comments
Closed
3 tasks done

Open3D-based c++ app: builds OK, will not run [Xcode macOS arm64] #6923

cwreynolds opened this issue Aug 21, 2024 · 4 comments
Labels

Comments

@cwreynolds
Copy link

cwreynolds commented Aug 21, 2024

Checklist

My Question

Is anyone building c++ code using Open3D in Xcode on macOS arm64?

I assume my problem is specific to that case. The last time I tried something like this (in March #6707) it seemed to compile, but not build. Now I can compile and build but not run. Trying to run my “command line tool” in Terminal immediately exits with:

dyld[33475]: Symbol not found: __ZN6open3d13visualization10DrawObjectC1ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_10shared_ptrINS_8geometry10Geometry3DEEEb
  Referenced from: <D0791C45-014E-319D-9607-2847DF817C7E> /Users/cwr/Library/Developer/Xcode/DerivedData/evoflock-eacsekmubaosavbwjxzajyivtlgh/Build/Products/Release/evoflock
  Expected in:     <no uuid> unknown
zsh: abort      evoflock 

I am using Xcode’s Link Binary With Libraries to bundle libOpen3D.dylib (from open3d-devel-darwin-arm64-0.18.0+c219d82.tar.xz from https://github.com/isl-org/Open3D/releases/tag/main-devel) with my binary. The test code is from https://github.com/isl-org/Open3D/blob/main/examples/cpp/Draw.cpp

I have no experience using Open3D from c++, only a bit using it with Python. A few potential issues:

  • Using Xcode instead of Cmake.
  • My M1 MacBook is macOS 13.5.2 where 14.6.1 is current
  • This might have something to do with macOS’s codesign (code-sign, not as I always read it, co-design). But I think I have things set to compile for use only on my local machine, and so to not worry about code signing.

If anyone is familiar with these symptoms, I could use some hints.

@cwreynolds
Copy link
Author

I made a little progress investigating this. Or rather I dug in to my first bullet point issue: “Using Xcode instead of Cmake.” I hoped that if I used cmake, it might “just work.”

I was able to make a CMakeLists.txt for my project. I used it to build my code, which after tweaking some compile settings, ran at about the same speed as the version I had been building in Xcode.

Then I tried to link the Open3D main-devel code I’d downloaded, via the new CMakeLists.txt. Then changed an #ifdef to enable the Draw.cpp test.

When I tried to run it, I hit macOS code-signing violations (for Open3D and (I think) “tbb”?) which I manually overrode, see below.

But when I was finally able to run my app, it exited with:

libc++abi: terminating due to uncaught exception of type std::runtime_error: [Open3D Error] (std::string (anonymous namespace)::FindResourcePath(int, const char **)) /Users/runner/work/Open3D/Open3D/cpp/open3d/visualization/gui/Application.cpp:96: Could not find resource directory.

zsh: abort      ./evoflock

Screenshot 2024-08-22 at 5 02 03 PM image

As before any thoughts/hint would be appreciated.

@cwreynolds
Copy link
Author

After the two failures above — trying to link my app to Open3D using Xcode, and then using CMake — I wondered if I might have better luck building my own version of Open3D from latest sources. (To avoid any mysterious incompatibilities by building, linking, and running on the same machine.) When I tried to do that, I ran into an apparently unrelated problem (something to do with pybind?) as described in:

“compact unwind compressed function offset doesn't fit in 24 bits” during build from source [macOS, ARM64] #6931

@cwreynolds
Copy link
Author

Just a note that @rxba suggests in #6931 that these issues may well be related to “bullet point 2” above: that I am a full macOS version behind. So my next step is to update the OS, fix whatever that breaks, then return to this issue.

@cwreynolds
Copy link
Author

I remain curious about how to do the original goal “Is anyone building c++ code using Open3D in Xcode on macOS arm64?”

But as a practical matter, @rxba's suggestions — upgrade to macOS Sonoma and follow the open3d-cmake-find-package example — have allowed me to work around this issue.

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

No branches or pull requests

1 participant