alicevision / AliceVision

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

Mac OS compilation issue... #444

Closed patniemeyer closed 6 years ago

patniemeyer commented 6 years ago

Attempting to build on Mac OS 10.13 I get:

CMake Error at src/CMakeLists.txt:186 (message): The compiler does not support the CXX11 standard.

fabiencastan commented 6 years ago

What compiler version are you using?

patniemeyer commented 6 years ago

I have XCode 9.4 installed. clang and gcc report the following: Apple LLVM version 9.1.0 (clang-902.0.39.2) (Do I need XCode 9.4.1?)

Unrelated question: will AliceVision / Meshroom be useful on a Mac that does not have an NVidia card?

thanks.

fabiencastan commented 6 years ago

CUDA is required for depth map computation. So without CUDA you will be able to compute the sparse reconstruction from structure from motion (point cloud and cameras stored in Alembic file format) but you will not be able to create a dense mesh.

@simogasp Do you know the compiler versions required for C++11 on macos?

simogasp commented 6 years ago

@patniemeyer can u please post the log of the messages, including the command line you use to do cmake?

patniemeyer commented 6 years ago

Sure - I'm just following the build instructions for Mac in INSTALL.md.

`pat@desk:~/Desktop/alicevision/build $ cmake -DCMAKE_BUILD_TYPE=Release -G "Xcode" ../AliceVision


-- ALICEVISION_BUILD_DEPENDENCIES: OFF -- ALICEVISION_BUILD_TESTS: OFF -- AV_BUILD_JPEG: ON -- AV_BUILD_PNG: ON -- CMAKE_BUILD_TYPE: Release -- DEPS_CMAKE_BUILD_TYPE: Release -- CMAKE_INSTALL_PREFIX: /usr/local -- CMAKE_INSTALL_RPATH: @loader_path/../lib:@loader_path


CMake version: 3.11 -- ALICEVISION_BUILD_DOC: 'AUTO' -- ALICEVISION_USE_OPENMP: 'ON' -- ALICEVISION_USE_CCTAG: 'AUTO' -- ALICEVISION_USE_POPSIFT: 'AUTO' -- ALICEVISION_USE_OPENGV: 'AUTO' -- ALICEVISION_USE_ALEMBIC: 'AUTO' -- ALICEVISION_USE_UNCERTAINTYTE: 'AUTO' -- ALICEVISION_USE_CUDA: 'ON' -- ** ALICEVISION_USE_OPENCV: 'OFF' -- Detected Host CPU: skylake-avx512 -- Checking for C++11 compiler -- Checking for C++11 compiler - unavailable CMake Error at src/CMakeLists.txt:186 (message): The compiler does not support the CXX11 standard.

-- Configuring incomplete, errors occurred! See also "/Users/pat/Desktop/alicevision/build/CMakeFiles/CMakeOutput.log". pat@desk:~/Desktop/alicevision/build $ clang --version Apple LLVM version 9.1.0 (clang-902.0.39.2) Target: x86_64-apple-darwin17.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin `

simogasp commented 6 years ago

can you start from scratch, ie remove the build directory and redo the whole thing. There are some missing lines at the beginning, probably because you already launched once. The very first 2 lines should read something like

-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042

(but with your version of Apple clang) Also, can you check the ouptut ofcc --version, c++ --version,gcc --version, g++ --version

patniemeyer commented 6 years ago

Sure, here is a clean attempt:

pat@desk:/Desktop/alicevision/build  $ cmake -DCMAKE_BUILD_TYPE=Release -G "Xcode" ../AliceVision
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ----------------------------------------
-- ALICEVISION_BUILD_DEPENDENCIES: OFF
-- ALICEVISION_BUILD_TESTS: OFF
-- AV_BUILD_JPEG: ON
-- AV_BUILD_PNG: ON
-- CMAKE_BUILD_TYPE: Release
-- DEPS_CMAKE_BUILD_TYPE: Release
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_RPATH: @loader_path/../lib:@loader_path
-- ----------------------------------------
CMake version: 3.11
-- ** ALICEVISION_BUILD_DOC: 'AUTO'
-- ** ALICEVISION_USE_OPENMP: 'ON'
-- ** ALICEVISION_USE_CCTAG: 'AUTO'
-- ** ALICEVISION_USE_POPSIFT: 'AUTO'
-- ** ALICEVISION_USE_OPENGV: 'AUTO'
-- ** ALICEVISION_USE_ALEMBIC: 'AUTO'
-- ** ALICEVISION_USE_UNCERTAINTYTE: 'AUTO'
-- ** ALICEVISION_USE_CUDA: 'ON'
-- ** ALICEVISION_USE_OPENCV: 'OFF'
-- target changed from "" to "auto"
-- Detected Host CPU: skylake-avx512
-- Performing Test check_c_compiler_flag__march_skylake_avx512
... # I elided some tests check output here...
-- Performing Test check_cxx_compiler_flag__mno_avx512vbmi - Success
-- Checking for C++11 compiler
-- Checking for C++11 compiler - unavailable
CMake Error at src/CMakeLists.txt:186 (message):
  The compiler does not support the CXX11 standard.

-- Configuring incomplete, errors occurred!
See also "/Users/pat/Desktop/alicevision/build/CMakeFiles/CMakeOutput.log".

and here are the compiler versions:

Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
+ c++ --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
+ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
+ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
simogasp commented 6 years ago

That's really strange, I thought there was some kind of configuration error but it is not. It is one the latest version of apple clang and it must support c++11 even by default...

can you share the result of

grep -A55 -B4 c++11 CMakeFiles/CMakeOutput.log

(from your build directory)

simogasp commented 6 years ago

also in an unrelated issue, I don't think you'll be able to compile the cuda part (MVS), as CUDA 9.2 supports xcode 9.2 (https://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#system-requirements) and according to your clang version you have xcode 9.4 (https://gist.github.com/yamaya/2924292#file-xcode-clang-vers-L244). (and I assuming that you have cuda 9.2, otherwise it will be even worst :-( ). But maybe it will work, i don't know. Just be aware of this possible issue. The usual workaround is to install an older version of xcode supported by cuda.

patniemeyer commented 6 years ago

can you share the result of

The output is pretty lengthy so I have copied the cmake log here: http://pat.net/misc/CMakeOutput.log

flyandi commented 6 years ago

The default gcc on apple is outdated. In order to enable C++11 support you would need to install gcc manually via homebrew and enable explicit C++11 in the CMakeLists file.

brew install gcc

then modify the CMakeLists and add the following lines below the project line:

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

This will enable C++11 support.

simogasp commented 6 years ago

uhm it's stange because its gcc is a link to the apple compiler. Instead, I just realized that the check for c++11 is done twice. Can you try to comment out the section https://github.com/alicevision/AliceVision/blob/develop/src/CMakeLists.txt#L182 till line 189 and redo everything from scratch. @fabiencastan I think that section can be removed as https://github.com/alicevision/AliceVision/blob/develop/src/CMakeLists.txt#L31 should be more than enough to enforce C++11. (Why it fails, that's another interesting question...)

flyandi commented 6 years ago

Also on another note, you might still have compilation issues since certain libraries don't auto-resolve. You need to install the following libraries:

brew install eigen 
brew install ceres-solver

After that you need to install opengv:

git clone https://github.com/laurentkneip/opengv
cd opengv
mkdir build & cd build
cmake ../opengv 
make
make install

Wait until that is completed and then run the AliceVision build command.

flyandi commented 6 years ago

@simogasp yes that worked as well.

However now the uncertaintyTE is not found :-D

simogasp commented 6 years ago

cool! As for uncertaintyTE it's ok, it is not a mandatory dependency, you should be able to proceed and compile fine.

flyandi commented 6 years ago

Nvm. it failed on geogram now.

Installing it via:

http://alice.loria.fr/software/geogram/doc/html/geogram_compiling.html

simogasp commented 6 years ago

what is the problem?

flyandi commented 6 years ago

It's not installed or available on my system.

simogasp commented 6 years ago

ok BTW, you can install the dependencies wherever your want in ur system, you just then need to pass the proper -DDEPENDENCY_DIR:PATH=/path/to/install at cmake time. see https://github.com/alicevision/AliceVision/blob/develop/INSTALL.md#cmake-options

Or, this takes longer, you can build all the needed dependencies with alicevision with https://github.com/alicevision/AliceVision/blob/develop/INSTALL.md#building-the-project-with-embedded-dependencies

flyandi commented 6 years ago

Ok let me try this.

EDIT: It seems to be building however I had to install NASM brew install nasm.

flyandi commented 6 years ago

Well I am stuck again on

make[5]: *** No rule to make target `/code/repo/a/build/external/png_build/lib/libpng.so', needed by `src/libOpenImageIO/libOpenImageIO.1.8.11.dylib'.  Stop.
simogasp commented 6 years ago

did libpng build correctly? If you

make png

does it build?

flyandi commented 6 years ago

Yep but for some reason it does not create the libpng.so ..

fabiencastan commented 6 years ago

Maybe created in a different folder on macos, like lib64 instead of lib or something like that.

simogasp commented 6 years ago

because it's a OSX and it must create a libpng.dylib. Is it there in /code/repo/a/build/external/png_build/lib/? Otherwise try to remove the whole /code/repo/a/build/external/openimageio and start again

flyandi commented 6 years ago

Nope. this is really strange because I see where it finalizes the compilation but than does not write the libpng.so .. neither the dylib ..

simogasp commented 6 years ago

this is my (on OSX)

ls -1 external/png_build/lib
libpng.a
libpng.dylib
libpng.la
libpng16.16.dylib
libpng16.a
libpng16.dylib
libpng16.la
pkgconfig

did you install automake and libtool (brew install automake libtool) ? Otherwise retry again, removing the png build folder and restart. But it's really strange

simogasp commented 6 years ago

at worst you can install libpng with brew (brew install libpng) and skip the building by passing -DAV_BUILD_PNG:BOOL=OFF at cmake. That will build using the homebrew version of libpng.

simogasp commented 6 years ago

but it puzzles me why it does not work

flyandi commented 6 years ago

I am running it again right now.

flyandi commented 6 years ago

k .. i have the same result now:

libpng.a libpng.dylib libpng.la libpng16.16.dylib libpng16.a libpng16.dylib libpng16.la pkgconfig

However it complaints that it needs the .so ...

make[6]: *** No rule to make target /code/repo/a/build/external/png_build/lib/libpng.so', needed bysrc/libOpenImageIO/libOpenImageIO.1.8.11.dylib

fabiencastan commented 6 years ago

Yes, I have never tried the all-in-one build on macos...

On this line you have an hard-coded relative path to "libpng.so": https://github.com/alicevision/AliceVision/blob/develop/CMakeLists.txt#L214 You need to replace "libpng.so" by "libpng.dylib" if MACOS.

simogasp commented 6 years ago

Argggg! So basically everywhere in that file.. You need to replace all the .so in CMakeLists. But it's not the right thing to do, we need to fix this then

flyandi commented 6 years ago

Yeah I just noticed that as well :-D

I changed those and running it again.

flyandi commented 6 years ago

....and we have lift-off :-D let's see if it compiles through the end.

flyandi commented 6 years ago

So I got all the way to this:

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Could NOT find Ghostscript (missing: GHOSTSCRIPT_EXECUTABLE) -- Could NOT find GLPK (missing: GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND) (Required is at least version "4.33") -- Could NOT find ILOG (missing: ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR) -- Could NOT find COIN (missing: COIN_INCLUDE_DIR COIN_CBC_LIBRARY COIN_CBC_SOLVER_LIBRARY COIN_CGL_LIBRARY COIN_CLP_LIBRARY COIN_COIN_UTILS_LIBRARY COIN_OSI_LIBRARY COIN_OSI_CBC_LIBRARY COIN_OSI_CLP_LIBRARY) -- Could NOT find SOPLEX (missing: SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR) -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)

flyandi commented 6 years ago

Oh ok .. I see the error .. brewing cuda right now

https://stackoverflow.com/questions/38566367/installing-cuda-via-brew-and-dmg

flyandi commented 6 years ago

Good news: I got through the first step of configuring with the following result:

AliceVision version: 0.9.5 Build Shared libs: ON Build SfM part: ON Build MVS part: ON Build AliceVision tests: OFF Build AliceVision documentation: 0 Build AliceVision samples programs: OFF Build AliceVision+OpenCV samples programs: 0 Build UncertaintyTE: 0 Build MeshSDFilter: 1 Build Alembic exporter: 0 Enable code coverage generation: OFF Enable OpenMP parallelization: 1 Use CUDA: 1 Use OpenCV SIFT features: 0 Use CCTAG markers: 0 ** Use OpenGV for rig localization: 1

-- EIGEN: 3.3.4 -- CERES: 1.14.0 -- FLANN: 1.8.4 (internal) -- CLP: 1.15.11 (internal) -- COINUTILS: 2.9.3 (internal) -- OSI: 0.106.10 (internal) -- LEMON: 1.3 (internal)

-- Could NOT find ILOG (missing: ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR) -- Could NOT find COIN (missing: COIN_INCLUDE_DIR) -- Could NOT find SOPLEX (missing: SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR) -- Configuring done -- Generating done

flyandi commented 6 years ago

However it fails now at MeshDenoiser

clang: error: unsupported argument 'libomp' to option 'fopenmp='

simogasp commented 6 years ago

yes because the AppleClang does not support openmp. @fabiencastan Is openmp mandatory for MeshDenoiser?

fabiencastan commented 6 years ago

No. It is not supposed to add openmp flags if it is not detected: https://github.com/alicevision/MeshSDFilter/blob/b7dfeed64be90f2eff49345cf65451b700d3a417/CMakeLists.txt#L32

fabiencastan commented 6 years ago

But openmp is enabled in your configuration:

** Enable OpenMP parallelization: 1
fabiencastan commented 6 years ago

Is there no way to get openmp support on osx? The performance will suffer a lot by disabling openmp.

simogasp commented 6 years ago

it;'s not officially supported on AppleClang, there are some workarounds https://iscinumpy.gitlab.io/post/omp-on-high-sierra/

Otherwise, you need to install clang with homebrew as I do and use that one to build. On the other hand, that it is likely to fail building the cuda part as it is not supported on OSX. Depending on your version of CUDA, you may try to install clang 4 or 5 but it is not guaranteed.

flyandi commented 6 years ago

Well u won't believe it but I just got the line ** BUILD SUCCEEDED **

So what I did was disabling OpenMP (and actually removing the sections from the dependency CMake files) and also turning CUDA off.

flyandi commented 6 years ago

Ok so now that I have both meshroom and the library working, I am getting stuck on No valid initial pair found automatically ..

is there some sample image I can test the library + meshroom before I run my own images?

simogasp commented 6 years ago

You can try one of these datasets (maybe Fountain) https://github.com/alicevision/SfM_quality_evaluation

flyandi commented 6 years ago

Well - it went through till it had to calculate the depth map ..

aliceVision_depthMapEstimation: command not found

It looks like it was never compiled. I probably bet that is the one that needs CUDA, right?

simogasp commented 6 years ago

Yes, without cuda you cannot use the second part of the pipeline for dense reconstruction and meshing (MVS)

fabiencastan commented 6 years ago

Only the depthmap computation requires cuda but the other MVS steps rely on the depthmap output.