Openmvg: fatal error: 'type_traits' file not found on Mac OS X 10.8.5 / Xcode 5.1.1

Created on 1 Jun 2015  Â·  34Comments  Â·  Source: openMVG/openMVG

About a year ago I managed to build openMVG on this same machine without problems, don't know what has changed …

Before I bang my head trying to figure out the problem I thought I'd ask here first if this is a known issue or my personal problem...

Most helpful comment

For the future reference: that's how I managed to fix this problem:

export CPLUS_INCLUDE_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/"

All 34 comments

Make sure you use libc++, not libstdc++, and switch on C++11 support: "-stdlib=libc++ -std=c++11"

Thanks, where do I specify that?

C++11 support is tested here: https://github.com/openMVG/openMVG/blob/master/src/CMakeLists.txt#L66

And as you see appropriate CX11 flags are set automatically.
https://github.com/openMVG/openMVG/blob/master/src/cmakeFindModules/CXX11.cmake#L20

Can you check that C++11 is well enabled and supported by your compiler.

When I do:

cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Xcode" . ../openMVG/src/

I get:

-- Detected CPU: ivy-bridge
-- Checking for C++11 compiler
-- Checking for C++11 compiler - available

don't know if it is related but just noticed that the cmake generation ends with:

-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
CMake Warning at third_party/flann/CMakeLists.txt:75 (message):
  OpenMP NOT found


abort: repository /Users/nyholku/openMVG/openMVG/src not found!
abort: repository /Users/nyholku/openMVG/openMVG/src not found!
-- 
-- Configured Eigen 3.2.4
-- 
-- Could NOT find Sphinx (missing:  SPHINX_EXECUTABLE) 
Sphinx need to be installed to generate the documentation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nyholku/openMVG/build


Yes, the Apple Clang compiler does not support OpenMP. You have two choices: gcc (homebrew, macports) or Clang-OpenMP (see http://clang-omp.github.io/). Both variants are not that simple, unfortunately.
About the issue with libc++/libstdc++: Apple delivers both C++ libraries. libc++ is more up to date than libstdc++, so openMVG can only be compiled with libc++ since it uses features of C++11.

According to some answers on StackExchange, libc++ is default starting from OS X 10.9. On my MacBook, openMVG 0.8.1 compiles fine out of the box (Xcode version 6.2, Apple Clang 6.0). If you are using an older version, I suggest to add a compiler switch in CMakeFiles.txt like this:
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11" )

In order to check from scratch what is happening.
Could you empty your build directory and redo the cmake command line?
And share the result thanks to a https://gist.github.com/ ?

BTW, C++11 seems to be set in the right way.
Not having openMVG must not be problem for compilation, it will only make OpenMVG use only one core...

Here you go, full scratch build:

https://gist.github.com/nyholku/414926f4a50355f5d7da

Thanks,
I did not see something strange in the cmake log.
Except the following log message.

abort: repository /Users/nyholku/openMVG/src not found!
abort: repository /Users/nyholku/openMVG/src not found!

As mention @rhiestan adding -stdlib=libc++ must help:
See here: http://stackoverflow.com/questions/9345271/xcode-4-3-and-c11-include-paths

Yeah, I noticed that ('abort… not found!) and it is strange because:

ls /Users/nyholku/openMVG/src
CMakeLists.txt      nonFree         software
cmakeFindModules    openMVG         testing
dependencies        openMVG_Samples     third_party

Anyway, I will try the:

" I suggest to add a compiler switch in CMakeFiles.txt like this:
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11" )"

but now I have to stop for today, I'll be back tomorrow.

And many thanks for support!

Changing line 26 in CXX11.cmake to:

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

fixed the issue but now link phase fails with:

https://gist.github.com/nyholku/0630d9b2a81b400711a5

I believe -stdlib=libc++ also needs to be on the linker command.
Add this line to CMakeLists.txt:

SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

Strange.

I add that and now cmake fails with:

-- Using minimal glog substitute (include): internal/ceres/miniglog
-- Building without OpenMP (disabling multithreading).
-- Found unordered_map/set in std namespace.
CMake Error at third_party/ceres-solver/CMakeLists.txt:503 (MESSAGE):
  Unable to find shared_ptr.
-- Configuring incomplete, errors occurred!

I thought this might have something to do with that I had booted to my Yosemite partition while I was waiting for your response and tried to compile openMVG there (which failed in a totally different way). Back in Mountain Lion I scrapped all and did everything from scratch:

 git clone --recursive https://github.com/openMVG/openMVG.git
 mkdir openMVG_Build
 cd openMVG_Build
 cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Xcode" . ../openMVG/src/

and then added the lines:

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

but now it fails with the above error.

BTW

On Yosemite with Xcode 6.4 openMVG cmake generation fails for me fast with:

cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Xcode" . ../openMVG/src/
-- The C compiler identification is AppleClang 6.1.0.6020049
-- The CXX compiler identification is AppleClang 6.1.0.6020049
CMake Error at CMakeLists.txt:10 (PROJECT):
  No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.)



Yes, very strange.
Maybe it helps adding the same lines to third_party/ceres-solver/CMakeLists.txt, but it should use the flags from the parent script.
On Yosemite: Don't know what this problem causes. Did you install the Xcode command line tools? The newest version of CMake?

On Yosemite/Xcode 6 the Preferences/Downloads did not show Command Line Tools so I could not install them (like it does with Xcode 5) but the typing 'cc' or 'clang' on Terminal shows the clang version, don't know if this is proof enough that they are installed or not. Forgot to check the cmake version but that was fresh from homebrew so I expect pretty reset. But all that is a side issue, I'm not ready to move to Yosemite for various reasons so I want to make this work on Mountain Lion.

I will now try to add the lines to ceres-solver.

cmake generation now works (again!) but compilation fails (in eight files) with:

Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, void (^__strong)(NSString *__strong))
Thread:   <NSThread: 0x7fe3b7a1b6a0>{name = (null), num = 16}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
In file included from /Users/nyholku/openMVG/src/third_party/ceres-solver/internal/ceres/array_utils.cc:31:
In file included from /Users/nyholku/openMVG/src/third_party/ceres-solver/internal/ceres/array_utils.h:46:
/Users/nyholku/openMVG/src/third_party/ceres-solver/include/ceres/internal/port.h:42:10: fatal error: 'tr1/memory' file not found
#include <tr1/memory>
         ^
1 error generated.

For some reason the ceres CMakeLists.txt finds the memory include file under tr1. You need to find out why and solve this problem. Maybe it will help turning on the trace log of cmake with --trace.
Sorry, can't help you more than this.

It seems that something strange appears here:
https://github.com/openMVG/openMVG/blob/master/src/third_party/ceres-solver/CMakeLists.txt#L493

At the first cmake generation normally ceres must display which shared_ptr mechanism it will be able to use on the computer.
Does a line like the following has appeared?
Found shared_ptr in std namespace using header.
Found shared_ptr in std::tr1 namespace using header.
Found shared_ptr in std::tr1 namespace using header.

It's possible that CHECK_INCLUDE_FILE_CXX (called from FindSharedPtr.cmake) doesn't use -stdlib=libc++. Please try adding
SET(CMAKE_REQUIRED_FLAGS " -stdlib=libc++ ") to third_party/ceres-solver/CMakeLists.txt

This is the generation output showing where the shared_ptr is/was found. I will now try the:

SET(CMAKE_REQUIRED_FLAGS " -stdlib=libc++ ") to third_party/ceres-solver/CMakeLists.txt

nyholkus-MacBook-Pro:openMVG_Build nyholku$ cmake -DCMAKE_BUILD_TYPE=RELEASE -G "Xcode" . ../openMVG/src/
-- Detected CPU: ivy-bridge
-- Checking for C++11 compiler
-- Checking for C++11 compiler - available
-- Try OpenMP C flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
-- Did not find MOSEK header
-- Did not find MOSEK library
-- Could not find mosek library on this machine.
-- Eigen 3.2.4 found (include: /Users/nyholku/openMVG/src/third_party/eigen)
CERES NOT FOUND
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- 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) 
-- Eigen 3.2.4 found (include: /Users/nyholku/openMVG/src/third_party/eigen)
-- Found Eigen version 3.2.4: /Users/nyholku/openMVG/src/third_party/eigen

   ===============================================================
   Disabling the use of Eigen as a sparse linear algebra library.
   This does not affect the covariance estimation algorithm 
   which can still use the EIGEN_SPARSE_QR algorithm.
   ===============================================================

-- A library with BLAS API found.
-- Found LAPACK library: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Accelerate.framework;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Accelerate.framework
-- Found BLAS library: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Accelerate.framework
-- Building without SuiteSparse.
-- Google Flags disabled; no tests or tools will be built!
-- Compiling minimal glog substitute into Ceres.
-- Using minimal glog substitute (include): internal/ceres/miniglog
-- Building without OpenMP (disabling multithreading).
-- Found tr1/unordered_map/set in std::tr1 namespace.
-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.
-- Building Ceres as a static library.
CMake Warning at third_party/ceres-solver/CMakeLists.txt:704 (MESSAGE):
  KUSTIN PATCH


-- Enabling CERES_NO_SUITESPARSE in Ceres config.h
-- Enabling CERES_NO_THREADS in Ceres config.h
-- Enabling CERES_TR1_UNORDERED_MAP in Ceres config.h
-- Enabling CERES_TR1_MEMORY_HEADER in Ceres config.h
-- Enabling CERES_TR1_SHARED_PTR in Ceres config.h
-- Do not build any example.
-- Try OpenMP C flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
CMake Warning at third_party/flann/CMakeLists.txt:75 (message):
  OpenMP NOT found


abort: repository /Users/nyholku/openMVG/src not found!
abort: repository /Users/nyholku/openMVG/src not found!
-- 
-- Configured Eigen 3.2.4
-- 
-- Could NOT find Sphinx (missing:  SPHINX_EXECUTABLE) 
Sphinx need to be installed to generate the documentation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nyholku/openMVG_Build
nyholkus-MacBook-Pro:openMVG_Build nyholku$ 
SET(CMAKE_REQUIRED_FLAGS " -stdlib=libc++ ") to third_party/ceres-solver/CMakeLists.txt

made no difference, still eight files fail to compile with, I guess I need to dive deeper into the cmake file to understand what is going on. Sigh.

/Users/nyholku/openMVG/src/third_party/ceres-solver/include/ceres/internal/port.h:42:10: fatal error: 'tr1/memory' file not found
#include <tr1/memory>

What is this:
CMake Warning at third_party/ceres-solver/CMakeLists.txt:704 (MESSAGE):
KUSTIN PATCH

Can you please run
clang --version
clang -dumpversion

The comment in CMakeLists.txt says:

Xcode 4.5.x used Clang 4.1 (Apple version), this has a bug that prevents

compilation of Ceres.

My Clang says to -dumpversion:
4.2.1

And this is the newest, Xcode 6.2.

nyholkus-MacBook-Pro:openMVG_Build nyholku$ clang --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
nyholkus-MacBook-Pro:openMVG_Build nyholku$ clang -dumpversion
4.2.1

And that '(KUSTIN PATCH)' is just message I added to the CMakeLists.txt to verify that I changes I made are included, ie I added these lines

     MESSAGE(WARNING "KUSTIN PATCH")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
     set(CMAKE_REQUIRED_FLAGS "-stdlib=libc++ ")

Not making much progress.

I once again started from scratch.

Out of the box openMVG/cmake generation gives:

fatal error: 'type_traits' file not found on Mac OS X 10.8.5 / Xcode 5.1.1

adding to top level CMakeLists.txt

      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

cures that but next the cmake generation fails with:

-- Looking for C++ include memory
-- Looking for C++ include memory - found
-- Performing Test HAVE_SHARED_PTR_IN_STD_NAMESPACE
-- Performing Test HAVE_SHARED_PTR_IN_STD_NAMESPACE - Failed
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE - Failed
-- Looking for C++ include tr1/memory
-- Looking for C++ include tr1/memory - not found
CMake Error at third_party/ceres-solver/CMakeLists.txt:503 (MESSAGE):
  Unable to find shared_ptr.

which is kind of strange because compiling from the command line the same c++ sample code that FindSharedPointer.cmake uses for testing compiles fine with -stdlib=libc++ -std=c++11 defined and fails otherwise.

So it looks like the advice to add "-stdlib=libc++ -std=c++11" is correct but for some reason those switches are not applied when FindSharedPointer.cmake runs … maybe I'm putting them in the wrong place or something?

Can someone point to me exact correct place for these switches?

As i wrote, it should be CMAKE_REQUIRED_FLAGS in ceres-solver/CMakeLists.txt.

You can try to find the error logs in your cmake build directory under third_party/ceres-solver/CMakeFiles. The files in there should explain the problem.

@pmoulon
Thanks, I put them there but change, error persists.

@rhiestan
Thanks, I also tried adding CMAKE_REQUIRED_FLAGS so I now have:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_REQUIRED_FLAGS "-stdlib=libc++ ")

at

https://github.com/openMVG/openMVG/blob/master/src/third_party/ceres-solver/CMakeLists.txt#L492

I looked at 'openMVG_build/third_party/ceres-solver/CMakeFiles' but that is empty.

The error log

/Users/nyholku/openMVG_Build/CMakeFiles/CMakeError.log

I put here:

https://gist.github.com/nyholku/bfd7f65569c9fe5c18d3

This is the error:
The following build commands failed:
Ld Debug/cmTryCompileExec3913748335 normal x86_64
(1 failure)
pes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.8 -Wno-sign-conversion -I/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/DerivedSources/x86_64 -I/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/Debug -march=core-avx-i -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mno-sse4a -mno-xop -mno-fma4 --stdlib=libc++ --std=c++11 -stdlib=libc++ -std=c++11 -DHAVE_SHARED_PTR_IN_STD_NAMESPACE -stdlib=libc++ -g -MMD -MT dependencies -MF /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/Objects-normal/x86_64/src.d --serialize-diagnostics /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/Objects-normal/x86_64/src.dia -c /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/src.cxx -o /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/Objects-normal/x86_64/src.o

Ld Debug/cmTryCompileExec3913748335 normal x86_64
cd /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp
export MACOSX_DEPLOYMENT_TARGET=10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/Debug -F/Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/Debug -filelist /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/Objects-normal/x86_64/cmTryCompileExec3913748335.LinkFileList -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Xlinker -dependency_info -Xlinker /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec3913748335.build/Objects-normal/x86_64/cmTryCompileExec3913748335_dependency_info.dat -o /Users/nyholku/openMVG_Build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec3913748335
Undefined symbols for architecture x86_64:
"std::__1::__shared_weak_count::__release_shared()", referenced from:
std::__1::shared_ptr::~shared_ptr() in src.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Source file was:

include

                           int main() {
                             std::shared_ptr<int> int_ptr;
                             return 0;
                           }

Performing C++ SOURCE FILE Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE failed with the following output:

Apparently the CHECK_INCLUDE_FILE_CXX script does not use -stdlib=libc++ during linking. That's why it says it didn't find "memory", although the actual error is a linking error, not the missing include file.

So basically the problem is in cmake somewhere in:

/usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/CheckIncludeFileCXX.cmake

ok, I'll dig in. Thanks.

Could not figure that out, so I gave up (open for suggestions though).

Hate that beast called 'the C-tool chain'! What a can of worms it is ... almost every cross platform C-project I ever touch turns into a multi day dependency hell in one form or another.

So went back to Yosemite and fixed the compiler issue I mentioned with 'xcode-select -switch...' and now openMVG compiles without a hitch out of the box.

Great, thanks!

Now I only need to figure out all the other problems that prevent me from moving to Yosemite...

Can I close the Issue?

Sure, I'll do it for you , and thanks for the support!

For the future reference: that's how I managed to fix this problem:

export CPLUS_INCLUDE_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/"

My 2cts: I noticed: -mmacosx-version-min=10.8 in the command line. I get the same error specifying anything under 10.9. -mmacosx-version-min=10.9 works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roby23 picture roby23  Â·  3Comments

jpwhitney picture jpwhitney  Â·  7Comments

MaXL130 picture MaXL130  Â·  7Comments

autosquid picture autosquid  Â·  4Comments

yuyou picture yuyou  Â·  6Comments