bkloppenborg / liboi

OpenCL Interferometry Library
https://github.com/bkloppenborg/liboi/wiki
GNU Lesser General Public License v3.0
5 stars 6 forks source link

liboi will not compile with Xcode 4.5 #34

Closed bkloppenborg closed 11 years ago

bkloppenborg commented 11 years ago

Report from Fabien. liboi will not compile using Xcode 4.5 on Mac OS 10.7. The version of clang that is shipped with Xcode does not appear to support the full c++11 features required for liboi.

$ clang -v      
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

Compiling with clang --std=c++11 and --stdlib=libc++ gives:

[  5%] Building CXX object lib/ccoifits/src/CMakeFiles/ccoifits_static.dir/COI_ARRAY.cpp.o
In file included from /Users/fbaron/fb/liboi/lib/ccoifits/src/COI_ARRAY.cpp:8:
In file included from /Users/fbaron/fb/liboi/lib/ccoifits/src/COI_ARRAY.h:11:
/Users/fbaron/fb/liboi/lib/ccoifits/src/COI_TABLE.h:16:10: fatal error: 'array' file not found
#include <array>
         ^
1 error generated.
make[2]:  [lib/ccoifits/src/CMakeFiles/ccoifits_static.dir/COI_ARRAY.cpp.o] Error 1
make[1]:  [lib/ccoifits/src/CMakeFiles/ccoifits_static.dir/all] Error 2
make: *** [all] Error 2

Compiling with clang --std=c++11 and --stdlib=libc++ gives:

[  1%] Building CXX object lib/gtest-1.6.0/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /Users/fbaron/fb/liboi/lib/gtest-1.6.0/src/gtest-all.cc:39:
In file included from /Users/fbaron/fb/liboi/lib/gtest-1.6.0/include/gtest/gtest.h:57:
In file included from /Users/fbaron/fb/liboi/lib/gtest-1.6.0/include/gtest/internal/gtest-internal.h:40:
/Users/fbaron/fb/liboi/lib/gtest-1.6.0/include/gtest/internal/gtest-port.h:499:13: fatal error: 'tr1/tuple' file not found
#   include <tr1/tuple>  // NOLINT
            ^
1 error generated.
make[2]:  [lib/gtest-1.6.0/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]:  [lib/gtest-1.6.0/CMakeFiles/gtest.dir/all] Error 2
make: *** [all] Error 2
bkloppenborg commented 11 years ago

This is a problem with the compiler rather than with liboi. We'll attempt to find a workaround.

bkloppenborg commented 11 years ago

The issue causing this is related to the development status of clang. Clang 3.1x variants do not appear to have full support for the C++11 features liboi uses. The solution for now is to use the features we need from libboost rather than C++11. Once llvm-clang 3.2 is released and Apple clang / Xcode are updated, the workaround I discuss below will no longer be required.

Workaround (implemented in 18614ed8fa86d6f042c0b6e040c4c2693147c6f0): Conditionally compile and link with libboost_threads and libboost_system to get access to boost::thread, boost:mutex, boost::shared_ptr.

I have verified that the code compiles and executes correctly (via. unit tests) with llvm-clang 3.0, and boost 1.5.

bkloppenborg commented 11 years ago

Until Clang on Apple is updated to the latest development branch, the workaround is to use GCC 4.7x installed through macports. Documentation in the readme has been updated (thanks, Fabien!).