isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
10.83k stars 2.24k forks source link

Unable to link Open3D 0.18.0 to existing c++ project in Xcode [macOS arm64] #6707

Open cwreynolds opened 3 months ago

cwreynolds commented 3 months ago

Checklist

My Question

I am trying to add Open3D 0.18.0 graphics to an existing c++ project in macOS Xcode, on an arm64 machine.

I used the binary https://github.com/isl-org/Open3D/releases/download/v0.18.0/open3d-app-macosx-12_0-arm64-0.18.0.zip from https://github.com/isl-org/Open3D/releases

I temporarily replaced my main.cpp with the contents of https://github.com/isl-org/Open3D/blob/main/examples/cpp/Draw.cpp

I worked through some header issues and am now failing at build/link phase. I dragged all .a libraries from [...]open3d-devel-darwin-arm64-0.18.0/lib into the Xcode project's [target / build phases / Link Binary With Libraries].

The build fails with many undefined symbols (eg below). Should this have worked? Any suggestion on how to fix it?

ld: Undefined symbols:
  _CFArrayAppendValue, referenced from:
      __glfwInitJoysticksNS in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      __glfwInitJoysticksNS in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      __glfwInitJoysticksNS in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      _matchCallback in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
  _CFArrayCreateMutable, referenced from:
      __glfwInitJoysticksNS in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      _matchCallback in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      _matchCallback in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)
      _matchCallback in libOpen3D_3rdparty_glfw.a[9](cocoa_joystick.m.o)

[...]

  _omp_get_thread_num, referenced from:
      _.omp_outlined. in libOpen3D.a[136](SurfaceReconstructionPoisson.cpp.o)
      _.omp_outlined..275 in libOpen3D.a[136](SurfaceReconstructionPoisson.cpp.o)
      Eigen::internal::general_matrix_matrix_product<long, double, 0, false, double, 0, false, 0, 1>::run(long, long, long, double const*, long, double const*, long, double*, long, long, double, Eigen::internal::level3_blocking<double, double>&, Eigen::internal::GemmParallelInfo<long>*) in libOpen3D.a[150](RaycastingScene.cpp.o)
      _.omp_outlined. in libOpen3D.a[241](TransformationEstimation.cpp.o)
      Eigen::internal::general_matrix_matrix_product<long, double, 1, false, double, 0, false, 0, 1>::run(long, long, long, double const*, long, double const*, long, double*, long, long, double, Eigen::internal::level3_blocking<double, double>&, Eigen::internal::GemmParallelInfo<long>*) in libOpen3D.a[241](TransformationEstimation.cpp.o)
      _.omp_outlined..3 in libOpen3D.a[241](TransformationEstimation.cpp.o)
      _.omp_outlined..4 in libOpen3D.a[241](TransformationEstimation.cpp.o)
      ...
  _omp_in_parallel, referenced from:
      open3d::utility::InParallel() in libOpen3D.a[271](Parallel.cpp.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
cwreynolds commented 3 months ago

Oh, I belatedly noticed the prebuilt is called open3d-app-macosx-12_0-arm64-0.18.0.zip but I am running on macOS Ventura 13.5.2.

Is that the underlying issue? I've seen ongoing discussions about “CI runners” for arm64 being a problem.

ssheorey commented 3 months ago

PR #6695 should fix this (and other ARM macOS related issues).

cwreynolds commented 3 months ago

Thanks @ssheorey — that is great to hear. Us folks in the overlap of Apple Silicon and Open3D greatly appreciate it.

If you happen to have an opinion: I'm trying to decide how I should proceed in the short term. Is building from source a way to get around this issue, or would the filament problem exist there too? I'd prefer to avoid building from source.

ssheorey commented 3 months ago

Filament is built from source for Apple ARM64. You can try building from source by following the PR #6695