Open fmammoli opened 5 months ago
It seems like there is a problem on the homebrew version of pytorch. Can you directly download libtorch instead? like
cd OpenSplat
wget https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.2.1.zip
unzip libtorch-macos-arm64-2.2.1.zip
cd build
cmake -DCMAKE_PREFIX_PATH=../libtorch -DGPU_RUNTIME=MPS ..
Directly downloading libtorch actually works and the build is done successfully after make -j$(sysctl -n hw.logicalcpu)
.
But when running ./openSplat
now I get the error:
dyld[6669]: Library not loaded: @rpath/libomp.dylib
Referenced from: <DD14EDEC-57EB-38BD-98C1-58FACE69BBEC> /Users/fmammoli/Developer/pythonprojs/libtorch/lib/libtorch_cpu.dylib
Reason: tried: '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/Users/runner/work/_temp/anaconda/envs/wheel_py38/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/_temp/anaconda/envs/wheel_py38/lib/libomp.dylib' (no such file), '/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/pytorch/pytorch/pytorch/build/lib/libomp.dylib' (no such file), '/Users/fmammoli/Developer/pythonprojs/libtorch/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/fmammoli/Developer/pythonprojs/libtorch/lib/libomp.dylib' (no such file), '/opt/homebrew/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/libomp.dylib' (no such file), '/Users/fmammoli/Developer/pythonprojs/libtorch/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/fmammoli/Developer/pythonprojs/libtorch/lib/libomp.dylib' (no such file), '/opt/homebrew/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file, not in dyld cache)
zsh: abort ./opensplat
My libomp.dylib
indeed is in none of these paths, I found it on /opt/homebrew/Cellar/libomp/18.1.8/lib/libomp.dylib
Is there a way to add this path?
Maybe you can try this:
export DYLD_LIBRARY_PATH=$(brew --prefix libomp)/lib:$DYLD_LIBRARY_PATH
Exporting the path didn't solve the issue, but creating a symlink did between the brew --prefix libomp path/lib/libomp.dylib
and one of the suggested paths did.
I can now run the example datasets without error! Thanks!
Hi,
I am working on a MacOS with M3 Pro. I am trying to build OpenSplat for MacOS but keep hitting an error while running.
cmake -DCMAKE_PREFIX_PATH=/Users/fmammoli/Developer/pythonprojs/libtorch/share/cmake/Torch -DGPU_RUNTIME=MPS .. && make -j$(sysctl -n hw.logicalcpu)
I get the error:
` 11 warnings generated.
[ 13%] Built target gsplat_metal [ 18%] Linking CXX static library libgsplat.a [ 18%] Built target gsplat [ 22%] Linking CXX static library libgsplat_cpu.a [ 22%] Built target gsplat_cpu [ 31%] Building CXX object CMakeFiles/opensplat.dir/point_io.cpp.o [ 31%] Building CXX object CMakeFiles/opensplat.dir/spherical_harmonics.cpp.o [ 36%] Building CXX object CMakeFiles/opensplat.dir/nerfstudio.cpp.o [ 40%] Building CXX object CMakeFiles/opensplat.dir/utils.cpp.o [ 45%] Building CXX object CMakeFiles/opensplat.dir/project_gaussians.cpp.o [ 50%] Building CXX object CMakeFiles/opensplat.dir/kdtree_tensor.cpp.o [ 54%] Building CXX object CMakeFiles/opensplat.dir/model.cpp.o [ 59%] Building CXX object CMakeFiles/opensplat.dir/opensplat.cpp.o [ 63%] Building CXX object CMakeFiles/opensplat.dir/cv_utils.cpp.o [ 72%] Building CXX object CMakeFiles/opensplat.dir/rasterize_gaussians.cpp.o [ 72%] Building CXX object CMakeFiles/opensplat.dir/ssim.cpp.o [ 77%] Building CXX object CMakeFiles/opensplat.dir/optim_scheduler.cpp.o [ 81%] Building CXX object CMakeFiles/opensplat.dir/colmap.cpp.o [ 86%] Building CXX object CMakeFiles/opensplat.dir/opensfm.cpp.o [ 90%] Building CXX object CMakeFiles/opensplat.dir/input_data.cpp.o [ 95%] Building CXX object CMakeFiles/opensplat.dir/tensor_math.cpp.o [100%] Linking CXX executable opensplat Undefined symbols for architecture arm64: "c10::impl::cow::materialize_cow_storage(c10::StorageImpl&)", referenced from: void* c10::TensorImpl::data_impl<void, c10::TensorImpl::mutable_data()::'lambda'()>(c10::TensorImpl::mutable_data()::'lambda'() const&) const in model.cpp.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [opensplat] Error 1 make[1]: [CMakeFiles/opensplat.dir/all] Error 2 make: *** [all] Error 2 `
I also tried running with the Pytorch path installed via Mamba and got the same error. I managed to build by installing Pytorch via homebrew and using that path instead of libtorch path, but as I am new to python I am trying to keep my env under control the best I can.
What I am doing wrong?