Android build error

1,119 views
Skip to first unread message

Qin LIU

unread,
Oct 10, 2016, 10:14:47 AM10/10/16
to Android Building

I install Ubuntu 16.04 by vagrant. However, when I run make Android 7.0, the following error happens.


Is there any suggestion or advise for me?


Thanks 



ninja: Entering directory `.'

[  0% 39/34804] host Java: ahat (out/ho...A_LIBRARIES/ahat_intermediates/classes

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

[  0% 53/34804] Generating TOC: out/tar.../core-all_intermediates/classes.jar.to

FAILED: /bin/bash -c "(out/host/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ) && (if cmp -s out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; then rm out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ; else mv out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; fi )"

output_length=16459012

Unable to open output file out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp: Invalid argument

/bin/bash: line 1: 13460 Aborted                 (core dumped) ( out/host/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp )

ninja: build stopped: subcommand failed.

build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed

make: *** [ninja_wrapper] Error 1

张敏

unread,
Oct 24, 2016, 10:57:35 AM10/24/16
to Android Building
I just meet the problem while build on ubuntu 14.04 using VM Virtualbox,
maybe alike.
While I execute:
out/host/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jar.toc.tmp

Err info:
output_length=7365084
Unable to open output file out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jar.toc.tmp: Invalid argument
Aborted (core dumped)
but I execute:
out/host/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jar ~/classes.jar.toc.tmp

it works ok.

I think it likes http://stackoverflow.com/questions/18420473/invalid-argument-for-read-write-mmap

But I hope build Android on share folder,so I modify build/tools/ijar/zip.cc:

@@ -992,11 +996,10 @@ ZipBuilder* ZipBuilder::Create(const char* zip_file, u8 estimated_size) {
   // SIGSEGV or SIGBUS by over-allocating beyond the end of the file.
   size_t mmap_length = std::min(estimated_size + sysconf(_SC_PAGESIZE),
                                 (u8) std::numeric_limits<size_t>::max());
+  //I hope build Android on VM'S share-folder,so add MAP_ANONYMOUS
   void *zipdata_out = mmap(NULL, mmap_length, PROT_WRITE,
-                           MAP_SHARED, fd_out, 0);
+                           MAP_SHARED | MAP_ANONYMOUS, fd_out, 0);


I hope this is useful.




在 2016年10月10日星期一 UTC+8下午10:14:47,Qin LIU写道:

Uki D. Lucas

unread,
Mar 15, 2018, 10:52:45 AM3/15/18
to Android Building
I am getting a similar error on 

  • Mac 10.3 
  • running Parallels (VM)
  • with Ubuntu 16.04  
  • AOSP code 
  • on SDD APFS (Case-sensitive)

I have applied the change listed in this thread:

AOSP $ edit build/tools/ijar/zip.cc

applied changes:

  // Ensure that any buffer overflow in JarStripper will result in

 
// SIGSEGV or SIGBUS by over-allocating beyond the end of the file.
  size_t mmap_length
= std::min(estimated_size + sysconf(_SC_PAGESIZE),
                               
(u8) std::numeric_limits<size_t>::max());

 
// to build Android on VM's shared folder, add MAP_ANONYMOUS

 
void *zipdata_out = mmap(NULL, mmap_length, PROT_WRITE,

                           MAP_SHARED
, fd_out, 0);
                           MAP_SHARED
| MAP_ANONYMOUS, fd_out, 0);



but, I still get the error:

FAILED: out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 prebuilts/build-tools/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp ) && (if cmp -s out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc ; then rm out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp ; else mv out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc ; fi )"
output_length
=5262319
Unable to open output file out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp: Invalid argument
/bin/bash: line 1: 13492 Aborted                 (core dumped) ( ASAN_OPTIONS=detect_leaks=0 prebuilts/build-tools/linux-x86/bin/ijar out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v9_intermediates/classes.jar.toc.tmp )
[  0% 14/82674] host C++: protoc-gen-javastream <= frameworks/base/tools/streaming_proto/string_utils.cpp
ninja
: build stopped: subcommand failed.
10:17:27 ninja failed with: exit status 1
#### failed to build some targets (03:28 (mm:ss)) ####



Reply all
Reply to author
Forward
0 new messages