[CppAD] Compilation issue on OSX

Dominique Orban dominique.orban at gmail.com
Sat Oct 12 10:17:43 EDT 2013


Thanks for the suggestion Norman. On OSX, gcc-4.7 gives a similar error:

--
[ 92%] Building CXX object test_more/CMakeFiles/test_more.dir/rev_sparse_hes.cpp.o
/tmp/cppad-20130927/test_more/rev_sparse_hes.cpp: In function 'bool {anonymous}::case_six()':
/tmp/cppad-20130927/test_more/rev_sparse_hes.cpp:496:53: error: no match for 'operator|=' in 'Check.std::vector<bool, _Alloc>::operator[]<std::allocator<bool> >(((i * n) + j)) |= (((int)F2.std::vector<bool, _Alloc>::operator[]<std::allocator<bool> >(((i * n) + k)).std::_Bit_reference::operator bool()) & ((int)r.std::vector<bool, _Alloc>::operator[]<std::allocator<bool> >(((k * n) + j)).std::_Bit_reference::operator bool()))'
--

Dominique


On 2013-10-11, at 5:07 PM, Norman Goldstein <normvcr at telus.net> wrote:

> Hi, Dominique.  I have a hunch, but cannot take it too far, as I do not
> have gcc 4.8, nor a sufficiently recent version of CPPAD to have
> "case_six" (mine stops at 5).  The fact that
> 
> std::vector<bool>::reference {aka std::_Bit_reference}
> 
> suggests that gcc 4.8 is space-optimizing vectors of bool to be bit arrays,
> and the operator |= has not been defined for bit arrays.
> I checked my gcc 4.7, and the allocator<> template does not seem to
> be overridden to be optimized for bool, so it looks like gcc 4.7 is not
> packing things in like it seems in gcc 4.8.
> 
> Perhaps, there is some header file that contains this operator,
> and it can be included manually, as a work-around.  Or, there may be
> a compiler flag to not pack vector<bool>.
> 
> Sorry.  Maybe some one else can confirm or go further with this.
> 
> 
> 
> On 10/11/2013 11:33 AM, Dominique Orban wrote:
>> I'm configuring CppAD 20130927 on OSX 10.8.4 (Xcode 4.6.3) with the following setup
>> 
>> CC=gcc-4.8 CXX=g++-4.8 cmake .. -Dcmake_install_prefix=/tmp/cppad_install -Dcppad_testvector=std
>> 
>> gcc-4.8 and g++-4.8 were installed via Homebrew.
>> 
>> The configure step goes smoothly but `make check` fails with the following message:
>> 
>> --
>> [ 93%] Building CXX object test_more/CMakeFiles/test_more.dir/rev_sparse_hes.cpp.o
>> /tmp/cppad-20130927/test_more/rev_sparse_hes.cpp: In function 'bool {anonymous}::case_six()':
>> /tmp/cppad-20130927/test_more/rev_sparse_hes.cpp:496:22: error: no match for 'operator|=' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'bool')
>>     Check[i * n + j] |= F2[i * n + k] & r[ k * n + j];
>>                      ^
>> /tmp/cppad-20130927/test_more/rev_sparse_hes.cpp:496:22: note: candidates are:
>> In file included from /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/ios:42:0,
>>                 from /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/ostream:38,
>>                 from /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/iostream:39,
>>                 from /tmp/cppad-20130927/cppad/error_handler.hpp:131,
>>                 from /tmp/cppad-20130927/cppad/base_require.hpp:146,
>>                 from /tmp/cppad-20130927/cppad/cppad.hpp:24,
>>                 from /tmp/cppad-20130927/test_more/rev_sparse_hes.cpp:14:
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:169:3: note: const std::_Ios_Iostate& std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)
>>   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
>>   ^
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:169:3: note:   no known conversion for argument 1 from 'std::vector<bool>::reference {aka std::_Bit_reference}' to 'std::_Ios_Iostate&'
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:131:3: note: const std::_Ios_Openmode& std::operator|=(std::_Ios_Openmode&, std::_Ios_Openmode)
>>   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
>>   ^
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:131:3: note:   no known conversion for argument 1 from 'std::vector<bool>::reference {aka std::_Bit_reference}' to 'std::_Ios_Openmode&'
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:91:3: note: const std::_Ios_Fmtflags& std::operator|=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)
>>   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
>>   ^
>> /usr/local/Cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/bits/ios_base.h:91:3: note:   no known conversion for argument 1 from 'std::vector<bool>::reference {aka std::_Bit_reference}' to 'std::_Ios_Fmtflags&'
>> make[3]: *** [test_more/CMakeFiles/test_more.dir/rev_sparse_hes.cpp.o] Error 1
>> make[2]: *** [test_more/CMakeFiles/test_more.dir/all] Error 2
>> make[1]: *** [CMakeFiles/check.dir/rule] Error 2
>> make: *** [check] Error 2
>> --
>> 
>> This error does not occur if I use either the boost, eigen of cppad test vector options. According to Brad Bell, the error does not occur on Linux with gcc-4.8. It might be OSX specific. My C++ is nonexistent, so I don't understand the error message.
>> 
>> Other things I've tried:
>> 
>> - change the version of gcc: all lead to the same error
>> - use clang / clang++ instead of gcc / g++: same error
>> - add CXXFLAGS='-std=c++11' or CXXFLAGS='-std=c++11 -stdlib=libc++': same error.
>> 
>> My goal is to submit a Homebrew [1] formula for CppAD to the Homebrew/Science tap [2]. My current formula is available from [3]. Any feedback would be greatly appreciated.
>> 
>> Thanks!
>> 
>> Dominique
>> 
>> 
>> [1] http://brew.sh
>> [2] https://github.com/Homebrew/homebrew-science
>> [3] https://gist.github.com/6938726
>> _______________________________________________
>> CppAD mailing list
>> CppAD at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/cppad
>> 
> 
> 
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cppad








More information about the CppAD mailing list