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

Solutions for Problems Building on Mac OS X #525

Closed
TomHeaven opened this issue Nov 15, 2018 · 6 comments
Closed

Solutions for Problems Building on Mac OS X #525

TomHeaven opened this issue Nov 15, 2018 · 6 comments

Comments

@TomHeaven
Copy link

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
  • Modify the project's CMakeList.txt to support C++11 and OpenMP. Add those lines under the Project line.
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 ")

  • Detection of C++11 always fails on Mac. Let's just discard it by comment out those two lines in src\CMakeList.txt
#if(NOT CXX11_COMPILER)
# message(FATAL_ERROR "The compiler does not support the CXX11 standard.")
  • Detection of OpenMP always fails on Mac. Let's just comment out the detection logic in src\CMakeList.txt
 #if(OPENMP_FOUND)
    set(ALICEVISION_HAVE_OPENMP 1)
    message(STATUS "OpenMP found.")
  #elseif(ALICEVISION_USE_OPENMP STREQUAL "ON")
  # set(ALICEVISION_HAVE_OPENMP 0)
  # message(SEND_ERROR "Failed to find OpenMP.")
  #else()
  # set(ALICEVISION_HAVE_OPENMP 0)
  #endif()
  • There is another OpenMP detection in src/dependencies/flann/CMakeList.txt, just add those two lines at the top:
set(OpenMP_C_FLAGS " -Xpreprocessor -fopenmp -lomp -lgomp ")
set(OpenMP_CXX_FLAGS " -Xpreprocessor -fopenmp -lomp -lgomp ")

and comment out this line

message(WARNING "OpenMP NOT found")
#set(USE_OPENMP OFF)
  • Update source file src/aliceVision/robustEstimation/randSampling.hpp
//std::vector<IntT> result(std::make_move_iterator(samples.begin()),
    // std::make_move_iterator(samples.end()));
      std::vector<IntT> result(samples.begin(),
                               samples.end());
  • Update source src/aliceVision/sfmDataIO/AlembicExporter.cpp line 255 as
const sfmData::LandmarksUncertainty noUncertainty = HashMap<IndexT, Vec3>();

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 
  • If you are using python 2.7, add those three lines at top of meshroom/__init__.py to avoid unicode error:
import sys
reload(sys)
sys.setdefaultencoding('utf8')

At last, start meshroom

python meshroom/ui
@FunWithFlaggs
Copy link

FunWithFlaggs commented Feb 14, 2019

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
Copy link
Member

natowi commented Feb 15, 2019

Reference MR#204

@FunWithFlaggs
Copy link

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
Copy link
Member

natowi commented Feb 15, 2019

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

@ot6nyu
Copy link

ot6nyu commented Mar 29, 2019

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
Copy link

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.

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

No branches or pull requests

4 participants