[LLVMbugs] [Bug 10646] New: Support/Unix/TimeValue.inc missing time.h when compiled by clang++ -stdlib=libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 12 07:18:17 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10646

           Summary: Support/Unix/TimeValue.inc missing time.h when
                    compiled by clang++ -stdlib=libc++
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: oroppas at gmail.com
                CC: llvmbugs at cs.uiuc.edu


In an attempt to self-host llvm/clang with libc++ instead of libstdc++, I've
got the following error (compiled by 'clang++ -stdlib=libc++')

[  0%] Building CXX object
lib/Support/CMakeFiles/LLVMSupport.dir/TimeValue.cpp.o
In file included from
/home/ryuta/devel/llvm/src/llvm/lib/Support/TimeValue.cpp:53:
/home/ryuta/devel/llvm/src/llvm/lib/Support/Unix/TimeValue.inc:32:5: error: no
member named 'asctime_r' in the global namespace
  ::asctime_r(::localtime(&ourTime), buffer);
  ~~^
/home/ryuta/devel/llvm/src/llvm/lib/Support/Unix/TimeValue.inc:32:17: error: no
member named 'localtime' in the global namespace
  ::asctime_r(::localtime(&ourTime), buffer);
              ~~^
2 errors generated.
make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/TimeValue.cpp.o] Error 1
make[1]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/all] Error 2
make: *** [all] Error 2

In Support/Unix/Unix.h there are lines:

#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

In the case of linux, HAVE_SYS_TIME_H is defined but it turns out both
asctime_r and locatime are defined in time.h rather than sys/time.h. I think we
haven't seen this error when libstdc++ was used and it's just a coincidence
that libstdc++ has the relevant header(s) which may include time.h. Obviously,
libc++ doesn't. Some refactoring of header inclusion in Unix.h might be
necessary.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list