Build Android failed

Yes I did try but I’m still getting the same error…

ninja: error: ‘out/target/product/kvim/obj/lib/crtbegin_dynamic.o’, needed by ‘out/target/product/kvim/obj/EXECUTABLES/i2cdetect_intermediates/LINKED/i2cdetect’, missing and no known rule to make it
make: *** [ninja_wrapper] Error 1

To answer your question: “Have you ever make full compilation for android source code?

I’ve done kernel compilation for the Khadas but never full android source code compilation.

You need to make full compilation once

Maybe I should create another topic for this but I’ve tried to compile the android source code but it failed at 11%.

Here is the output:

**Communication error with Jack server (52). Try 'jack-diagnose'**
**[ 11% 5391/47622] Building with Jack: ...k_intermediates/with-local/classes.dex**
**FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp**
**Communication error with Jack server (52). Try 'jack-diagnose'**
**ninja: build stopped: subcommand failed.**
**make: *** [ninja_wrapper] Error 1**

**#### make failed to build some targets (36:15 (mm:ss)) ####**

Please help me if you got any clue.

Did you Establish a Build Environment for your host PC?

Yes I’ve established the environment.

Here is the last error I’ve encountered.

build/core/base_rules.mk:183: *** hardware/libhardware/modules/gralloc:
MODULE.TARGET.SHARED_LIBRARIES.gralloc.default already defined by hardware/amlogic/gralloc.
make: *** [out/build-aosp_arm.ninja] Error 1

Did you lunch the kvim-userdebug-64 ?
You need to look the docs Building Android Source Code more carefully.

Nope I lunched kvim-user-64 as specified.
I’m using Ubuntu 14.04.

Just so I know, on which Ubuntu distribution did you manage to compile the android source code?

You didn’t lunch the corret target. You lunched ‘aosp_arm’
I’m using ubuntu 14.04 also .

I don’t get it…

Here is what I’ve done

$ cd WORKING_DIRECTORY/uboot
$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-
$ cd ..
$ source build/envsetup.sh
$ lunch kvim-user-64
$ make -j8 otapackage

If I don’t lunch the target as kvim, I get error the same with you

including ./hardware/amlogic/wifi/qcom/Android.mk ...
including ./hardware/amlogic/wifi/realtek/Android.mk ...
including ./hardware/arm/gpu/lib/Android.mk ...
Android.mk GPU_DRV_VERSION is 
build/core/binary.mk:1192: hardware/arm/gpu/lib/Android.mk: libGLES_mali: Unused source files: _ion/libGLES_mali_default_7a_32-n-r6p1.so
including ./hardware/broadcom/wlan/bcmdhd/Android.mk ...
including ./hardware/bsp/intel/peripheral/bluetooth/bcm43340/Android.mk ...
including ./hardware/bsp/intel/peripheral/displays/Grove_LCD_RGB/Android.mk ...
including ./hardware/bsp/intel/peripheral/displays/SparkFun_OLED/Android.mk ...
including ./hardware/bsp/intel/peripheral/examples/mraa/gpio_output/Android.mk ...
including ./hardware/bsp/intel/peripheral/libmraa/Android.mk ...
including ./hardware/bsp/intel/peripheral/libupm/Android.mk ...
including ./hardware/bsp/intel/peripheral/wifi/bcm43340/Android.mk ...
including ./hardware/bsp/intel/soc/common/bootctrl/Android.mk ...
including ./hardware/bsp/intel/soc/common/tools/Android.mk ...
including ./hardware/google/apf/Android.mk ...
including ./hardware/libhardware/Android.mk ...
build/core/base_rules.mk:183: *** hardware/libhardware/modules/gralloc: MODULE.TARGET.SHARED_LIBRARIES.gralloc.default already defined by hardware/amlogic/gralloc.
make: *** [out/build-aosp_arm.ninja] Error 1
terry@Server:~/project/vim/nougat$ 

###What’s the question for you now?

Thanks for moving the topic.

The question is what should I do after executing source build/envsetup.sh?
I didn’t understand why you said: “You didn’t lunch the corret target. You lunched ‘aosp_arm’

I’ve just followed this.

Did you get error when you compile your source code?

I said that because you got error when you compile your source code

build/core/base_rules.mk:183: *** hardware/libhardware/modules/gralloc: MODULE.TARGET.SHARED_LIBRARIES.gralloc.default already defined by hardware/amlogic/gralloc.
make: *** [out/build-aosp_arm.ninja] Error 1
terry@Server:~/project/vim/nougat$

Yes but it seems that I don’t execute the right commands to compile the source.

What commands do I have to execute if it’s not the ones bellow?

$ cd WORKING_DIRECTORY/uboot
$ make CROSS_COMPILE=aarch64-linux-gnu- kvim_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-
$ cd ..
$ source build/envsetup.sh
$ lunch kvim-user-64
$ make -j8 otapackage

That’s right. What’s the error informations?

Here it is:

  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/ted/Desktop/android-nougat-vim/WORKING_DIRECTORY/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.mod.o
  LD [M]  /home/ted/Desktop/android-nougat-vim/WORKING_DIRECTORY/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.ko
make[1]: Leaving directory `/home/ted/Desktop/android-nougat-vim/WORKING_DIRECTORY/out/target/product/kvim/obj/KERNEL_OBJ'
cp /home/ted/Desktop/android-nougat-vim/WORKING_DIRECTORY/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.ko out/target/product/kvim/system/lib/
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (17:14 (mm:ss)) ####

Did you Install Extra Toolchains for Amlogic Platform?
Can you pay more attentions for Building Android Source Code?

Yes couple of times. Got this error right know.

build/core/base_rules.mk:183: *** hardware/libhardware/modules/gralloc: MODULE.TARGET.SHARED_LIBRARIES.gralloc.default already defined by hardware/amlogic/gralloc.
make: *** [out/build-aosp_arm.ninja] Error 1

Thank you for your help and your time. I’ll try to fix that by my own.

Did you fix this problem? I also have problem as you.

Building modules, stage 2.
MODPOST 1 modules
CC /home/user/Desktop/khadas/Nougat/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.mod.o
LD [M] /home/user/Desktop/khadas/Nougat/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.ko
make[1]: Leaving directory '/home/user/Desktop/khadas/Nougat/out/target/product/kvim/obj/KERNEL_OBJ’
cp /home/user/Desktop/khadas/Nougat/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.ko out/target/product/kvim/system/lib/
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target ‘ninja_wrapper’ failed
make: *** [ninja_wrapper] Error 1

make failed to build some targets (44:23 (mm:ss))

Yes I did. The problem was coming from the Jack compiler. It was taking too much RAM to compile the files.

Try to limit the RAM it’s using by doing the following before building:

export USE_CCACHE=1
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
prebuilts/sdk/tools/jack-admin kill-server
prebuilts/sdk/tools/jack-admin start-server

Replace the -Xmx4g by the memory you’d like to allocate depending on your current onboard memory.

For example -Xmx2g for 2gb of RAM.

1 Like