I wanted to build the android source code by using this documentation:
https://source.android.com/source/building-running.html
last step was: 'make -j16'
After a while the compilation is aborted with the following error message:
host C++: libart <= art/runtime/catch_block_stack_visitor.cc
host C++: libart <= art/runtime/catch_finder.cc
art/compiler/elf_stripper.cc:122:16: error: use of undeclared identifier 'ftruncate'
int result = ftruncate(file->Fd(), offset);
^
1 error generated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libart-compiler_intermediates/elf_stripper.o] Fehler 1
make: *** Warte auf noch nicht beendete Prozesse...
I have no idea.
Google did not help and I am really not into this topic, just wanted to do a little change to the android code (I have not changed anything yet).
My system is:
ubuntu 13.10
java 1.6.0_4
current android master branch
You could avoid this problem by adding
#include <unistd.h>
at the beginning of elf_stripper.cc
Related
The build environment is ubuntu 16.04 with latest gcc 5.4.0 and GNU Make 3.82. My target is an am335x custom board which can run android 4.4. I am going to support it for android 7.1.1.
The project is fetched from google android manifest tag android-7.1.1_r46 and the kernel is from msm tag android-7.1.1_r0.63. The cross compiler I am using is from prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin.
That is the environment information. I haven't installed the NDK or SDK yet because I saw the api level for android 7.1.1 is 25 while the newest NDK only support up to 24, so I get a bit confused what to do.
If I run the command: m -j8 uboot linux
The uboot compiles fine, but there are a lot of errors when compiling the linux kernel.
/media/yangjiel/disk2/android/kernel/arch/arm/mach-omap2/prm_common.c: In function 'omap_prcm_register_chain_handler':
/media/yangjiel/disk2/android/kernel/arch/arm/mach-omap2/prm_common.c:293:2: warning: passing argument 2 of 'irq_set_chained_handler' from incompatible pointer type [enabled by default]
error, forbidden warning: prm_common.c:293
make[2]: *** [arch/arm/mach-omap2/prm_common.o] Error 1
make[1]: *** [arch/arm/mach-omap2] Error 2
make[1]: *** Waiting for unfinished jobs....
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:141:13: error: 'KERN_BOOT_REASON' undeclared here (not in a function)
{ CTL_INT, KERN_BOOT_REASON, "boot_reason" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:13: error: 'NET_IPV6_ACCEPT_RA_PREFIX_ROUTE' undeclared here (not in a function)
{ CTL_INT, NET_IPV6_ACCEPT_RA_PREFIX_ROUTE, "accept_ra_prefix_route" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:2: error: initializer element is not constant
{ CTL_INT, NET_IPV6_ACCEPT_RA_PREFIX_ROUTE, "accept_ra_prefix_route" },
^
/media/yangjiel/disk2/android/kernel/kernel/sysctl_binary.c:528:2: error: (near initialization for 'bin_net_ipv6_conf_var_table[24].ctl_name')
make[2]: *** [kernel/sysctl_binary.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/media/yangjiel/disk2/android/kernel'
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/media/yangjiel/disk2/android'
If I drop the lines in that file which causing this error, the error above is resolved but I would get another
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c: In function 'subsys_cgroup_allow_attach':
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c:2138:37: error: invalid operands to binary != (have 'kuid_t' and 'kuid_t')
if (current != task && cred->euid != tcred->uid &&
^
/media/yangjiel/disk2/android/kernel/kernel/cgroup.c:2139:18: error: invalid operands to binary != (have 'kuid_t' and 'kuid_t')
cred->euid != tcred->suid)
^
make[2]: *** [kernel/cgroup.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC kernel/trace/power-traces.o
CC kernel/trace/rpm-traces.o
CC kernel/trace/trace_probe.o
LD kernel/trace/libftrace.o
LD kernel/trace/built-in.o
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/media/yangjiel/disk2/android/kernel'
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/media/yangjiel/disk2/android'
There are more errors behind.
I have googled around and most of the people say this is a tool chain problem. But I don't find a lot of instruction about how to install the tool chain properly especially for 7.1.1. There seems to be no tool chain needed for the android 4.4 kernel. I fetch the custom android 4.4 kernel and it compiles fine.
The problem above is because I downloaded a wrong version of Android kernel. What I downloaded is https://android.googlesource.com/kernel/msm/+/android-7.1.1_r0.63, and this is kernel v3.10.
Obviously this is not for Android 7.1.1 (which should be using kernel v4.4). So when I am trying to compile "old" kernel with the "new" cross compiler from the prebuilt, it generated whole bunch errors that the "old" compiler won't. I end up using the kernel from https://android.googlesource.com/kernel/common/+/upstream-linux-4.4.y upstream-linux-4.4.y branch, it is compatible with Android 7.0 to 7.1.2.
I have no idea why google name it as android-7.1.1_r0.63, but that definitely not for Android 7.1.1 to use. Hope nobody has the same problem as I did.
I was trying to build an Android kernel for my device (Moto G 2014 aka titan) and after I added a custom governor "Yankactive", I keep getting this error and I have no idea on how to fix this error.
Here is the error:
drivers/cpufreq/cpufreq_yankactive.c: In function 'cpufreq_yankactive_timer_resched':
drivers/cpufreq/cpufreq_yankactive.c:166:3: error: implicit declaration of function 'get_cpu_idle_time' [-Werror=implicit-function-declaration]
get_cpu_idle_time(smp_processor_id(),
^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:308: drivers/cpufreq/cpufreq_yankactive.o] Error 1
make[1]: *** [scripts/Makefile.build:443: drivers/cpufreq] Error 2
make: *** [Makefile:965: drivers] Error 2
Here is the source code file of the governor I used: http://hastebin.com/vefequzema.pl
Your governor call the get_cpu_idle_time() function which is not defined in the file you added.
Take a look at this commit
GitHub
I am trying to compile vlc-android from source acording to this manual. AndroidCompile
I'm getting this error:
CC src/smb_utils.lo
src/smb_utils.c:32:19: fatal error: iconv.h: No such file or directory
#include <iconv.h>
^
compilation terminated.
make[1]: *** [src/smb_utils.lo] Error 1
And at the end this:
checking for iconv... no, consider installing GNU libiconv
configure: error: iconv() not found
make: *** [.zvbi] Error 1
contribs: make failed
The weird thing is that it workied fine yesterday.
Im using Linux Mint 17.2
Found the solution (workaround actually).
Problem is that android patch for iconv (contrib/src/iconv/libiconv-android-ios.patch) fails to apply. It is already applied in iconv version 1.14
Temporary workaround is to comment out patch applying for android. It is on line 26 of contrib/src/iconv/rules.mak
While building Android (OmniRom, based on 5.1) I've got this:
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_InputQueue.cpp
frameworks/base/core/jni/android_view_Surface.cpp: In function 'void android::nativeSetDirtyRect(JNIEnv*, jclass, jlong, jobject)':
frameworks/base/core/jni/android_view_Surface.cpp:211:14: error: 'class android::Surface' has no member named 'setDirtyRect'
surface->setDirtyRect(&rect);
^
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_KeyEvent.cpp
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_KeyCharacterMap.cpp
make: *** [/home/ice552/omni/out/target/product/find7op/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/android_view_Surface.o] Ошибка 1
make: *** Ожидание завершения заданий...
How to fix this?
Building 5.1 for CAF devices is not yet possible.
You also need to use branch android-5.1-caf for av and native repos
You need to apply these two patches to frameworks/native: http://review.cyanogenmod.org/#/c/62472/2 https://gerrit.omnirom.org/#/c/11061/1/
Recovery will also throw an error, so you need to add graphics from 5.0.
I've been trying to use LibVLC for Android and I followed the instructions at https://wiki.videolan.org/AndroidCompile and got it to work perfectly for ARM. However, when trying to compile it to x86, I set:
export ANDROID_ABI=x86
and then compiled in the same way, but now I have a problem as it fails to compile. Here's a truncated build log:
~/vlc-android$ sh compile.sh
VLC source found
Building tools
You are ready to build VLC and its contribs
Building the contribs
Generating EGL pkg-config file
Generating GLESv2 pkg-config file
Guessing build system... x86_64-linux-gnu
Creating configuration file... config.mak
Bootstrap completed.
...
config.status: executing libtool commands
Type "make; make install" to compile and install Speex
cd speexdsp && make install
make[1]: Entering directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp'
Making install in libspeexdsp
make[2]: Entering directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp'
CC resample.lo
In file included from resample.c:104:0:
resample_neon.h:142:21: error: redefinition of 'inner_product_single'
static inline float inner_product_single(const float *a, const float *b, unsigned int len)
^
In file included from resample.c:100:0:
resample_sse.h:40:21: note: previous definition of 'inner_product_single' was here
static inline float inner_product_single(const float *a, const float *b, unsigned int len)
^
make[2]: *** [resample.lo] Error 1
make[2]: Leaving directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp'
make: *** [.speexdsp] Error 2
As far as I can tell, in that project for some reason both the ARM headers and the SSE headers are being included, causing a redefinition error. However, I don't know why or what to try to fix it. Any suggestions would be much appreciated.
Autoconf doesn't look quite right, x86 build has nothing to do with NEON instruction set hence should not include resample_neon.h. I haven't found the root cause yet but for a quick solution, open resample.c under ../vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp and delete the following lines:
...
#ifdef _USE_NEON
#include "resample_neon.h"
#endif
...
then rerun the compile.sh, you should get a working apk for your x86 emulator/device.