[LLVMdev] Compile-rt throw error undeclared identifier 'O_CLOEXEC'

Kostya Serebryany kcc at google.com
Wed Jun 6 04:12:56 PDT 2012


On Wed, Jun 6, 2012 at 3:01 PM, Chatsiri Ratana <insiderboy at gmail.com>wrote:

> On Wed, Jun 6, 2012 at 5:33 PM, Alexey Samsonov <samsonov at google.com>wrote:
>
>> Hi, Chatsiri!
>>
>>
>>> ---------- Forwarded message ----------
>>> From: Chatsiri Ratana <insiderboy at gmail.com>
>>> Date: Wed, Jun 6, 2012 at 2:15 PM
>>> Subject: [LLVMdev] Compile-rt throw error undeclared identifier
>>> 'O_CLOEXEC'
>>> To: llvmdev at cs.uiuc.edu
>>>
>>>
>>> Hello All,
>>>
>>>      I build LLVM source code version 3.2 from SVN repository. After I
>>> build source code of LLVM include "compiler-rt"(Compiler-rt at revision
>>> 158057.
>>> ) and "clang" are represent an error as below.
>>>
>>
>>
>>> make[5]: Entering directory
>>> `/san01/home/chatsiri/workspacecpp/llvm-svn/projects/compiler-rt'
>>>   COMPILE:   clang_linux/asan-x86_64/x86_64:
>>> /san01/home/chatsiri/workspacecpp/llvm-svn/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
>>> /san01/home/chatsiri/workspacecpp/llvm-svn/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:47:36:
>>> error: use of
>>>       undeclared identifier 'O_CLOEXEC'
>>>       write ? O_WRONLY | O_CREAT | O_CLOEXEC : O_RDONLY,
>>> 0660);                                   ^
>>> 1 error generated.
>>>
>>> Who have any idea with error these?
>>>
>>
>> The code in sanitizer_linux.cc calls libc function "open" and passes
>> O_CLOEXEC as a flag to it. "man open" says:
>> "O_CLOEXEC (Since Linux 2.6.23)"
>> is it possible that your Linux is older that a given version?
>>
> Hi!,
>
>      It's present version after check with "uname -r" command line. Kernel
> version 2.6.18-194.17.4.el5. I cannot upgrade version of kernel because
> another programs depend on current kernel version. How can i work around
> this situation?
>

I guess you can simply replace
  O_WRONLY | O_CREAT | O_CLOEXEC
with
  O_WRONLY | O_CREAT

If that helps, we will probably need to put this under some sort of
ifdef...

--kcc


>
> Best Regards,
> Chatsiri Rattana
>
>>
>>
>>>
>>> Best Regards,
>>> Chatsiri Rattana.
>>>
>>> --
>> Alexey Samsonov, MSK
>>
>>
>
>
> --
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120606/311c2606/attachment.html>


More information about the llvm-dev mailing list