<div dir="ltr"><div>This is only available for apps that target API level 19 and up. On 18 and lower, the futimens() function won't be available via libc.so. You will need to target API 19 (KitKat) in order to actually use it. If I do an "nm -D prebuilts/ndk/9/platforms/android-19/arch-arm/usr/lib/libc.so", I can see futimens() is present. On the others, it is definitely missing.</div>
<div><br></div><div>Steve</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 25, 2013 at 3:57 PM, James Lyon <span dir="ltr"><<a href="mailto:jameslyon0@gmail.com" target="_blank">jameslyon0@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Hmmm.... following up on your point
I've noticed something strange. futimens is missing from the NDK
(r9b; it's not in any headers and the libc.so files are the same
all the way back to android-9), which is why I thought it's
missing from Android generally. The NDK is by far the easiest way
to cross-compile since it provides a standalone cross-compilation
toolchain. It is however present in<br>
<br>
<a href="https://android.googlesource.com/platform/prebuilts/ndk/+/master/9/platforms/android-19/arch-arm/usr/include/sys/stat.h" target="_blank">https://android.googlesource.com/platform/prebuilts/ndk/+/master/9/platforms/android-19/arch-arm/usr/include/sys/stat.h</a><br>
<br>
which seems odd to me. Steve, perhaps you know whether this is
intentional? My googling isn't getting me anywhere on why the file
I've linked is different to
platforms/android-19/arch-arm/usr/include/sys/stat.h in the NDK.<span class="HOEnZb"><font color="#888888"><br>
<br>
James</font></span><div><div class="h5"><br>
<br>
On 25/11/13 22:12, Stephen Hines wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Mon, Nov 25, 2013 at 12:36 PM, Alp
Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><br>
On 25/11/2013 18:27, Stephen Hines wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">futimens()
is available in Android KitKat. We work extensively
with LLVM and this allowed us to remove our ugly
workaround for not having this functionality.<br>
</blockquote>
<br>
</div>
Hi Steve,<br>
<br>
Is your work on a branch somewhere?<br>
</blockquote>
<div><br>
</div>
<div>It is all available as part of the Android Open Source
Project (AOSP). I should mention that we do not use the
JIT path, but LLVM does require futimens() to build
properly for Android (hence us fixing this missing part of
bionic). If you want to look at local patches that we have
for LLVM/Clang, those are available in "external/llvm" and
"external/clang". We have very few differences from
upstream LLVM.</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
James is putting a lot of time into this, and the LLVM
community has been making best efforts to help review his
patches which can be difficult for those who don't
normally work with the Android platform.<br>
<br>
So if the work is already out there, that'd be useful to
know in order to avoid duplication of effort. There are
lots of other useful things we could be doing if support
for that platform is already complete somewhere on Github
:-)<br>
</blockquote>
<div><br>
</div>
<div><a href="http://source.android.com/" target="_blank">http://source.android.com</a> has
instructions for how to pull down AOSP. We don't use
github.</div>
<div><br>
</div>
<div>Steve</div>
<div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Cheers,<br>
Alp.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Steve
<div><br>
<br>
<br>
On Mon, Nov 25, 2013 at 8:30 AM, James Lyon <<a href="mailto:jameslyon0@gmail.com" target="_blank">jameslyon0@gmail.com</a> <mailto:<a href="mailto:jameslyon0@gmail.com" target="_blank">jameslyon0@gmail.com</a>>>
wrote:<br>
<br>
Hi,<br>
<br>
I've been trying to get LLVM working as a JIT
compiler on Android<br>
for a while. It works now, except that the<br>
setLastModificationAndAccessTime function won't
build because the<br>
Bionic C library lacks both futimes and futimens.
There doesn't<br>
appear to be any "nice" workaround for this
problem: the only ways<br>
I can think of to make
setLastModificationAndAccessTime work are<br>
either to go by /proc/self/fd or invoke the system
call directly<br>
(the second option isn't helped by the fact that
the Android<br>
headers don't define the relevant system call
number and it varies<br>
between platforms).<br>
<br>
Right now the only part of LLVM that uses this
function is<br>
llvm-ar, so it's not as if lack of support for
this function is a<br>
serious shortcoming. I don't really know the
history of<br>
PathV1/PathV2 but I think the simplest solutions
are:<br>
<br>
</div>
1. Have setLastModificationAndAccessTime fail on
platforms
<div><br>
without futimes/futimens (by ENOSYS). This is
pretty ugly<br>
because having a function which can never
succeed seems likely<br>
to confuse users.<br>
</div>
2. Only declare setLastModificationAndAccessTime if
it is
<div><br>
actually available (add something to
llvm-config.h to indicate<br>
this). The downside here is that (in theory at
least) users<br>
need to know that
setLastModificationAndAccessTime might be<br>
missing, although in practise they can
probably ignore the issue.<br>
<br>
(1) is trivial to implement and is what I'm doing
now; I can also<br>
create a patch to do (2), I just thought I'd ask
for opinions first.<br>
<br>
Regards,<br>
<br>
James<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
</div>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <mailto:<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>>
<div><br>
<a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div>
</blockquote>
<span><font color="#888888">
<br>
-- <br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div>