Re: 0.98.1 not compiling on OS/X Mavericks

Remi Mommsen <[email protected]>
Newsgroups gmane.comp.security.virus.clamav.devel
Message-ID <[email protected]>
Hi Dave,

On 18 Mar 2014, at 22:49, David Raynor <[email protected]> wrote:

> On Tue, Mar 18, 2014 at 10:36 AM, David Raynor <[email protected]>wrote:
> 
>> 
>> On Tue, Mar 18, 2014 at 4:39 AM, Remi Mommsen <[email protected]>wrote:
>> 
>>> Hi,
>>> 
>>> On 18 Mar 2014, at 07:12, Brian Reiter <[email protected]> wrote:
>>> 
>>>> 
>>>> On Mar 18, 2014, at 6:05 AM, Zack <[email protected]> wrote:
>>>> 
>>>>> It used to compile on OSX just fine as recently as a month ago.
>>>> 
>>>> I haven't built from source manually in a while but it does 0.98.1 did
>>> build for me using MacPorts on Mavericks back in January. That was XCode 5
>>> but not 5.1. MacPorts builds with CFLAGS -O0.
>>> 
>>> I can confirm that the update from xcode 5 to 5.1 broke the compilation
>>> on Mac OS X.
>>> 
>>> Remi
>>> _______________________________________________
>>> http://lurker.clamav.net/list/clamav-devel.html
>>> Please submit your patches to our Bugzilla: http://bugs.clamav.net
>>> 
>> 
>> Thanks for the research on this problem. I added this to our Bugzilla as
>> bug # 10757 so we can track it.
>> 
>> Dave R.
>> 
>> --
>> ---
>> Dave Raynor
>> Vulnerability Research Team
>> 
> 
> This error is reported from upstream LLVM code. The LLVM team has made
> bigger changes to this header since this file was included in ClamAV, so I
> cannot simply apply changes from them or the patch impact increases beyond
> this file.
> 
> The root problem is the handling of the iterators and templates in this one
> spot. In short, clang is checking something earlier than gcc, even though
> the type should be available in the end.
> 
> Please try this candidate patch to the LoopInfo.h header.
> 
> --- a/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h
> +++ b/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h
> @@ -814,8 +814,12 @@ public:
>         typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits;
> 
>         // Add all of the predecessors of X to the end of the work stack...
> -        TodoStack.insert(TodoStack.end(), InvBlockTraits::child_begin(X),
> -                         InvBlockTraits::child_end(X));
> +        for (typename InvBlockTraits::ChildIteratorType PI =
> +              InvBlockTraits::child_begin(X), PE =
> InvBlockTraits::child_end(X);
> +              PI != PE; ++PI) {
> +          typename InvBlockTraits::NodeType *N = *PI;
> +          TodoStack.push_back(N);
> +        }
>       }
>     }
> 
> Dealing with a larger LLVM upgrade is a task for a future release, but this
> should let you move forward under Xcode 5.1 in the near term.
> 
> Let us know how it goes,
> 
> Dave R.

This workaround fixes the issue on Mac OS X 10.9.2 with Xcode 5.1.

BTW: I poked a bit around in the LLVM code to understand why their iterator is not copy assignable or constructible. This is the root cause that the enable_if disables the range insert. However, I failed to figure it out.

Remi

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
smime.p7s (application/pkcs7-signature, 2.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.