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

Mac OS compilation issue... #444

Closed
patniemeyer opened this issue Jul 15, 2018 · 61 comments
Closed

Mac OS compilation issue... #444

patniemeyer opened this issue Jul 15, 2018 · 61 comments

Comments

@patniemeyer
Copy link

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

What compiler version are you using?

@patniemeyer
Copy link
Author

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

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

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

@patniemeyer
Copy link
Author

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

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

patniemeyer commented Jul 16, 2018

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

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

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

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

flyandi commented Jul 17, 2018

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

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

flyandi commented Jul 17, 2018

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

flyandi commented Jul 17, 2018

@simogasp yes that worked as well.

However now the uncertaintyTE is not found :-D

@simogasp
Copy link
Member

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

@flyandi
Copy link

flyandi commented Jul 17, 2018

Nvm. it failed on geogram now.

Installing it via:

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

@simogasp
Copy link
Member

what is the problem?

@flyandi
Copy link

flyandi commented Jul 17, 2018

It's not installed or available on my system.

@simogasp
Copy link
Member

simogasp commented Jul 17, 2018

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

flyandi commented Jul 17, 2018

Ok let me try this.

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

@flyandi
Copy link

flyandi commented Jul 17, 2018

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

did libpng build correctly? If you

make png

does it build?

@flyandi
Copy link

flyandi commented Jul 17, 2018

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

@fabiencastan
Copy link
Member

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

@simogasp
Copy link
Member

simogasp commented Jul 17, 2018

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

flyandi commented Jul 17, 2018

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

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

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

but it puzzles me why it does not work

@flyandi
Copy link

flyandi commented Jul 17, 2018

I am running it again right now.

@flyandi
Copy link

flyandi commented Jul 18, 2018

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

flyandi commented Jul 18, 2018

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

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

@flyandi
Copy link

flyandi commented Jul 18, 2018

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

flyandi commented Jul 18, 2018

However it fails now at MeshDenoiser

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

@simogasp
Copy link
Member

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

@fabiencastan
Copy link
Member

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

But openmp is enabled in your configuration:

** Enable OpenMP parallelization: 1

@fabiencastan
Copy link
Member

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

@simogasp
Copy link
Member

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

flyandi commented Jul 19, 2018

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

flyandi commented Jul 19, 2018

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

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

@flyandi
Copy link

flyandi commented Jul 20, 2018

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

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

@fabiencastan
Copy link
Member

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

@flyandi
Copy link

flyandi commented Jul 20, 2018

So I been trying to use XCODE 9.2.0 which contains the 9.0.0 LLVM and still no luck. Now half of the math.c library is missing .. argh! So how did you guys actually got it compiled under High Sierra? (10.13)?

@flyandi
Copy link

flyandi commented Jul 20, 2018

Btw this is the problem now:

Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath(324): error: the global scope has no "isunordered"

  • another 30 like these with different methods. Looking at cmath.h it seems everything is there:

image

@flyandi
Copy link

flyandi commented Jul 20, 2018

Here is the full log: https://pastebin.com/X32KhQYQ

@fabiencastan
Copy link
Member

That's strange. Maybe related to a problem with the cuda runtime installation.
Similar error message here: https://cmake.org/pipermail/cmake/2010-March/036105.html

How did you install cuda on this machine?
Did you already compiled something using cuda on it?

@dlazares
Copy link

dlazares commented Aug 5, 2018

@flyandi what lines did you change to get rid of the OpenMP error? I'm stuck at that point right now

@flyandi
Copy link

flyandi commented Aug 7, 2018

I did not - I installed OpenMP from source.

@ryanfb
Copy link
Contributor

ryanfb commented Aug 17, 2018

Thanks partially to the advice and help in this thread, I've just finished writing up a blog post and associated Homebrew tap for installing AliceVision on Mac OS X.

@NextDesign1
Copy link

I was able to compile without any issues using clang 6.0.0 (which includes OpenMP support) and all dependent libraries through macports. The only trick is that you have to be careful to tell CMake to use that compiler instead of the default AppleClang compiler by setting CMAKE_CXX_COMPILER and CMAKE_C_COMPILER to /opt/local/bin/clang++ and /opt/local/bin/clang, respectively.

@fabiencastan
Copy link
Member

So build is now possible thanks to @ryanfb.
Next step is to provide binaries: alicevision/Meshroom#204

@FunWithFlaggs
Copy link

which nvcc's are supported? i finally got ~80% through the build but it failed with:
nvcc fatal : The version ('10.0') of the host compiler ('Apple clang') is not supported

@simogasp
Copy link
Member

simogasp commented Dec 10, 2018

it depends on your cuda version. For example the latest cuda 10 (https://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html) supports apple LLVM 9.0.0, which corresponds to the one shipped with XCode 9.0-9.2 (see here https://gist.github.com/yamaya/2924292)

If your xcode version is too newer the only thing to do i'm afraid is to downgrade xcode installing an older version.

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

8 participants