COMPILE From Source For Any Phone On Linux Distros [BUILD ENVIRONMENT TO COMPILE]

Search This thread

jjhiza

Senior Member
Dec 19, 2010
3,163
2,697
Dirty Jersey
noob question...
i'm using arch...



there is a guide for set environment in arch or is better use virtual machine with ubuntu?

I ran into a similar issue a couple of months ago on Arch Linux... Granted, I had other reservations about the high maintenance nature of Arch, but the lack of documentation regarding Android building, had me frustrated. For now, I'm back in Mint 16, and things are great. Just my personal experience. :thumbup:

Sent from my Nexus 5 using Tapatalk
 

coloxim

Senior Member
Feb 17, 2011
1,546
52
Pavia
I ran into a similar issue a couple of months ago on Arch Linux... Granted, I had other reservations about the high maintenance nature of Arch, but the lack of documentation regarding Android building, had me frustrated. For now, I'm back in Mint 16, and things are great. Just my personal experience. :thumbup:

Sent from my Nexus 5 using Tapatalk

Ok... I've understood..
;)

Inviato dal mio Nexus 4 utilizzando Tapatalk
 

hhp_211

Senior Member
May 15, 2008
1,832
926
wondering if anyone could offer up some guidance to what this error might be
Trying to build Omni rom for Samsung Fascinate


including ./Android.mk ...
/home/hhp_211/android/omni/out/target/product/fascinatemtd/obj/APPS/SignatureTest_intermediates
build/core/Makefile:70: warning: overriding commands for target `/home/hhp_211/android/omni/out/target/product/fascinatemtd/system/etc/permissions/android.software.live_wallpaper.xml'
build/core/Makefile:70: warning: ignoring old commands for target `/home/hhp_211/android/omni/out/target/product/fascinatemtd/system/etc/permissions/android.software.live_wallpaper.xml'
PRODUCT_COPY_FILES device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml ignored.
PRODUCT_COPY_FILES device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml ignored.
PRODUCT_COPY_FILES device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml ignored.
PRODUCT_COPY_FILES hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf ignored.
PRODUCT_COPY_FILES vendor/omni/prebuilt/etc/apns-conf-cdma.xml:system/etc/apns-conf.xml ignored.
No private recovery resources for TARGET_DEVICE fascinatemtd
device/samsung/fascinatemtd/shbootimg.mk:8: warning: overriding commands for target `/home/hhp_211/android/omni/out/target/product/fascinatemtd/boot.img'
build/core/Makefile:476: warning: ignoring old commands for target `/home/hhp_211/android/omni/out/target/product/fascinatemtd/boot.img'
make: *** No rule to make target `/home/hhp_211/android/omni/out/target/common/obj/PACKAGING/public_api.txt', needed by `/home/hhp_211/android/omni/out/target/common/obj/PACKAGING/checkapi-last-timestamp'. Stop.
hhp_211@buildbot:~/android/omni$




.
 

roshan2989

Senior Member
Apr 10, 2012
829
189
Purgatory
hi guys anyone know why i get this error when i compile rom?


HTML:
Export includes file: packages/apps/Bluetooth/jni/Android.mk -- /home/preshothemannair/cm11/out/target/product/galaxysmtd/obj/SHARED_LIBRARIES/libbluetooth_jni_intermediates/export_includes
make: *** No rule to make target `/home/preshothemannair/cm11/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/javalib.jar', needed by `/home/preshothemannair/cm11/out/target/common/obj/APPS/Bluetooth_intermediates/classes-full-debug.jar'.  Stop.
make: *** Waiting for unfinished jobs....
logtags: /home/preshothemannair/cm11/out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java/com/android/internal/telephony/EventLogTags.java <= frameworks/opt/telephony/src/java/com/android/internal/telephony/EventLogTags.logtags
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
preshothemannair@Preshothemannair:~/cm11$



this is my second homemade cm rom..the first one is succesfully build and after that i remove some of the apps before compiling (do some research and edit local manifest) as you see below..is there any error related to the apps i remove..( i usualy remove them when i downloaded rom from cm page)

HTML:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="CyanogenMod/android_device_samsung_galaxysmtd" path="device/samsung/galaxysmtd" remote="github" />
  <project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" />
  <project name="CyanogenMod/android_device_samsung_aries-common" path="device/samsung/aries-common" remote="github" />
  <project name="CyanogenMod/android_kernel_samsung_aries" path="kernel/samsung/aries" remote="github" />
  <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" />
  

  <remove-project name="CyanogenMod/android_packages_apps_Apollo" />
  <remove-project name="CyanogenMod/android_packages_apps_Browser" />
  <remove-project name="CyanogenMod/android_packages_apps_Calendar" />
  <remove-project name="CyanogenMod/android_packages_apps_CellBroadcastReceiver" />
  <remove-project name="CyanogenMod/android_packages_apps_CMFileManager" />
  <remove-project name="CyanogenMod/android_packages_apps_CMUpdater" />
  <remove-project name="CyanogenMod/android_packages_apps_CMWallpapers" />
  <remove-project name="CyanogenMod/android_packages_apps_DSPManager" />
  <remove-project name="CyanogenMod/android_packages_apps_Email" />
  <remove-project name="CyanogenMod/android_packages_apps_Exchange" />
  <remove-project name="CyanogenMod/android_packages_apps_LockClock" />
  <remove-project name="CyanogenMod/android_packages_apps_QuickSearchBox" />
  <remove-project name="CyanogenMod/android_packages_apps_Stk" />
  <remove-project name="CyanogenMod/android_packages_apps_VideoEditor" />
  <remove-project name="CyanogenMod/android_packages_apps_VoicePlus" />
  <remove-project name="CyanogenMod/android_packages_providers_CalendarProvider" />
  <remove-project name="CyanogenMod/android_packages_screensavers_PhotoTable" />
  <remove-project name="CyanogenMod/android_packages_screensavers_Basic" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_Basic" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_Galaxy4" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_HoloSpiral" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_LivePicker" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_MagicSmoke" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_MusicVisualization" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_NoiseField" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_PhaseBeam" />
</manifest>
 
Last edited:

VfBStuttgart27

Senior Member
Dec 16, 2012
228
93
Munich
Can you help me?

Hi, I'm trying to build my first ROM (using this tutorial), but I've got a problem with the "repo init"-Command.
It always tells me:
Code:
smon@smon-VirtualBox:~$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
Get https://gerrit.googlesource.com/git-repo
error: couldn't connect to host while accessing https://gerrit.googlesource.com/git-repo/info/refs
fatal: HTTP request failed

I'm using VirtualBox on Win7 with Ubuntu 12.04 LTS.
 

VfBStuttgart27

Senior Member
Dec 16, 2012
228
93
Munich
Last edited:

Zeljko1234

Senior Member
May 7, 2010
5,898
2,766
Stockholm
Are you in right folder like ~/android/system/?

I suppose that you've done all earlier steps (download repo, make it executable...)
 

Zeljko1234

Senior Member
May 7, 2010
5,898
2,766
Stockholm
You must be in folder where you wish to init repo. Something like:

Code:
zeljko@zeljko-ubuntu:~/android/system$ $ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
 

trevd

Inactive Recognized Developer
Jul 19, 2011
895
1,271
Hull
Samsung Galaxy Tab 4
Browsing is working generally, If I try to acess https://gerrit.googlesource.com/git-repo/info/refs it says Error: 406 (but that's the same in Windows).

Should I change it although?


Edit: Now I've tried, but the message is the same:(

Hi

You probably need to download repo manually.. Google moved it not so long back which probably explains your error. Try

Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
sudo chmod +x ~/bin/repo

Then do brunch!

Hope that helps :D

For reference : http://source.android.com/source/downloading.html
 
  • Like
Reactions: VfBStuttgart27

VfBStuttgart27

Senior Member
Dec 16, 2012
228
93
Munich

skinzy98

Senior Member
May 30, 2012
1,768
521
hi i really need some help. I am building LiquidSmooth for the samsung vibrant. I have been working with somebody who has built it for the vibrant before and i have made the necessary changes since it is not a supported device but this is the error im getting right at the end of the build.

target Dex: Gallery2
target Dex: Contacts
target Dex: Dialer
target Dex: Launcher3
collect2: error: ld returned 1 exit status
make: *** [/home/skinzy98/liquid/out/target/product/vibrantmtd/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so] Error 1
make: *** Waiting for unfinished jobs....
 

Zeljko1234

Senior Member
May 7, 2010
5,898
2,766
Stockholm
How much memory and swap do you have?

Could be again that compiler just reached memory demanding part. According my experience, at least 2 GB or RAM and about 4 GB of swap is needed.
 

skinzy98

Senior Member
May 30, 2012
1,768
521
I have 81gb total cmpiling on Ubuntu 13.10 2gb of ram. Its not a space error as I have ran into many of those during this entire process

Sent from my SGH-T959 using xda app-developers app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 197
    buildve.png

    This is a guide to Compile From any CyanogenMod and CyanogenMod Source-Based source for Any Phone. This guide is for linux , Ubuntu etc.

    What you’ll need
    • A Phone Which runs Android :p
    • A relatively recent computer (Linux, OS X, or Windows) w/a reasonable amount of RAM and storage. The less RAM you have, the longer the build will take. Using SSDs results in faster builds than traditional hard drives.
    • A micro USB cable
    • A decent Internet connection & reliable electricity :)
    • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with what a recovery image such as ClockworkMod is, for example. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

    Note:
    You want to use a 64-bit version of Linux. According to Google, 32-bit Linux environment will only work if you are building older versions prior to Gingerbread (2.3.x)/CyanogenMod 7.

    Using a VM allows Linux to run as a guest inside your host computer-- a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

    So let’s begin!

    Build ROM and ClockworkMod Recovery



    buildenvironment.png


    Prepare the Build Environment


    Note:
    You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Next Post.

    Install the SDK
    If you have not previously installed adb and fastboot, install the Android SDK. "SDK" stands for Software Developer Kit, and it includes useful tools that you will can use to flash software, look at the system logs in real time, grab screenshots, and more-- all from your computer.

    Helpful Tip!
    While the SDK contains lots of different things-- the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

    Install the Build Packages
    Several "build packages" are needed to build From Source. You can install these using the package manager of your choice.
    Helpful Tip!
    A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

    For 32-bit & 64-bit systems, you'll need:
    Code:
    git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl 
    libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool
    For 64-bit only systems, get these:
    Code:
    g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.7-multilib g++-4.5-multilib
    For Linux Mint, you'll need:
    Code:
    libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils

    Create the directories
    Code:
    mkdir -p ~/bin

    Install the repo command
    Enter the following to download the "repo" binary and make it executable (runnable):
    Code:
    curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    chmod a+x ~/bin/repo

    Put the ~/bin directory in your path of execution
    Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin. Assuming you are using the BASH shell, the default in recent versions of Ubuntu, you can set it like this:
    Code:
    export PATH=${PATH}:~/bin

    Helpful Tip!
    You can make this change to the path permanent for all future Terminal sessions:
    Code:
    gedit ~/.bashrc
    This will launch a graphical text editor. Enter
    Code:
    export PATH=${PATH}:~/bin
    on its own line, then save the file.

    Initialize the source repository
    repox.png


    Make a Folder to Download the Sources and cd to it. For That:
    Code:
    mkdir -p ~/Source
    Code:
    cd Source

    Enter the following to initialize the repository:

    REPOSITORY'S OF FAMOUS ROMS (Select One)

    PAC-Man :
    Code:
    repo init -u git://github.com/PAC-man/android.git -b cm-10.2
    CM 11.0 :
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
    CM 10.1 :
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
    CM10 :
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b jellybean

    Download the source code
    Code:
    repo sync

    Helpful Tip!
    The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.


    Get prebuilt apps
    Code:
    cd ~/Source/vendor/cm
    Code:
    ./get-prebuilts

    How To Compile is there on next post :D
    105
    Prepare the device-specific code

    After the source downloads, type:
    Code:
    . build/envsetup.sh

    Then Do This

    Code:
    breakfast ******
    Where ***** is the codename for your device

    MAKE SURE YOUR PHONE IS ON OFFICIAL LATEST CYANOGENMOD ROM


    Helpful Tip!
    If you get a command not found error for lunch, be sure you’ve done the “. build/envsetup.sh” command from ~/Source. Notice there is a period and space (“. ”) in that command.

    Extract proprietary blobs

    Now ensure that your Phone is connected to your computer via the USB cable and that you are in the ~/Source/device/***/***** directory (you can cd ~/Source/device/***/****** if necessary). Run as Root if on Debian using sudo. Then run the this script:
    Code:
    ./proprietary-files.sh
    or
    Code:
    ./extract-files.sh

    Here ***** is Device codename and *** is the Phone Company like Samsung or HTC
    For Example if my phone is note 2 then this will be the device path : ~/Source/device/Samsung/n7100

    You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the right place in the vendor directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution

    Note:
    It’s important that these proprietary files are properly extracted and moved to the vendor directory. Without them, CyanogenMod will build without error, but you’ll be missing important functionality, such as the ability to see anything!

    Turn on caching to speed up build

    Code:
    export USE_CCACHE=1

    Start the build

    Code:
    cd ~/Source
    brunch *****
    Here ***** is the Phone Codename

    Helpful Tip!
    If the build doesn't start, try lunch and choose your device from the menu. If that doesn't work, try breakfast and choose from the menu. The command make ***** should then work.

    If the build breaks...
    If you experience this not-enough-memory-related error...
    Code:
    ERROR: signapk.jar failed: return code 1make: *** [out/target/product/n7100/cm_n7100-ota-eng.root.zip] Error 1
    ...you may want to make the following change to This File : system/build/tools/releasetools/common.py
    Change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m
    Then start the build again (with brunch).
    If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

    Install the build
    Assuming the build completed without error (it will be obvious when it finishes), type:
    Code:
    # cd $OUT

    in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called... kernel.
    But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains ClockworkMod recovery, and (2) cm-[something].zip, which contains ROM.

    Install ROM
    Back to the $OUT directory on your computer-- you should see a file that looks something like:
    Code:
    cm-10-20120718-UNOFFICIAL-***.zip
    Here *** is the phone codename

    Now you can flash the ...zip file above as usual via recovery mode. (Be sure you have backed up any previous installation before trying your new build.)


    Feedbacks to this guide
    I got my build working!
    Great tutorial by the way!
    Tom

    Well i finally sucessfully build.
    thank you for your help

    Works like a charm, used it a while ago too set up on 12.10 :)

    Compiling cm10.1 worked great for my sgs3 d2tmo.Thank's for the tutorial it's been fun setting this up.

    really really good guide, very detailed and precise.

    Hi there,
    I was finally able to compile Cyanogenmod from source.
    So, thanks for your guide an your support.Thanks a lot.
    Regards Koetermann

    Used your guide again to setup my PC for building! Worked like a charm on 11.04

    thanks for post this, great and simple guide for n00bs (like me)

    This tutorial ROCKS! :good: . Successfully built i9300 starting from fresh ubuntu 12.10 installation w/o even a hickup :D





    Read the Below Command Before Asking question regarding Device tree : Credit @speed_bot
    HTML:
    #include
    #include /ps my own header/
    main()
    {
    int device tree,rom;
    for((device==1) || (device tree =1))
    printf("you can build a rom");
    else 
    printf("you cant :P");
    }
    18
    The issue with guides like these is they are specific to one version of Ubuntu. I successfully build Android on gentoo, which has about as little in common with Ubuntu as possible. Hence we prefer to go for guides which, where possible, teach the reasoning, rather than the method.

    For building CM, this might be worthwhile merging into the "how to build android from source" one?

    Unfortunately this guide isn't usable for most people, as it relies on the hacksung build scripts, so you can only build for certain devices...

    What might be better is a guide on using roomservice via lunch, to build for any device?
    6
    What if i want to compile the PAC rom?
    https://github.com/PAC-man

    Downloading Ubuntu now!! Excited!! :)

    Edit figured it out myself!!
    repo init -u git://github.com/PAC-man/android.git -b jellybean
    thankx anyways...

    ya and you might need a minor edits to makefiles in the config ...


    btw

    this is a thread maintained by me
    http://xdaforums.com/showthread.php?t=2059939

    so feel free to post your errors that you encounter....

    @op

    explain what every step means rather then just copy paste....

    ---------- Post added at 06:37 PM ---------- Previous post was at 06:35 PM ----------

    Isn't "apt" the "stock" package manager in (K)Ubuntu?

    But I've another question @mithun46: Is it possible, that your guide only works on a 64bit edition of ubuntu? So that 32bit installations ain't supported?

    32bit systems don't have the packages to build jb and above.. so it wont work with 32bit systems..
    6
    Guys The Developer Comitee said me to apply for RC title. Don't know what to do.
    If I get more than ten thanks on this post I will apply

    Sent from my GT-P7300 using xda premium