alicevision / AliceVision

Photogrammetric Computer Vision Framework
http://alicevision.org
Other
2.95k stars 820 forks source link

Solutions for Problems Building on Mac OS X #525

Closed TomHeaven closed 4 years ago

TomHeaven commented 5 years ago

I've managed to compile and test AliceVision and Meshroom on Mac OS. I write down those tricks and hope this will help improve the project.

I use Mac OS 10.12.6, XCode 8.0 and CUDA 9.0 and I've alreadly installed Homebrew, Nvidia webdriver as well as CUDA driver.

AliceVision

Install dependencies

brew install libomp
brew link --overwrite libomp
brew install openimageio
brew install ceres-solver
brew install geogram
# Alembic
git clone https://github.com/alembic/alembic
cd alembic; mkdir build; cd build
cmake ../ -DUSE_PYTHON=ON
make -j4
make install

Clone source

git clone --recursive https://github.com/alicevision/AliceVision
git checkout v2.0.0
include_directories("/usr/local/opt/libomp/include")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11  ")
set(OpenMP_C_FLAGS " -Xpreprocessor -fopenmp -lomp -lgomp ")
set(OpenMP_CXX_FLAGS " -Xpreprocessor -fopenmp -lomp -lgomp ")

Start normal compilation

mkdir build
cd build
cmake ..
make -j4
make install

Meshroom

Compilation of Meshroom is much simpler:

git clone --recursive git://github.com/alicevision/meshroom
cd meshroom
pip install -r requirements.txt
pip install cx_Freeze
sudo python setup.py install 
FunWithFlaggs commented 5 years ago

Thanks for the info! However i guess im still having OpenMP problems.. i get the following half way through the build:

[ 40%] Linking CXX shared library ../../../Darwin-x86_64/libaliceVision_image.dylib Undefined symbols for architecture x86_64: "___kmpc_dispatch_init_4", referenced from: _.omp_outlined. in convolution.cpp.o _.omp_outlined..1 in convolution.cpp.o _.omp_outlined..2 in convolution.cpp.o "___kmpc_dispatch_next_4", referenced from: _.omp_outlined. in convolution.cpp.o _.omp_outlined..1 in convolution.cpp.o _.omp_outlined..2 in convolution.cpp.o "___kmpc_fork_call", referenced from: aliceVision::image::SeparableConvolution2d(Eigen::Matrix<float, -1, -1, 1, -1, -1> const&, Eigen::Matrix<float, 1, -1, 1, 1, -1> const&, Eigen::Matrix<float, 1, -1, 1, 1, -1> const&, Eigen::Matrix<float, -1, -1, 1, -1, -1>*) in convolution.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [Darwin-x86_64/libaliceVision_image.2.0.dylib] Error 1 make[1]: *** [src/aliceVision/image/CMakeFiles/aliceVision_image.dir/all] Error 2

configured with: cmake .. -DOPENIMAGEIO_INCLUDE_DIR=/usr/local/opt/openimageio/include -DOPENIMAGEIO_LIBRARY=/usr/local/opt/openimageio/lib/libOpenImageIO.dylib

Im on 10.13.6 using clang 9.1.0 (downgraded), XCode 10.1 and CUDA 10.

natowi commented 5 years ago

Reference MR#204

FunWithFlaggs commented 5 years ago

i know, i provided my compiled version there. I also got those installed and running on a fresh osx installation with a bit of tweaking. But its without OpenMP support so i tried to recompile it and this is what i got.

natowi commented 5 years ago

@FunWithFlaggs This was not intended as an reply to your post. Just wanted to reference both issues for other users.

ot6nyu commented 5 years ago

This got me through cmake, but not make:

[ 42%] Building CXX object src/dependencies/osi_clp/CoinUtils/src/CMakeFiles/lib_CoinUtils.dir/CoinWarmStartBasis.cpp.o In file included from /Volumes/SD512A/AliceVision/src/aliceVision/image/io.cpp:9: In file included from /Volumes/SD512A/AliceVision/src/aliceVision/image/all.hpp:21: In file included from /Volumes/SD512A/AliceVision/src/aliceVision/image/diffusion.hpp:11: /Volumes/SD512A/AliceVision/src/aliceVision/alicevision_omp.hpp:11:5: error: invalid token at start of a preprocessor expression

if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENMP)

^

/Volumes/SD512A/AliceVision/build/src/generated/aliceVision/config.hpp:4:39: note: expanded from macro 'ALICEVISION_IS_DEFINED'

define ALICEVISION_IS_DEFINED(F) F() == 1

                                  ^

[ 42%] Building CXX object src/dependencies/MeshSDFilter/CMakeFiles/OpenMesh.dir/external/OpenMesh/Tools/Smoother/LaplaceSmootherT.cc.o 1 error generated. make[2]: [src/aliceVision/image/CMakeFiles/aliceVision_image.dir/io.cpp.o] Error 1 make[1]: [src/aliceVision/image/CMakeFiles/aliceVision_image.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

osx 10.12.6, xcode 9.2 Apple LLVM version 9.0.0 (clang-900.0.39.2) Cuda compilation tools, release 9.1, V9.1.128

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.