[cgma-dev] Missing include on Mavericks (+patch)

David Thompson david.thompson at kitware.com
Mon Jan 20 12:22:41 CST 2014


Hi all,

I've found a fix for the Mavericks compile issue. The new Apple libc++ uses a specialization for std::vector<bool> that prevents DLIList<bool> from re-using the std::vector<X>::const_reference typedef blindly. The following fixes things for me:

--- a/util/DLIList.hpp
+++ b/util/DLIList.hpp
@@ -40,7 +40,7 @@ public:
   friend class DLIListIterator<X>;
 
   typedef typename std::vector<X>::reference reference;
-  typedef typename std::vector<X>::const_reference const_reference;
+  typedef const typename std::vector<X>::value_type& const_reference;
   typedef typename std::vector<X>::pointer pointer;
   typedef typename std::vector<X>::const_pointer const_pointer;
   

and should work for other platforms.

	David


On Dec 10, 2013, at 1:21 PM, David Thompson <david.thompson at kitware.com> wrote:

> Hi Rajeev,
> 
>> I’m getting similar error on Mavericks. 
>> Did you find a solution?
> 
> Not yet. My workaround is to use svn version 6078 with the patch at the start of this thread.
> 
> 	David
> 
> 
> 
>>> From: David Thompson <david.thompson at kitware.com>
>>> Subject: Re: [cgma-dev] Missing include on Mavericks (+patch)
>>> Date: December 2, 2013 at 6:31:03 PM CST
>>> To: Jane Hu <janejhu at gmail.com>
>>> Cc: CGMA Development <cgma-dev at mcs.anl.gov>
>>> 
>>> Hi Jane,
>>> 
>>>> Current trunk is only buildable with occ, there's a bug which prevent cubit build on cgm14.0 and I am working on it.
>>> 
>>> I am using OCC, so that's not the problem.
>>> 
>>>> ... Please let us know when you figured out the cause.
>>> 
>>> OK.
>>> 
>>> 	Thanks,
>>> 	David
>>> 
>>>> On Mon, Dec 2, 2013 at 3:08 PM, David Thompson <david.thompson at kitware.com> wrote:
>>>> Hi Jane,
>>>> 
>>>>> It's just been done. Happy coding!
>>>> 
>>>> Thanks! However, when I updated to catch this fix, I ran into another issue:
>>>> 
>>>> libtool: compile:  clang++ -I. -I/Users/dcthomp/Source/cgm/geom -I.. -I../geom/parallel -I../itaps -I/Users/dcthomp/Source/cgm/util -I. -g -Wall -mmacosx-version-min=10.9 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -arch x86_64 -Wall -pipe -pedantic -MT CubitAttribManager.lo -MD -MP -MF .deps/CubitAttribManager.Tpo -c /Users/dcthomp/Source/cgm/geom/CubitAttribManager.cpp  -fno-common -DPIC -o .libs/CubitAttribManager.o
>>>> /Users/dcthomp/Source/cgm/geom/CubitAttribManager.cpp:108:28: error: no viable conversion from 'CubitBoolean' (aka 'bool') to
>>>>     'const_reference' (aka '__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool> > >')
>>>> mAutoActuateFlags.append(auto_actuate_flag);
>>>>                          ^~~~~~~~~~~~~~~~~
>>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__bit_reference:124:7: note:
>>>>     candidate constructor (the implicit copy constructor) not viable: no known conversion from 'CubitBoolean' (aka 'bool') to
>>>>     'const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool> > > &' for 1st argument
>>>> class __bit_const_reference
>>>>     ^
>>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__bit_reference:140:5: note:
>>>>     candidate constructor not viable: no known conversion from 'CubitBoolean' (aka 'bool') to 'const
>>>>     __bit_reference<std::__1::vector<bool, std::__1::allocator<bool> > > &' for 1st argument
>>>>   __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
>>>>   ^
>>>> /Users/dcthomp/Source/cgm/util/DLIList.hpp:448:31: note: passing argument to parameter 'new_item' here
>>>> void append(const_reference new_item);
>>>>                             ^
>>>> 
>>>> I haven't been able to figure out the source of this problem. Both Apple's new C++ library and the old GNU one specialize vector<bool>, so that does not appear to be the cause. If it helps, I had not updated since before you moved the cubit-14 branch to the trunk.
>>>> 
>>>>       David
>>>> 
>>>> 
>>>>> On Mon, Dec 2, 2013 at 12:43 PM, David Thompson <david.thompson at kitware.com> wrote:
>>>>> Hi all,
>>>>> 
>>>>> When I try building on OS X Mavericks using the latest Xcode, I get an error that pid_t is not defined in util/CubitProcess.h. It appears that <unistd.h> must be included for this type to be defined. A patch is below. Could someone apply it or help me revise it so I can build without patching CGM?
>>>>> 
>>>>>       Thanks,
>>>>>       David
>>>>> 
>>>>> --- a/util/CubitProcess.hpp
>>>>> +++ b/util/CubitProcess.hpp
>>>>> @@ -20,6 +20,7 @@
>>>>> #include <windows.h>
>>>>> typedef PROCESS_INFORMATION PidType;
>>>>> #else
>>>>> +#  include <unistd.h>
>>>>> typedef pid_t PidType;
>>>>> #endif
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Jane Hu
>>>>> 
>>>>> Asst. Researcher
>>>>> Dept. of Engineering Physics
>>>>> UW @ Madison
>>>>> 
>>>>> "And we know that for those who love God, that is, for those who are called according to his purpose, all things are working together for good." (Romans 8:28)
>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Jane Hu
>>>> 
>>>> Asst. Researcher
>>>> Dept. of Engineering Physics
>>>> UW @ Madison
>>>> 
>>>> "And we know that for those who love God, that is, for those who are called according to his purpose, all things are working together for good." (Romans 8:28)



More information about the cgma-dev mailing list