[cfe-users] compile error

Jean-Daniel Dupas devlists at shadowlab.org
Tue Jul 16 05:35:20 PDT 2013


Hi,

I also encounter this issue and I think your fix will not work.

While it fixes compilation, it introduce a latent bug as now the structure definition in asan no longer match the one readdir expects.

When  compiling for 10.6 and later, OS X implicitly replace call to readdir (and other functions) by readdir$INODE64 call which properly handle the 64bit structure, but call to readdir will always use the old structure.

So if using 64 bit version of the dirent struct, ASAN should interpose readdir$INODE64 and not readdir symbol.


Le 16 juil. 2013 à 13:58, Alexey Samsonov <samsonov at google.com> a écrit :

> Hi Emmanuel!
> 
> I found out what the problem was: we defined dirent structure for Mac OS X 10.5, and in your case the runtime was compiled with -mmacosx-version-min=10.7.
> This problem should be fixed by r186404.
> 
> 
> On Sat, Jul 13, 2013 at 10:25 PM, Emmanuel Thivierge <monamimani at gmail.com> wrote:
> Hi,
> 
> Thanks a lot for your help.
> 
> My version of osX is 10.8.4
> And the define __DARWIN_64_BIT_INO_T is define to 1.
> 
> I hope this help.
> 
> The reason I am compiling Address sanitizer is that I might need it is i run into problems while developing.
> 
> Thanks again
> 
> Emmanuel
> 
> On 2013-07-12, at 9:05 AM, Alexey Samsonov <samsonov at google.com> wrote:
> 
>> Hi!
>> 
>> On Fri, Jul 12, 2013 at 4:34 AM, Mani <monamimani at gmail.com> wrote:
>> Hi all,
>> 
>> i have been compiling clang for months without problems, until about last week. Since then I can't compile.
>> 
>> usually delete CMakeCache.txt then run
>> cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_C_COMPILER=/usr/local/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_SHARED_LINKER_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_WERROR=OFF -DLLVM_BUILD_TOOLS=ON -DLLVM_BUILD_EXAMPLES=OFF -DCLANG_BUILD_EXAMPLES=OFF -DLLVM_APPEND_VC_REV=ON /Users/Mani/Development/Projects/llvm/source
>> ln -s $PWD/compile_commands.json /Users/Mani/Development/Projects/llvm/source
>> 
>> and then run
>> make -j10 ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1
>> 
>> Here is what i get.
>> 
>> [ 15%] [ 16%] Built target clang_rt.x86_64
>> Built target clang_rt.i386
>> [ 16%] /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:799:1: error: 'assertion_failed__799'
>>       declared as an array with a negative size
>> CHECK_SIZE_AND_OFFSET(dirent, d_ino);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:726:3: note: expanded from macro
>>       'CHECK_SIZE_AND_OFFSET'
>>   COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
>>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:239:30: note: expanded from macro 'COMPILER_CHECK'
>> #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
>>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:245:57: note: expanded from macro
>>       'IMPL_COMPILER_ASSERT'
>>     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
>>                                                         ^~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:803:1: error: 'assertion_failed__803'
>>       declared as an array with a negative size
>> CHECK_SIZE_AND_OFFSET(dirent, d_reclen);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:728:3: note: expanded from macro
>>       'CHECK_SIZE_AND_OFFSET'
>>   COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==          \
>>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:239:30: note: expanded from macro 'COMPILER_CHECK'
>> #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
>>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /Users/Mani/Development/Projects/llvm/source/projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:245:57: note: expanded from macro
>>       'IMPL_COMPILER_ASSERT'
>>     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
>>                                                         ^~~~~~~~~~~~~~~
>> 2 errors generated.
>> Built target RTLSanCommon.osx
>> make[2]: *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cc.o] Error 1
>> make[1]: *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/all] Error 2
>> make[1]: *** Waiting for unfinished jobs….
>> 
>> Anybody know what going on?
>> 
>> You've got a problem with compiling AddressSanitizer runtime: it incorrectly defines "dirent" structure (normally it comes from /usr/include/sys/dirent.h).
>> 1) Which OS X version do you use?
>> 2) What is the value of __DARWIN_64_BIT_INO_T on your system? (you may check it by including sys/cdefs.h and looking at the value of this definition).
>>  
>> Note that if you're not interested in ASan, you may just build clang as follows:
>> "make -j10 ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1 clang"
>> 
>> 
>> Thanks
>> Emmanuel
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>> 
>> 
>> 
>> -- 
>> Alexey Samsonov, MSK
> 
> 
> 
> 
> -- 
> Alexey Samsonov, MSK
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users

-- Jean-Daniel




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130716/ac6c4584/attachment.html>


More information about the cfe-users mailing list