MacOS Sierra10.12.4 compilation Android7.1.1 source code must jump to the pit

Source: Internet
Author: User

Simple Introduction

It took two days to download the Android7.1.1 source code, and it took 2 days to compile the entire source code, during which countless pits were encountered.

Now compile the source code, once you encounter errors in the middle, you have to start again.

This article records the compilation process encountered problems and solutions, such as the compilation of source code needs to be able to reference this article first to skip these pits and then compile, Mac environment for 10.12.4.

Compile step

Direct reference to official guidance can be https://source.android.com/source/initializing.html
Deep pits are implied in these steps and are explained below.

Problem 1–mac upper case and lowercase are not sensitive

On Mac, default is uppercase and lowercase insensitive. That is, you create a new a directory and A directory. The two will feel like a directory, and don't let it create a second one A .
Because not willing to open in the notebook 40G space. I built a 50G dmg on my mobile hard drive and then mounted it /Volumes/android under the path.

Can use the official web file with the command to build DMG, but also with the use of their own disk tools to complete. Open Disk Utility, then click File – NEW:

Then choose the format as Mac OS扩展(区分大写和小写,日志式)

After you have built the DMG that meets the format requirements, copy the source code to be able to do so /Volumes/android .

Issue 2–JDK Version number issue

Please check the JDK version number before compiling, crossing on the Internet:

Java Development Kit (JDK) Please note,sinceThere is no available supported OpenJDK8Packages forUbuntu14.04, theUbuntu15.04Packages must be installed manually. See JDK forUbuntu LTS14.04  forPrecise instructions. The Master Branch ofAndroidinchAosp:ubuntu-openjdk8, Mac OS-JDK8U45orNewerandroid5.X (Lollipop)-Android6.0(Marshmallow): UBUNTU-OPENJDK7, Mac os-jdk-7U71-macosx-x64.dmgandroid2.3. x (Gingerbread)-Android4.4. x (KitKat): Ubuntu-java JDK6, Mac Os-java JDK6Android1.5(cupcake)-Android2.2. x (Froyo): Ubuntu-java JDK5

The version number that is required on Mac OS jdk 8u45 . Assuming that the version number is below this, a mistake will be reported. I simply installed the newest, direct 1.8.0_112 :

echo$JAVA_HOME/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
Question 3– fatal error: linux/netfilter/xt_DSCP.h: No such file or directory

Specific error messages such as the following:

inchFile included from out/target/product/generic/obj/static_libraries/libext4_intermediates/libipt_ecn. C: One:0: external/iptables/extensions/. /include/linux/netfilter_ipv4/ipt_ecn. h: -:Panax Notoginseng: Fatal ERROR:LINUX/NETFILTER/XT_DSCP. h: No such fileorDirectory#include <linux/netfilter/xt_DSCP.h>^compilation terminated.Make :*** [ out/target/product/generic/obj/static_libraries/libext4_intermediates/libipt_ecn. O] Error1Make :Waiting for unfinished jobs ....

Workaround, create a new file in the appropriate directory xt_DSCP.h :

/* based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <[email protected]> * This software is distributed under GNU GPL v2, 1991 * * See RFC2474 for a description of the DSCP field within the IP Header. * * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp*/#ifndef _XT_DSCP_TARGET_H#define _XT_DSCP_TARGET_H#include <linux/netfilter/xt_dscp.h>#include <linux/types.h>/* target info */struct xt_DSCP_info {        __u8 dscp;};struct xt_tos_target_info {        __u8 tos_value;        __u8 tos_mask;};#endif /* _XT_DSCP_TARGET_H */
Question 4– Unsupported curl

Question Details:

usenotonnotusenotonusenoton2712844/46181] host Java: bouncycastle-host (out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_intermediates/classes)

Need to install Curl again: You need install a curl compiled with openssl
Download from http://curl.haxx.se/download.html. And then:

.--prefix=/usr/local--with-ssl=/usr/local/Cellar/openssl/1.0.2&& make install

Then /usr/local/curl/bin join to path to verify that Curl is installed:

--version7.46.0 (x86_64-apple-darwin15.2.0) libcurl/7.46.0 OpenSSL/1.0.2d zlib/1.2.5fileftphttphttps
Question 5– jack-admin Out of memory error

This is assumed to be the default setting. Must encounter this problem, specific log:

totry‘jack-diagnose‘orlog‘jack-admin start-server‘……ninja: build stopped: subcommand failed.make[11

Reference http://blog.csdn.net/luvzhan/article/details/53282968, the solution to edit the prebuilts/sdk/tools/jack-admin file, JACK_SERVER_COMMAND=“…… -cp ……” -cp before adding -Xmx7000m , (7000m is about half the size of memory, Depending on the host configuration used).
Remember: Be sure to manually turn on Jack-admin before compiling start-server
can also participate in the examiner's network of a paragraph:

If You experience Jack compilations failingOn out of     memory error.:You can improve theSituation byReducing the  Number  ofJack Simultaneous compilations byEditing your $HOME/.jack-server/config.properties andChanging Jack.server.Max-service to a Lower value  and  ThenRestarting theServer. If this is notEnough, you could change theArguments used toStart theServer JVM andForceaGreater maximum Java heap size ("-xmx"): Stop theServerusingJack-admin Stop-server, Then: If You start theServer manually:jack_server_vm_arguments="-xmx2g-dfile.encoding=utf-8-xx:+tieredcompilation"Jack-admin Start-serverif theJack Serverinch  theAndroid Tree ThenExport android_jack_vm_args="-xmx2g-dfile.encoding=utf-8-xx:+tieredcompilation" andRestart your build command.

Actually here is a meaning. I recommend changing the jack-admin file directly.

Question 6– error: ‘syscall‘ is deprecated

MacOSX10.11compiling the source code on the subsequent platform will encounter this problem, the workaround is to download from Https://github.com/phracker/MacOSX-SDKs MacOSX10.11 ,
Unzip the copy to /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs . To avoid being deleted the next time you upgrade, you can put it into one of your own directories ( /Users/xu/work/git/MacOSX-SDKs/ ), and then create a soft link for it:

sudo ln -s /Users/xu/work/git/MacOSX-SDKs/MacOSX10.11.sdk /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

Then make sure that the AOSP source code build/core/combo/mac_version.mk in the file

mac_sdk_versions_supported := 10.9 10.10 10.11

Don't write 10.12 in the back.

Problem 7– Don't forget to download the driver

Suppose you want to install the compiled image to your phone and don't forget to download the driver before compiling the source code: Https://developers.google.com/android/blobs-preview or https:// Developers.google.com/android/drivers#angler download.

Compiling core commands
    1. Manually turn on the jack-admin ( try to turn it on manually)
$ jack-admin kill-server$ jack-admin start-server
    1. Emptymake clobber
    2. Setting up the environmentsource build/envsetup.sh
    3. Select targetlunch
    4. Start compilingmake -j4
References
    1. http://blog.csdn.net/sinat_26227857/article/details/44078703
    2. Issue 4 Workaround
    3. Question 5 official website Jack-admin
    4. Question 5 CSDN Blog
    5. Question 6

MacOS Sierra10.12.4 compilation Android7.1.1 source code must jump to the pit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.