[DEV] Docker template for building CyanogenMod

Search This thread

todivefor

Senior Member
Jun 25, 2010
924
202
Pittsburgh, PA
Got the same result with grouper:

collect2: error: ld terminated with signal 9 [Killed]
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol '__system_property_get' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/base_base_gyp_intermediates/base_base_gyp.a(sys_info_android.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libcutils.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::lockPixels() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::unlockPixels() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::notifyPixelsChanged() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
make: *** [/home/cmbuild/android/out/target/product/grouper/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so] Error 1
root@e4de81b8f6a5:/home/cmbuild/android#
 

todivefor

Senior Member
Jun 25, 2010
924
202
Pittsburgh, PA
Got the same result with grouper:

collect2: error: ld terminated with signal 9 [Killed]
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol '__system_property_get' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/base_base_gyp_intermediates/base_base_gyp.a(sys_info_android.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libcutils.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::lockPixels() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::unlockPixels() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
/home/cmbuild/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: warning: hidden symbol 'SkBitmap::notifyPixelsChanged() const' in /home/cmbuild/android/out/target/product/grouper/obj/STATIC_LIBRARIES/skia_skia_library_gyp_intermediates/skia_skia_library_gyp.a(SkBitmap.o) is referenced by DSO /home/cmbuild/android/out/target/product/grouper/obj/lib/libjnigraphics.so
make: *** [/home/cmbuild/android/out/target/product/grouper/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so] Error 1
root@e4de81b8f6a5:/home/cmbuild/android#

@michael_ch What is a known working build that I can try?
 

michael_ch

Senior Member
Oct 27, 2009
230
209
@michael_ch What is a known working build that I can try?

After searching about your problem, I don't think it has to do with the target device.

It just seems like your Docker container doesn't have enough memory (RAM) available. Check these links about the collect2 error which seems to be the starting point of your problems:

- http://stackoverflow.com/questions/5682854/why-is-the-linker-terminating-on-me-when-i-build-clang
- http://stackoverflow.com/questions/20137827/llvm-error-linking-error-to-liblto-so

Docker uses all available memory so it seems like your computer can't provide enough of it. What you can do though, is to use more swap space and use that explicitely by running "docker run -m=<n>" (eg. "4g"). However, I'm pretty sure this will terribly slow down your build time... For more on "docker run", check https://docs.docker.com/reference/run/#runtime-constraints-on-cpu-and-memory.
 

todivefor

Senior Member
Jun 25, 2010
924
202
Pittsburgh, PA
@michael_ch finally got this to work. The links you provided me were spot on. I have a ubuntu VM I use to try to learn a little about linux. I tried all this as an exercise to learn more about linux and docker and less about compiling CM. My VM was initially set at 1G, didn't work. I tried 4G and 8G, neither worked. I bumped it it up to 12G and set swap to 10G, which worked. I will try to boot my built CM12, but not my intended goal. Several years ago, I setup a build environment for CM, maybe CM9, but this is much slicker. It was a good learning experience. Thank you.
 

michael_ch

Senior Member
Oct 27, 2009
230
209
@michael_ch finally got this to work. The links you provided me were spot on. I have a ubuntu VM I use to try to learn a little about linux. I tried all this as an exercise to learn more about linux and docker and less about compiling CM. My VM was initially set at 1G, didn't work. I tried 4G and 8G, neither worked. I bumped it it up to 12G and set swap to 10G, which worked. I will try to boot my built CM12, but not my intended goal. Several years ago, I setup a build environment for CM, maybe CM9, but this is much slicker. It was a good learning experience. Thank you.

Thanks for the feedback, you're welcome! :)
 

michael_ch

Senior Member
Oct 27, 2009
230
209
New Release v0.3.0

Hey folks! I just published a new release of the box. Now is a good time to create your own build of the upcoming CyanogenMod 12.1:

Code:
repo init -u git://github.com/CyanogenMod/android.git -b staging/cm-12.1
repo sync -j 16
source build/envsetup.sh
make clean
brunch <device codename>      # example: brunch grouper

Have fun!
 

muff99

Senior Member
Jan 6, 2011
396
155
Help!

Hi, I am using ubuntu 14.04 (32bit) in a virtual box, docker was installed using apt-get.
me@alderaan:~/docker-cyanogenmod$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

After git clone, I could not find the mentioned build .sh skript. I ran run.sh instead, which fails after a few seconds with this message:
me@alderaan:~/docker-cyanogenmod$ sudo ./run.sh
Building Docker image stucki/cyanogenmod:cm-12.1...
Sending build context to Docker daemon 97.79 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04
---> 07f8e8c5e660
Step 1 : MAINTAINER Michael Stucki <mundaun@gmx.ch>
---> Using cache
---> b91b62d5475c
Step 2 : ENV DEBIAN_FRONTEND noninteractive
---> Using cache
---> 9f32d4a8e6cb
Step 3 : RUN sed -i 's/main$/main universe/' /etc/apt/sources.list
---> Running in 6e9bab42861a
2015/05/01 22:07:23 exec format error
2015/05/02 00:07:25 The command [/bin/sh -c sed -i 's/main$/main universe/' /etc/apt/sources.list] returned a non-zero code: 1
Unable to find image 'stucki/cyanogenmod:cm-12.1' locally
Pulling repository stucki/cyanogenmod
2015/05/02 00:07:26 HTTP code: 404

Could anyone pooint me into a direction how to move on?

Is the fact that I am trying on a 32bit guest system the reason for this error?

UPDATE: Nevermind, my machine (Intel Core2Quad 8200) does not support hardware virtualization, so I'm not able to emulate 64bit OS and thus wont be able to build CM. I'm still not sure if thats the cause for the above error, but I guess I'll stop trying until I get a new pc ...
 
Last edited:

michael_ch

Senior Member
Oct 27, 2009
230
209
Hi!
Hi, I am using ubuntu 14.04 (32bit) in a virtual box, docker was installed using apt-get.
me@alderaan:~/docker-cyanogenmod$ sudo docker version
Client version: 1.0.1
That's a really old Docker version. However I understand it's the version which is shipped with stock Ubuntu. Please try again using the repository provided by Docker:
https://get.docker.io/ubuntu/ / https://docs.docker.com/installation/ubuntulinux/

After git clone, I could not find the mentioned build .sh skript. I ran run.sh instead, which fails after a few seconds with this message:
me@alderaan:~/docker-cyanogenmod$ sudo ./run.sh
Building Docker image stucki/cyanogenmod:cm-12.1...
...
Step 3 : RUN sed -i 's/main$/main universe/' /etc/apt/sources.list
---> Running in 6e9bab42861a
2015/05/01 22:07:23 exec format error
2015/05/02 00:07:25 The command [/bin/sh -c sed -i 's/main$/main universe/' /etc/apt/sources.list] returned a non-zero code: 1
I will update the OP and fix the wrong reference on build.sh. Running run.sh is fine (it includes the "docker build" functionality now).
I wonder why step 3 fails on your system. It shouldn't occur with the latest Docker ubuntu:14.04 image. Please try to update it:
Code:
docker pull ubuntu:14.04
After that, edit run.sh and set "FORCE_BUILD=1". Then run the script again. (Make sure to set it back to 0 after your Docker image is built.)

Could anyone pooint me into a direction how to move on?

Is the fact that I am trying on a 32bit guest system the reason for this error?

UPDATE: Nevermind, my machine (Intel Core2Quad 8200) does not support hardware virtualization, so I'm not able to emulate 64bit OS and thus wont be able to build CM. I'm still not sure if thats the cause for the above error, but I guess I'll stop trying until I get a new pc ...
Never mind. I hope these answers can help someone else who has a similar problem...
 

steadfasterX

Recognized Developer
Nov 13, 2013
6,239
15,479
127.0.0.1
OnePlus 7T Pro
Hey folks! I just published a new release of the box. Now is a good time to create your own build of the upcoming CyanogenMod 12.1:

Code:
repo init -u git://github.com/CyanogenMod/android.git -b staging/cm-12.1
repo sync -j 16
source build/envsetup.sh
make clean
brunch <device codename>      # example: brunch grouper

Have fun!



This is so great. Thanks for doing this and keeping it updated!!!
Highly appreciated! :good::good:
 

mastarifla

Senior Member
Oct 3, 2010
485
293
Dallas, TX
Thanks again for this :)

I initially had an issue with running the ./run.sh command after changing directories, it kept saying the file couldn't be found, even though I did an ls and it showed up in green text

However, I managed to get around it by doing sh run.sh which executed the script, so I think I am okay now :)
 

michael_ch

Senior Member
Oct 27, 2009
230
209
Would be nice to document what the template actually executed on our system...
There's no magic involved, no hidden processes etc. Take a look at the Dockerfile which is pretty self-explaining...

Great work! It should come useful with DigitalOcean.
Given that you need around 80 GB I wouldn't recommend DigitalOcean for this as it's too expensive for such a high amount of storage.
Instead, just run VirtualBox or installl Linux on a PC at home...
 

seanrm

New member
Mar 5, 2016
3
0
This is handy and made building CM 12.1 for grouper v easy.

One issue is adb access - I think this should be addressed quite upfront in README/instructions.

I now have situation where build env, etc has been downloaded into my container, but I can't run adb commands
as I did not connect device at container run time - if I kill container, I'll have to download CM in its entirety again
which takes a while.

Thanks for good contribution in any case.

Sean.
 

mamizari

Member
Dec 25, 2014
13
0
St. Louis, MO
You should mount a volume on the host filesystem into your Docker container to avoid having to redownload. The volume will persist between container restarts.
 

michael_ch

Senior Member
Oct 27, 2009
230
209
This is handy and made building CM 12.1 for grouper v easy.
One issue is adb access - I think this should be addressed quite upfront in README/instructions.
The following works on my development machine, I just didn't commit it yet because it needs more documentation.
The idea here is that you run adb on the host and make it listen for TCP connections. Within the Docker container, you just connect to this IP:
Code:
# On the host, run adb in daemon mode:
sudo adb -a fork-server server

# Inside the container, set an alias for adb (adb is used from the build path)
alias adb='/home/cmbuild/android/out/host/linux-x86/bin/adb -H <ip of your host>'

# Test:
adb devices
Let me know if this works!

I now have situation where build env, etc has been downloaded into my container, but I can't run adb commands
as I did not connect device at container run time - if I kill container, I'll have to download CM in its entirety again
which takes a while.
This is weird. By default, the container should be created with "android" and "ccache" folders mounted from the host. So deleting the container has no effect on them.
Are you calling "./run.sh" to start your box? If not, please try this.
 
  • Like
Reactions: seanrm

seanrm

New member
Mar 5, 2016
3
0
The following works on my development machine, I just didn't commit it yet because it needs more documentation.
The idea here is that you run adb on the host and make it listen for TCP connections. Within the Docker container, you just connect to this IP:
Code:
# On the host, run adb in daemon mode:
sudo adb -a fork-server server

# Inside the container, set an alias for adb (adb is used from the build path)
alias adb='/home/cmbuild/android/out/host/linux-x86/bin/adb -H <ip of your host>'

# Test:
adb devices
Let me know if this works!

Will do!

This is weird. By default, the container should be created with "android" and "ccache" folders mounted from the host. So deleting the container has no effect on them.
Are you calling "./run.sh" to start your box? If not, please try this.

Ah - my bad - I did not look at run.sh in detail and did not see this. Again, it might be helpful if there was a pointer in the
docs.

Thanks for prompt reply.

Sean.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 44
    Docker template for building CyanogenMod

    Building CyanogenMod requires quite a lot of work. You will need to install a large number of dependencies, and you will need to read through lots of documentation.
    Docker is a rather new software to automate the deployment of applications inside a software container.

    Here is a Docker container for running an environment which contains everything that is needed to compile CyanogenMod. It will be very easy to install, and it will just work! The Github page contains some further information on how to get started.

    NOTE: You will need to install Docker to proceed: https://www.docker.io/gettingstarted/

    How to run:
    Code:
    git clone https://github.com/stucki/docker-cyanogenmod.git
    cd docker-cyanogenmod
    ./run.sh

    How to build CyanogenMod for your device:
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0
    repo sync
    source build/envsetup.sh
    brunch <device codename>      # example: brunch grouper

    Download:

    Github URL: https://github.com/stucki/docker-cyanogenmod

    ChangeLog:

    see https://github.com/stucki/docker-cyanogenmod/blob/master/CHANGELOG.md

    Questions and Answers:

    see http://xdaforums.com/android/help/qa-docker-template-building-cyanogenmod-t3173025

    Any feedback is welcome. Enjoy!
    4
    Docker template for building CyanogenMod

    Building CyanogenMod requires quite a lot of work. You will need to install a large number of dependencies, and you will need to read through lots of documentation.
    Docker is a rather new software to automate the deployment of applications inside a software container.

    Here is a Docker container for running an environment which contains everything that is needed to compile CyanogenMod. It will be very easy to install, and it will just work! The Github page contains some further information on how to get started.

    How to build:
    Code:
    git clone https://github.com/stucki/docker-cyanogenmod.git
    cd docker-cyanogenmod
    ./build.sh

    How to run:
    Code:
    cd docker-cyanogenmod
    ./run.sh

    How to build CyanogenMod for your device:
    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
    repo sync
    source build/envsetup.sh
    breakfast <device codename>   # example: breakfast grouper
    brunch <device codename>      # example: brunch grouper

    Download:

    Github URL: https://github.com/stucki/docker-cyanogenmod

    ChangeLog:
    Code:
    2014-02-16
    
    * Initial release

    Any feedback is welcome. Enjoy!

    seems interesting!!!!
    2
    Docker template for building CyanogenMod


    :good: nice.......
    You missed one point though .....
    Code:
    BUILD_HOST_32bit=1 (Cyanogenmod needs 32 bit binaries to compile)
    and you can incorporate this in your code
    Code:
    RUN apt-get purge openjdk-\* icedtea-\* icedtea6-\*
    RUN add-apt-repository ppa:webupd8team/java
    RUN apt-get update && sudo apt-get install oracle-java6-installer

    This installs the correct jdk for cyanogenmodand resolves the incorrect jre errors some people will get..Just my 2 cents!!..

    There is scope for expansion, I have a built a similar tool but not getting the time anymore to push new updates..:(,,,anyways keep up the good work..:)
    2
    FYI: I've pushed another update which is necessary after CyanogenMod now requires "maven" to build.
    2
    New Release v0.3.0

    Hey folks! I just published a new release of the box. Now is a good time to create your own build of the upcoming CyanogenMod 12.1:

    Code:
    repo init -u git://github.com/CyanogenMod/android.git -b staging/cm-12.1
    repo sync -j 16
    source build/envsetup.sh
    make clean
    brunch <device codename>      # example: brunch grouper

    Have fun!