android source build fails: undeclared identifier 'ftruncate'

I wanted to build the android source code by using this documentation: https://source.android.com/source/building-running.html

last step was: 'make -j16'

After a while the compilation is aborted with the following error message:

host C++: libart <= art/runtime/catch_block_stack_visitor.cc
host C++: libart <= art/runtime/catch_finder.cc
art/compiler/elf_stripper.cc:122:16: error: use of undeclared identifier 'ftruncate'
  int result = ftruncate(file->Fd(), offset);
               ^
1 error generated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libart-compiler_intermediates/elf_stripper.o] Fehler 1
make: *** Warte auf noch nicht beendete Prozesse...

I have no idea. Google did not help and I am really not into this topic, just wanted to do a little change to the android code (I have not changed anything yet).

My system is:

ubuntu 13.10
java 1.6.0_4
current android master branch

Answers


You could avoid this problem by adding

#include <unistd.h>

at the beginning of elf_stripper.cc


Need Your Help

Realm DB library adds around 3.5 Mb

android realm

Before adding ream library support my app size was 2.55MB and after adding realm size became 6.43MB.