[llvm-commits] [PATCH] Missing unistd.h in JIT/Intercept.cpp and MCJIT/Intercept.cpp

Ryuta Suzuki ryuuta at gmail.com
Fri Aug 12 18:27:19 PDT 2011


This patch is to fix the following compilation errors when "clang++
-stdlib=libc++" is used:

[ 49%] Building CXX object
lib/ExecutionEngine/JIT/CMakeFiles/LLVMJIT.dir/Intercept.cpp.o
/home/ryuta/devel/llvm/src/llvm/lib/ExecutionEngine/JIT/Intercept.cpp:70:67:
error:
      use of undeclared identifier 'lseek64'; did you mean 'fseeko64'?
    sys::DynamicLibrary::AddSymbol("\x1lseek64", (void*)(intptr_t)lseek64);
                                                                  ^~~~~~~
                                                                  fseeko64
/usr/include/stdio.h:811:12: note: 'fseeko64' declared here
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
           ^
1 error generated.

[ 50%] Building CXX object
lib/ExecutionEngine/MCJIT/CMakeFiles/LLVMMCJIT.dir/Intercept.cpp.o
/home/ryuta/devel/llvm/src/llvm/lib/ExecutionEngine/MCJIT/Intercept.cpp:70:67:
error:
      use of undeclared identifier 'lseek64'; did you mean 'fseeko64'?
    sys::DynamicLibrary::AddSymbol("\x1lseek64", (void*)(intptr_t)lseek64);
                                                                  ^~~~~~~
                                                                  fseeko64
/usr/include/stdio.h:811:12: note: 'fseeko64' declared here
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
           ^
1 error generated.


Note that lseek64 resides in unistd.h. Simply including the header fixed the
problem.


Index: lib/ExecutionEngine/JIT/Intercept.cpp
===================================================================
--- lib/ExecutionEngine/JIT/Intercept.cpp (revision 137538)
+++ lib/ExecutionEngine/JIT/Intercept.cpp (working copy)
@@ -51,6 +51,7 @@
 #if defined(HAVE_SYS_STAT_H)
 #include <sys/stat.h>
 #endif
+#include <unistd.h>
 #include <fcntl.h>
 /* stat functions are redirecting to __xstat with a version number.  On
x86-64
  * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make
'stat'
Index: lib/ExecutionEngine/MCJIT/Intercept.cpp
===================================================================
--- lib/ExecutionEngine/MCJIT/Intercept.cpp (revision 137538)
+++ lib/ExecutionEngine/MCJIT/Intercept.cpp (working copy)
@@ -51,6 +51,7 @@
 #if defined(HAVE_SYS_STAT_H)
 #include <sys/stat.h>
 #endif
+#include <unistd.h>
 #include <fcntl.h>
 /* stat functions are redirecting to __xstat with a version number.  On
x86-64
  * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make
'stat'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110813/0eeb4298/attachment.html>


More information about the llvm-commits mailing list