Re: 0.98.1 not compiling on OS/X Mavericks

Mark Allan <[email protected]>
Newsgroups gmane.comp.security.virus.clamav.devel
Message-ID <[email protected]>
>>>>> 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.

Another workaround is to compile with support for older versions of OS X.  I routinely compile with support for OSX 10.6+ and was confused when I saw the original email as I compiled under 10.9.2 and Xcode 5.1 a couple of days ago without any issue.

Here's what I use to configure the build:

CFLAGS="-O2 -g -D_FILE_OFFSET_BITS=64 -mmacosx-version-min=10.6 -arch x86_64" CXXFLAGS="-O2 -g -D_FILE_OFFSET_BITS=64 -mmacosx-version-min=10.6  -arch x86_64" ./configure --disable-dependency-tracking  --enable-llvm --enable-clamdtop --with-user=_clamav --with-group=_clamav --enable-all-jit-targets

If I get rid of mmacosx-version flag, the build fails.  If I set it to any valid value (e.g. 10.8), it works.

Mark

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
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.