android kernel source code compilation error - android

I need to customize the kernel of android to run on my Nexus S.
So I download the kernel with branch name "remotes/origin/android-samsung-2.6.35-gingerbread"
I tried to follow the instruction here http://source.android.com/source/building-kernels.html to build the kernel. To do this, I need the cross compile tool.In my target android source code version android-2.3.5_r1, there is no such tool(no prebuilts/ folder). So I downloaded the version 4.1.2 and set up the tool as path prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin .
Then I tried to build my kernel, but I got the following error:
[root#localhost samsung]# make
scripts/kconfig/conf -s arch/arm/Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/gpu/pvr/osfunc.o
In file included from drivers/gpu/pvr/osfunc.c:39:0:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: error: variable 'c' set but not used [-Werror=unused-but-set-variable]
drivers/gpu/pvr/osfunc.c: In function 'OSAccessOK':
drivers/gpu/pvr/osfunc.c:2144:13: error: variable 'linuxType' set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[3]: *** [drivers/gpu/pvr/osfunc.o] Error 1
make[2]: *** [drivers/gpu/pvr] Error 2
make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2
Should I just disable the "all warnings being treated as errors" to solve it? Or maybe I need a better toolchain?
PS: The tool chain of the master branch and branch 4.2 can not be used by me. Because it looks like they are made for a 64-bit OS while my linux is 32-bit

Do you have the path of ARCH=ARM and TOOLCHAIN pointing to the toolchain in \prebuilts folder?
make ARCH=ARM TOOLCHAIN=\<homeofAOSP>\prebuilt\.. herring_defconfig
make clean before you do the make

Related

Cross-compiling GLibC 2.24 fails with Error 1

I am trying to cross-compile GLibC 2.24 for ARM (Android) with the gcc-arm-linux-androideabi compiler. Here is the ./configure syntax I used:
../glibc-2.24/configure --prefix=/usr --host=arm-linux-androideabi --with-headers=/usr/include
However, when I run make, it fails with the following error:
In file included from
../sysdeps/arm/libc-tls.c:19:0:
../csu/libc-tls.c: In function '__libc_setup_tls':
../csu/libc-tls.c:191:1: error: '__ARM_NR_set_tls' undeclared (first use in this function)
../csu/libc-tls.c:191:1: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [/home/red/glibc-build/csu/libc-tls.o] Error 1
make[2]: Leaving directory `/home/red/glibc-2.24/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/home/red/glibc-2.24'
make: *** [all] Error 2
I browsed the web on why it happened, didn't find anything. What could be the cause of this error?
I am running Ubuntu 14.04.5 LTS 64-bit.
I am running Ubuntu 14.04.5 LTS 64-bit.
That is a meaningless statepement. 64-bit what? Is it sparc64, aarch64, x86_64, something else?
Most likely you are using x86_64. In that case, you are using configure all wrong. The --host=arm-linux-androideabi tells configure that you are building on an ARM linux machine, which couldn't be further from the truth.
What you likely mean is that you want to build for arm-linux-androideabi target, and in that case the correct configure command is something like:
configure --target=arm-linux-androideabi --prefix=/usr ...
Your --with-headers setting is also very likely to be incorrect: you almost certainly don't want to use /usr/include from x86_64 host to build for arm target.

SeAndroid Make - Compile Error‏ system/core/init/init.c: In function 'service_start'

I'm having compiling error while trying to build the SeAndroid 4.2 project.
I'm using Ubuntu 12.04 and gcc4.4
I followed the tutorial on SeAndroid Wiki and downloaded the whole source and after I tried to build a kernel.
seandroid-tegra3-grouper-3.1-jb-mr1.1 because I'm using a Asus TF700T device (with tegra chipset).
As mentioned on SeAndroid wiki page, I type
export PREFIX=/path/to/my/aospclone
cd $PREFIX/kernel/tegra
git checkout seandroid-tegra3-grouper-3.1-jb-mr1.1
make ARCH=arm tegra3_android_defconfig
make ARCH=arm CROSS_COMPILE=$PREFIX/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
The build completes correctly.
Then I'm trying to build my seandroid like :
cd $PREFIX
source build/envsetup.sh
lunch full_grouper-userdebug
make -j8
Then after 20 or 30 minutes of compiling, I got an error
...
system/core/init/init.c: In function 'service_start':
system/core/init/init.c:283:80: error: 'scon' undeclared (first use in this function)
system/core/init/init.c:283:80: note: each undeclared identifier is reported only once for each function it appears in
make: *** [out/target/product/generic/obj/EXECUTABLES/init_intermediates/init.o] Error 1
make: *** Waiting for unfinished jobs....
...
What could be the problem? I tried searching but couldn't find anything useful.

'elf.h' file not found error when compiling Android kernel for Nexus 7 on Mac OS X

When compiling Android kernel for Nexus 7 on Mountain Lion 10.8.4 I ran into fatal error: 'elf.h' file not found issue:
/Volumes/Android/WORKING_DIRECTORY/device/asus/grouper/tegra/
[derek#retina-mbp]$ make
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/arm/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
scripts/mod/mk_elfconfig.c:4:10: fatal error: 'elf.h' file not found
#include <elf.h>
^
1 error generated.
make[2]: *** [scripts/mod/mk_elfconfig] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
Does anyone know how to fix this so that the kernel compilation can continue?
I'm answering my own question because I found workaround for the missing elf.h file:
cd /Volumes/Android/WORKING_DIRECTORY/external/elfutils/libelf/
$ sudo cp -a elf.h /usr/include
With a copy of 'elf.h' file now in /usr/include the compilation goes on for a while, but then stops again with a different error:
arch/arm/mach-tegra/sleep.S: Assembler messages:
arch/arm/mach-tegra/sleep.S:240: Error: selected processor does not support ARM mode `smc #0'
make[1]: *** [arch/arm/mach-tegra/sleep.o] Error 1
make: *** [arch/arm/mach-tegra] Error 2
Not sure what to do about this last error though.
UPDATE: I gave up on trying to compile Android kernel directly under OS X. Instead, I installed 64-bit Ubuntu on VirtualBox and followed instructions found on this page:
http://forum.xda-developers.com/showthread.php?t=1774035
Except that as I said, I used VirtualBox and not VMWare Player as the above page suggested. It worked great and I didn't have any problems with networking and was able to ssh into Ubuntu to easily move compiled kernel back to OS X.
I also referred to this page to get the right kernel source for my device (grouper), prebuilt gcc and syntax for the make command (make tegra3_android_defconfig):
http://source.android.com/source/building-kernels.html
I hope this answer will save someone some time.
if you are still interested, check this out http://algobardo.github.io/2014/10/Android-Kernel-MacOsX/ and let me know if it is reproducible on your system with your android version.

Configuration error of the GMP library for the android platform

I'm trying to compile GMP for android (arm) but I'm received a very strange error. First, I set up a few things as described another SO question here:
export NDKROOT=/prod/ndk
$NDKROOT/build/tools/make-standalone-toolchain.sh --platform=android-9 -- install-dir=$NDKROOT/android_armeabi
export CC="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-gcc --sysroot=$NDKROOT/android_armeabi/sysroot"
export CXX="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-g++ --sysroot=$NDKROOT/android_armeabi/sysroot"
export AR="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-ar"
export SYSROOT="$NDKROOT/android_armeabi/sysroot"
export PATH="$NDKROOT/android_armeabi/bin":$PATH
Then I simply run ./configure --enable-cxx --prefix=/local/to/where/i/want/to/install --host=arm-none-linux-gnueabi and configuration goes well, with the following being part of the output:
Version: GNU MP 5.1.1
Host type: arm-none-linux-gnueabi
ABI: standard
Install prefix: /location/to/where/i/want/to/install
Compiler: /prod/ndk/android_armeabi/bin/arm-linux-androideabi-gcc -- sysroot=/prod/ndk/android_armeabi/sysroot -std=gnu99
Static libraries: yes
Shared libraries: yes
Up to here it goes well, but when I run make, I receive the following error:
ismpf.cc: In function 'std::istream& operator>>(std::istream&, mpf_ptr)':
ismpf.cc:48:43: error: 'struct lconv' has no member named 'decimal_point'
make[2]: *** [ismpf.lo] Error 1
make[2]: Leaving directory `~/Downloads/gmp-5.1.1/cxx'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `~/Downloads/gmp-5.1.1'
make: *** [all] Error 2
So my first problem is there. Any ideas?
Just out of curiosity, I tried to rerun the same exact configure command as above but using sudo ahead of it. After a few seconds I receive the following:
configure: error: Oops, mp_limb_t is 64 bits, but the assembler code
in this configuration expects 32 bits.
There is the second (and really weird problem that arises).
Just out of curiosity again, I tried to reboot and clear all the variables we created, and simply run the command that the GMP manual recommends:
./configure --prefix=/location/ --enable-cxx --host=arm-linux-androideabi
The ./configure runs, the make goes well, but all 9/9 tests fail when I do make check. Can anybody point me in the right direction with these errors, or about how to try and correctly compile GMP for android? Any help is immensely appreciated.
Unsetting the CFLAGS env var solved the problem for me.

Building Pocketsphinx On Android on Windows

I have been following this Building Pocketsphinx on android for days now and I am very confused what to do now. I will be telling what I have done step by step so you will know what I have done wrong.
I am using Windows 7 64-bit.
First of all I have downloaded PocketSphinx and Sphinxbase and I have unpack it in C:\Sphinx. Then I have downloaded mingw from MINGW DOWNLOAD only that. after I downloaded this stuffs, I started the mingw.exe and as a amateur I am, I tried sudo -i only and that did not do anything so I gone to the next instructions installing swig.
I tried typing apt-get install swig and yum install swig as the same as last time it did not work. Then I have tried mingw-get install swig and the result is mingw-get.exe: *** ERROR *** swig: unknown package. So with that I tried again the next intructions installation of sphinxbase.
In installing sphinxbase, I have gone to sphinxbase directory - C:\Sphinx\sphinxbase and I typed ./autogen.sh. So with that it compiled without problems and I typed ./configure It compiled good as well. the next is make this is where I got a problem, it compiled but it got errors. the error is:
make[3]: *** [pio.lo] Error 1
make[3]: Leaving directory `/c/sphinx/sphinxbase/src/libsphinxbase/util`
make[2]: *** [All-recursive] Error 1
make[2]: Leaving directory `/c/sphinx/sphinxbase/src/libsphinxbase`
make[1]: *** [All-recursive] Error 1
make[1]: Leaving directory `/c/sphinx/sphinxbase/src`
make: *** [all-recursive] Error 1
this is the problem I got until now. Then I have tried downloading pio.lo from pio.lo download. So it fix the error but another error appeared. Second Error:
collect2.exe: error: ld returned 1 exit status
make[2]: *** [sphinx_fe.exe] Error 1
make[2]: Leaving directory `/c/sphinx/sphinxbase/src/sphinx_fe`
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/sphinx/sphinxbase/src`
make: *** [all-recursive] Error 1
This is where I got stuck. I have tried copying sphinx_fe from sphinxbase-0.7-win32.zip after doing that nothing happens. The compilation would only delete the sphinx_fe.exe.
My question is What Should I do now?
If it is not clear feel free to comment and ask. Thank you for the help.
MinGW is not supported for now, try to use Cygwin instead.
Actually you don't need to run autogen.sh and make, it's enough to unpack sources
sudo, yum and other commands are Unix only commands, you need to search for their analog on windows.
For more information about SWIG on windows see
http://www.swig.org/Doc2.0/Android.html

Categories

Resources