Building kernel for Google Pixel 3 - Syntax error: "(" unexpected - Android Q&A, Help & Troubleshooting

Following theese instructions on the AOSP site "Building Kernels"
repo init -u android.googlesource.com/kernel/manifest -b android-msm-bluecross-4.9-pie-qpr1
repo sync
sh build/build.sh //This command throws an error.
sh build/build.sh
build/build.sh: 97: build/build.sh: Syntax error: "(" unexpected
This is line 97:
function rel_path() {
So it triggers on the parenthesis. Ive googled a little back and forth. And as far as I can tell - this error triggers because of missing shebang line. The document starts with a shebang line:
#!/bin/bash
Not sure whats wrong - Should I roll back to 18.04 or 14.04?
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic

michaelburrow189 said:
Following theese instructions on the AOSP site "Building Kernels"
repo init -u android.googlesource.com/kernel/manifest -b android-msm-bluecross-4.9-pie-qpr1
repo sync
sh build/build.sh //This command throws an error.
sh build/build.sh
build/build.sh: 97: build/build.sh: Syntax error: "(" unexpected
This is line 97:
function rel_path() {
So it triggers on the parenthesis. Ive googled a little back and forth. And as far as I can tell - this error triggers because of missing shebang line. The document starts with a shebang line:
#!/bin/bash
Not sure whats wrong - Should I roll back to 18.04 or 14.04?
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
Click to expand...
Click to collapse
Welcome to the wonderful world of missing android documentation! rel_path appears to be a deprecated function of realpath. This is all stackexchange knows about it, and the android developer website gives me nothing useful. The only suggested fix I found is to try installing realpath and coreutils again.
Run,
sudo apt-get install coreutils
sudo apt-get install realpath
Then try building again. If you still get an error at the parentheses, then try putting a space between rel_path() so it's rel_path (). If you still get an error after that, then I'm out of ideas. I sincerely wish you luck navigating the horrible mess that is android source code.

Spaceminer said:
Welcome to the wonderful world of missing android documentation! rel_path appears to be a deprecated function of realpath. This is all stackexchange knows about it, and the android developer website gives me nothing useful. The only suggested fix I found is to try installing realpath and coreutils again.
Run,
sudo apt-get install coreutils
sudo apt-get install realpath
Then try building again. If you still get an error at the parentheses, then try putting a space between rel_path() so it's rel_path (). If you still get an error after that, then I'm out of ideas. I sincerely wish you luck navigating the horrible mess that is android source code.
Click to expand...
Click to collapse
Code:
sudo apt-get install realpath
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package realpath is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
manpages-pl manpages-fr-extra
E: Package 'realpath' has no installation candidate
Code:
type -a realpath
realpath is /usr/bin/realpath
Installing manpages-pl and manpages-fr-ekstra did work though.
But it is throwing me the same parenthesis error as before. Thanks though! I thought building the clean kernel would work kind'a smooth.

Related

[REF][3/28] Compiling Jt1134's AOSP

I compiled this tonight and just have some info if others are interested in it.
Link to ROM thread: http://forum.xda-developers.com/showthread.php?p=12437432#post12437432
Dev machine: newest CentOS x64 on VMWare Workstation 7, about a day old
I already had Git installed, but if you're new to this you'll need it (and some dependencies):
Code:
yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel
wget http://kernel.org/pub/software/scm/git/git-1.7.4.2.tar.bz2
tar xvfj git-1.7.4.2.tar.bz2
cd git-1.7.4.2
make prefix=/usr/local all
make prefix=/usr/local install
Repo was a new tool to me, so it wasn't installed... If you don't have repo, download/install it using this set of commands:
Code:
curl http://android.git.kernel.org/repo > /usr/bin/repo
chmod a+x /usr/bin/repo
Now that you have repo you can download everything. Make a folder somewhere and cd there (mine is /phone/aosp), then:
Code:
repo init -u git://github.com/jt1134/platform_manifest.git -b froyo
This sets up the folder, but you need to download everything:
Code:
repo sync
Jt1134 had -j40 as a parameter, but this caused a Python error for me and does not appear necessary. This downloads an incredible amount of projects and takes quite a while (over an hour at ~500K/s). It's exciting, how much is involved.
The next two lines are very quick, but I had to install Bison ('yum install bison') first:
Code:
source build/envsetup.sh
lunch full_fascinate-eng
Then the final line to actually build the whole package:
Code:
make -j$(grep processor /proc/cpuinfo | wc -l) bacon && fixzip
From this point forward I'm walking through the errors I encountered and how I fixed them to get to completion:
It failed on first run and I had to install glibc-devel because a 32 bit header file stubs-32.h was missing ('yum install glibc-devel').
It failed on the second run because I did not have 'flex' installed. ('yum install flex').
Third time looked good, compiled a ton of stuff, then bombed because 'libsecril-client.so' was missing. Exact error:
Code:
/phone/aosp/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld:
warning: libsecril-client.so, needed by out/target/product/fascinate/obj/lib/libsecgps.so, not found (try using -rpath or -rpath-link)
It was however found in two places:
Code:
/phone/aosp/vendor/samsung/vzwtab/proprietary/lib/libsecril-client.so
/phone/aosp/vendor/samsung/fascinate/proprietary/lib/libsecril-client.so
So what I did is copy it to the output folder (not the optimal solution I'm sure, but it worked):
Code:
cp vendor/samsung/fascinate/proprietary/lib/libsecril-client.so out/target/product/fascinate/obj/lib/
Fourth time through it continued on an compiled a ton of projects, and then... 'gperf' command not found. ('yum install gperf')
Fifth time, I actually went to sleep during this one , woke up to this error:
Code:
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
I fixed this with 'yum install ncurses-devel' and let the process continue, and shortly afterwards got another error:
Code:
In file included from external/qemu/android/skin/window.c:19:
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55:22: error: X11/Xlib.h: No such file or directory
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:56:23: error: X11/Xatom.h: No such file or directory
I fixed this with 'yum install libX11-devel' and off we go again... a new error!:
Code:
/usr/bin/ld: cannot find -lhistory
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/sqlite3_intermediates/sqlite3] Error 1
This was fixed by running 'yum install readline-devel' and we're back to a lot more compiling...
Success!! full_fascinate.zip is in the root folder, ready to be moved to the phone.
Hope someone might find this helpful or interesting... let me know if there's anything I can do to make it better!
What dev environment do you guys use to edit these files?
Do you just keep recompiling them and running the rom using the SDK virtual phone?
I'm an experienced developer but I am only familiar with windows development but want to get into some apps development soon.
Eclipse is rather popular.
Sent from my SCH-I500 using XDA App
I'm using Eclipse, run them on the phone for testing, and haven't done much yet.
Would other developers be willing to chime in with their advice/preferences on the whole process? Thanks!
-j40 is only to parallelize the tasks (up to 40 threads I believe) so it's not strictly necessary.
By the way, all the dependencies to build android should be on here: http://source.android.com/source/download.html
And @SmokeyDP, you don't need to build your own version of the OS to write apps, so these instructions aren't really relevant for that if that's all you want to do. Eclipse is probably the most common IDE for Android app development because that's what Google supports directly, but I've heard that IntelliJ IDEA also has nice Android support and just lacks a GUI builder. I've recently switched to IDEA for other Java development and it's a lot faster and more refined than eclipse, so I would suggest trying that if you're going to start learning because you won't be used to either eclipse or IDEA and can choose which one seems the best to you.
I realize you don't need to rebuild the OS to develop an app, but I was asking about developing both since I imagine it's the same IDE and I was curious. Thanks for the info.
SmokeyDP said:
I realize you don't need to rebuild the OS to develop an app, but I was asking about developing both since I imagine it's the same IDE and I was curious. Thanks for the info.
Click to expand...
Click to collapse
Unless you're going to be using the NDK to write apps, you're not going to be using C, which is what the Linux Kernel is written in... and Eclipse's support for C is a lot poorer than its support for Java (honestly, I can't stand its support for either, its interface is quite the unorganized mess, IMO). I, personally, use a different set of tools for each language/toolkit I use, as each have their pros and cons.

[Q] Need a little help with "downloading the source"<SOLVED>

So I have been working all day to get Ubuntu 11.10, Dual-boot on my Laptop. It runs smoothly, I have bee following the instructions from; Initializing a Build Enviroment, From the source.android.com Website. I am trying to get everything I need to be able to develop ROMS. Well I guess that is obvious. I have hit a road block I have tried figuring out for the past 2 hours and I am stumped. my knowledge is moderate on Linux so fair warning if you end up face palming.
I am onto the Downloading the Source tree, and I run into this error:
repo init -u https://andriod.googlesource.com/platform/manifest
No command 'repo' found, did you mean:
Command 'rep' from package 'rep' (universe)
Command 'repl' from package 'nmh' (universe)
Command 'repl' from package 'mailutils-mh' (universe)
repo: command not found
Click to expand...
Click to collapse
can someone point me in the right direction here. All help appreciated.
SOLVED!!!!
After posting I decided to keep tinkering, I found this workaround Here, I only had to do this to install repo instead:
curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo
chmod a+x ~/bin/repo
PATH=~/bin:$PATH
Click to expand...
Click to collapse
After that you should see it full run and download a bunch of stuff and BAM! there you go. Any questions PM me. Thread closed.

Guide on how I build my own CM10 test builts

This is a follow up on my "old" "Guide on how I build my own CM9 test builts" thread.
Guide how I build CM10 for my Mango.
For the first time you try to build CM10.
Create ~/bin and download repo to that directory. Afterwards set executable bit to make it possible to ”execute”.
Code:
mkdir -p ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now reboot the computer.
Create ~/android/system and initialize the repository.
Code:
mkdir -p ~/android/system
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
Unpack the attached local_manifest.xml.bz2 and place local_manifest.xml into ~/android/system/.repo
Synchronise towards the current git repositories.
Code:
repo sync
Setup the environmental settings and initialize the Mango build.
Code:
. build/envsetup.sh
breakfast mango
Initialize the Mango build.
Code:
cd ~/android/system/device/semc/mango/
./setup-makefiles.sh
Download the prebuilts
Code:
~/android/system/vendor/cm/get-prebuilts
Check for new changes
Code:
cd ~/android/system/
repo sync
Setup the environment again and build the ROM (takes long time)
Code:
. build/envsetup.sh
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-10-DATE-UNOFFICIAL-mango.zip
The next times you try to build it, you only need to do the following.
Delete build.prop, if not will build.prop not get generated.
Code:
rm -f ~/android/system/out/target/product/mango/system/build.prop
Syncronise the git repositories.
Code:
cd ~/android/system/
repo sync
Setup the environmental settings.
Code:
. build/envsetup.sh
Configure/build.
Code:
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-10-DATE-UNOFFICIAL-mango.zip
EDIT (August 14. 2012): If the boot.img is not booting, is it most likely due to the bootloader bug.
To make it "work", do the following (replace mango with your own device)
Code:
cd out/target/product/mango/
rm -f ./boot.img ./combinedroot.cpio ./combinedroot.fs ./ramdisk.img
cp ./root/logo.rle ./root/waste_of_space1
cp ./root/logo.rle ./root/waste_of_space2
cp ./combinedroot/logo.rle ./combinedroot/waste_of_space1
cp ./combinedroot/logo.rle ./combinedroot/waste_of_space2
cd ../../../..
brunch mango
just a technical: is it really necessary to reboot the computer after downloading the repo binary? and if so, why is that??
bokrug said:
just a technical: is it really necessary to reboot the computer after downloading the repo binary? and if so, why is that??
Click to expand...
Click to collapse
It is only necessary on some Linux distributions, where you will not be able to execute anything from that directory, before a reboot. You can try to see if you can do it without. If it is working, do you not need it.
hnl_dk said:
It is only necessary on some Linux distributions, where you will not be able to execute anything from that directory, before a reboot. You can try to see if you can do it without. If it is working, do you not need it.
Click to expand...
Click to collapse
There's no really need to reboot - edit .bashrc in your home directory and add
Code:
export PATH=~/bin/:$PATH
Save, then run:
Code:
source ~/.bashrc
It have to work on all distros
pikpok said:
There's no really need to reboot - edit .bashrc in your home directory and add
Code:
export PATH=~/bin/:$PATH
Save, then run:
Code:
source ~/.bashrc
It have to work on all distros
Click to expand...
Click to collapse
I just want to show the "universal" way.
Not everyone is using bash
hnl_dk said:
I just want to show the "universal" way.
Not everyone is using bash
Click to expand...
Click to collapse
If someone use another shell, e.g. zsh, then he'll know what files he have to edit IMO rebooting is wasting time.
pikpok said:
If someone use another shell, e.g. zsh, then he'll know what files he have to edit IMO rebooting is wasting time.
Click to expand...
Click to collapse
no it is not, as you do not need to edit any files. It will work automatically.
It is as much a waste of time to edit the resource-definition scripts.
hnl_dk said:
no it is not, as you do not need to edit any files. It will work automatically.
It is as much a waste of time to edit the resource-definition scripts.
Click to expand...
Click to collapse
Reboot - about 1 min
Edit one file and paste single command in terminal - for me it's 10secs
But it comes to offtop discussion, so it would be better to end it now
@edit - now when I think about it... bin in home folder won't be added to PATH automatically, at least in Arch Linux. Maybe Ubuntu is more "intelligent" :laugh:
pikpok said:
Reboot - about 1 min
Edit one file and paste single command in terminal - for me it's 10secs
But it comes to offtop discussion, so it would be better to end it now
@edit - now when I think about it... bin in home folder won't be added to PATH automatically, at least in Arch Linux. Maybe Ubuntu is more "intelligent" :laugh:
Click to expand...
Click to collapse
It does not take that long for me to make a reboot
No matter what, is it always good to have more methods to make something work.
It did the last time I tried Arch Linux... and no I am not using Ubuntu (too flashy for me )
Assuming that there is an entry in your ~/.profile that adds ~/bin to PATH, a reboot won't do anything that logout/login wouldn't. Furthermore, logout/login (in this case) won't do anything that sourcing ~/.profile wouldn't. So, simply issuing "source ~/.profile" is sufficient on most distributions. If you are using a distribution or a shell that doesn't do this by default, then you probably already know what you need to do.
I do, however, commend hnl_dk's efforts to make things simpler for newcomers to Android and Linux, even if it's not the the "fastest" or the "best" way. Whenever you start getting into one of those "what if?" arguments, things tend to spiral out of control. Sometimes it's better to just make a few assumptions and go with what is most likely to work.
A reboot might be a bit of an overkill, though. :laugh:
Can't run 64-bit prebuilts on my 32-bit Linux
I have a 32-bit Linux box so get the errors:
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: cannot execute binary file
Had a quick look around, but are there gcc etc. prebuilts for 32-bit Linux boxes?
TIA,
AK-A
ak-a said:
I have a 32-bit Linux box so get the errors:
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: cannot execute binary file
Had a quick look around, but are there gcc etc. prebuilts for 32-bit Linux boxes?
TIA,
AK-A
Click to expand...
Click to collapse
Did you try to build it as described?
It is working fine on my 32bit debian machine.
If not, please describe hos you try it build it.
hnl_dk said:
Did you try to build it as described?
It is working fine on my 32bit debian machine.
If not, please describe hos you try it build it.
Click to expand...
Click to collapse
Yeah, followed the instructions as per the first post. Will re-try and see if I missed/messed something and report back.
Hey !!! Do you think I should post my AOSP errors in this thread...so that its easier for us to keep track..?? :highfive:
As this is a Tutorial Thread for "how to build cm10 on your own" I don't think it makes sense posting errormessages of errm. "android open source project"? As I am writing this I recognize that I do not really understand what you mean.
CosmoDroid said:
Hey !!! Do you think I should post my AOSP errors in this thread...so that its easier for us to keep track..?? :highfive:
Click to expand...
Click to collapse
Like Snoopo is saying, should that be in this thread. Compiling AOSP is not as "user friendly" as CM, as our devices are officially supported by CM and not AOSP.
If you want, can you make a new thread about compiling "AOSP - Jelly bean".
i always stop at "repo sync"
i always stop at "repo sync"
and it always tell me
"Fetching projects: 21% (66/313) fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=??????"
can you help me
thanks
shufuking said:
i always stop at "repo sync"
and it always tell me
"Fetching projects: 21% (66/313) fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=??????"
can you help me
thanks
Click to expand...
Click to collapse
Same also happens for me, then I try again and again and again and then it is working.
Lots of people are accessing github, and there is only a limited "whole" for the data to get through.
hnl_dk said:
Same also happens for me, then I try again and again and again and then it is working.
Lots of people are accessing github, and there is only a limited "whole" for the data to get through.
Click to expand...
Click to collapse
thanks for your suggestion
finally i make it.
another question.
when i perform " brunch smultron"
i got lots of "cannot execute binary file"
and final "make: *** [out/target/product/smultron/obj/lib/crtbegin_static.o] Error 126"
do you know what it means?
shufuking said:
thanks for your suggestion
finally i make it.
another question.
when i perform " brunch smultron"
i got lots of "cannot execute binary file"
and final "make: *** [out/target/product/smultron/obj/lib/crtbegin_static.o] Error 126"
do you know what it means?
Click to expand...
Click to collapse
without more details, my best guess is that you may be building it on a FAT32 or NTFS partition?
then there is a good chance that linux is not able to read the executable bits.

[HOWTO] Compile Roms for the X+ in a nut shell

Ok guys i'm doing this as there's only two AOSP dev's (AOSP\CM\AOKP\PA) also i want to help get more people into developing.
This tutorial covers BOTH the AT&T and the International
This tutorial assumes you WONT be using a virtual machine but Linux installed onto your hard drive.
Prerequisites:
Able to read
Able to think
Not wanting your hand to be held
Able to use Linux
Ubuntu 10.04 > 12.04 (one of those)
AT LEAST 80gb free on your hard drive
Time
Patience
fastish internet
coffee (or tea or beer)
Computer Specs MINIMUM Dual core cpu and 4gb of ram and a ubuntu based OS 64bit
So your ready and read everything above lets get the show on the road.
if you are using ubuntu 10.04 to 11.10, you will need these files:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc openjdk6-jdk
end of 10.04 > 11.10 section
if you are using Ubuntu 12.04 > you will need these files:
Code:
sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 openjdk-7-jdk
and then run this command:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
if you get any errors showing up simply remove the offending package it's moaning about and install it manually later, i wont hold your hand with this.
end of 12.04 > section
now you have all those packages you want to grab the android source, for this tutorial i'll be using CM10.1 (4.2.2)
1st you will need to grab repo:
you need to make this folder for it to go into
mkdir ~/bin
PATH=~/bin:$PATH this is to tell linux where the bin folder is (in a nutshell)
now to Download the Repo script and ensure it is executable:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
ok that's that part done, now to grabbing the source and so on:
1st you need to make a folder to dump the source in, my folder layout is like this ~/Android/AOSP422 or ~/Android/CM10.1
but you can do it however you want
so for the benefits of this tutorial i'll be using ~/Android/CM10.1
mkdir ~/Android/CM10.1
cd ~/Android/CM10.1
thats the folder created and you have cd'd into it now to grab the source
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
this is telling repo where the source is and what BRANCH to pull so we are pulling cm-10.1
once all that is done do the next command
repo sync -j# (the # = number of cores + 1) so on my i5 it only has 4cores so it's -j5 (but you can do a little bigger on a repo sync i tend to do a -j16 on my i5 for repo)
now go grab a coffee this can take a little while.
once all that is done and dusted you'll be wanting to start building, hold your horses you still need the device specific stuff, so make sure you are in the root of the CM.10.1 Directory, then type the following command:
for the AT&T X+ it's
AT&T will be updated in the near future. Please don't ask for it right now.
for the International X+ it's
git clone https://github.com/HoxPlusCMOfficial/android_device_htc_enrc2b -b cm-10.1 device/htc/enrc2b
git clone https://github.com/HoxPlusCMOfficial/android_vendor_htc_enrc2b -b master vendor/htc/enrc2b
git clone https://github.com/HoxPlusCMOfficial/android_kernel_htc_enrc2b -b master kernel/htc/enrc2b
git clone https://github.com/HoxPlusCMOfficial/android_device_htc_tegra3-common.git -b cm-10.1 device/htc/tegra3-common
that will grab down my CM10.1 device specific source
once that's downloaded
Get the CM prebuilts by doing the following:
cd vendor/cm/
./get-prebuilts
then cd back to the root dir
then the following commands to get the build going
. build/envsetup.sh
brunch evitareul or enrc2b depending on which device your building for.
and the build will get started, this can take anywhere from 4hrs > 30minutes
once it's all finished it will tell you where your zip file has poped out.
enjoy and don't forget if you used this tutorial link back to it in your rom op.
recommended reading:
http://source.android.com/source/initializing.html
and
http://wiki.cyanogenmod.org/w/Development
-Lloir
reserved just in case (might use this one for kernel building)
Might just try this for ****s and giggles
Sent from my HTC One X using Tapatalk 2
Hey Lloir, I'll be reading for years, but can you point me to the link on the cyanogenmod site or wherever, that explains why I did (repo sync -j#) and what exactly it did please, and thank you.
Edit: Found the info I was looking for, sorry, had some many tabs open, I didn't think to google.
Is it possible to setup in a virtual machine? If so what's needs to be done different? Thanks.
yes it is, you would need AT LEAST a quad core + 8gb of ram (2cores and 4gb for the virtual machine)
Good, simple guide
I think there might be a step missing before brunch:
Code:
cd vendor/cm
./get-prebuilts
...because the first time I ran brunch enrc2b I got this error:
Code:
make: *** No rule to make target `vendor/cm/proprietary/Term.apk', needed by `/android/cm-10.1/out/target/product/enrc2b/system/app/Term.apk'. Stop.
make: *** Waiting for unfinished jobs....
Woops my bad, thanks for pointing it out
Sent from my HTC One X+ using Tapatalk 2
Also, I needed to install lib32ncurses5-dev (sudo apt-get install lib32ncurses5-dev) on Ubuntu 12.04 amd64 to avoid the following errors when doing 'make menuconfig' for the kernel:
Code:
cripts/kconfig/mconf.o: In function `show_help':
mconf.c:(.text+0x744): undefined reference to `stdscr'
scripts/kconfig/mconf.o: In function `main':
mconf.c:(.text.startup+0x66): undefined reference to `initscr'
mconf.c:(.text.startup+0x6d): undefined reference to `stdscr'
scripts/kconfig/lxdialog/checklist.o: In function `print_arrows':
checklist.c:(.text+0x41): undefined reference to `wmove'
checklist.c:(.text+0x61): undefined reference to `acs_map'
checklist.c:(.text+0x69): undefined reference to `waddch'
checklist.c:(.text+0x7b): undefined reference to `waddnstr'
checklist.c:(.text+0x8c): undefined reference to `wmove'
checklist.c:(.text+0xb3): undefined reference to `acs_map'
checklist.c:(.text+0xbb): undefined reference to `waddch'
checklist.c:(.text+0x10b): undefined reference to `acs_map'
I don't think that compiling your own kernel is necessary, and it's not part of Lloir's instructions, but I thought I'd post this here because I imagine that people who are interested in compiling Cyanogenmod might also be interested in compiling a kernel for it as well.
Hey Lloir when I get to the git clone command I get an error fatal: could not create leading directories of '/device/htc/evitareul': Permission denied. When I googled it I found this:
The fix for this error: “fatal: could not create leading directories of '…': Permission denied” was much different than what I thought it would be. I'd think if permission was denied, it would be caused by folder or file mode. Not the case!
But let me take a step back and explain how I encountered this error. It was getting generated during a deployed using vlad. Thankfully the error report included the command that vlad was trying to execute. I tried running it manually and received the same response, so I broke it up into its pieces, then tried running them on the remote target. That revealed it was actually an ssh-key problem.
Wow! I'm surprised that the explanation was so far off the mark.
Anyway, all it took was to login to the remote target, ssh to the git origin remote server, accept the key, and away I went. Whee…
I'm going to play with it, but any pointers would be good. Using 12.04
EDIT: Is your git link dead?
n1gh7m4r3 said:
Hey Lloir when I get to the git clone command I get an error fatal: could not create leading directories of '/device/htc/evitareul': Permission denied. When I googled it I found this:
The fix for this error: “fatal: could not create leading directories of '…': Permission denied” was much different than what I thought it would be. I'd think if permission was denied, it would be caused by folder or file mode. Not the case!
But let me take a step back and explain how I encountered this error. It was getting generated during a deployed using vlad. Thankfully the error report included the command that vlad was trying to execute. I tried running it manually and received the same response, so I broke it up into its pieces, then tried running them on the remote target. That revealed it was actually an ssh-key problem.
Wow! I'm surprised that the explanation was so far off the mark.
Anyway, all it took was to login to the remote target, ssh to the git origin remote server, accept the key, and away I went. Whee…
I'm going to play with it, but any pointers would be good. Using 12.04
Click to expand...
Click to collapse
i typo'd don't do the /device just do device/ , or you could just cd into device mkdir htc cd into htc then git clone into there
BTW I'm glad many of you can read this tutorial, i'am awful at doing instructions for other people...if anyone has opinions on the way it's written please PM or re-write it and PM me and i'll replace the current one with a friendlier version.
-Lloir
Anyone know how to fix these errors:
Code:
Install: /android/cm-10.1/out/target/product/enrc2b/system/bin/dhcpcd
Install: /android/cm-10.1/out/target/product/enrc2b/system/bin/keystore
Install: /android/cm-10.1/out/target/product/enrc2b/system/bin/make_ext4fs
Install: /android/cm-10.1/out/target/product/enrc2b/system/bin/netcfg
target Executable: netd (/android/cm-10.1/out/target/product/enrc2b/obj/EXECUTABLES/netd_intermediates/LINKED/netd)
target Executable: vold (/android/cm-10.1/out/target/product/enrc2b/obj/EXECUTABLES/vold_intermediates/LINKED/vold)
target SharedLib: libpixelflinger (/android/cm-10.1/out/target/product/enrc2b/obj/SHARED_LIBRARIES/libpixelflinger_intermediates/LINKED/lib
pixelflinger.so)
/android/cm-10.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-li
nux-androideabi/bin/ld: /android/cm-10.1/out/target/product/enrc2b/obj/STATIC_LIBRARIES/libbt-brcm_bta_intermediates/libbt-brcm_bta.a(bta_a
g_sco.o): in function bta_ag_create_sco:external/bluetooth/bluedroid/bta/./ag/bta_ag_sco.c:538: error: undefined reference to 'BTM_SetWBSCo
dec'
/android/cm-10.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-li
nux-androideabi/bin/ld: /android/cm-10.1/out/target/product/enrc2b/obj/STATIC_LIBRARIES/libbt-brcm_bta_intermediates/libbt-brcm_bta.a(bta_a
g_sco.o): in function bta_ag_create_sco:external/bluetooth/bluedroid/bta/./ag/bta_ag_sco.c:542: error: undefined reference to 'BTM_ConfigI2
SPCM'
/android/cm-10.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-li
nux-androideabi/bin/ld: /android/cm-10.1/out/target/product/enrc2b/obj/STATIC_LIBRARIES/libbt-brcm_bta_intermediates/libbt-brcm_bta.a(bta_a
g_sco.o): in function bta_ag_sco_disc_cback:external/bluetooth/bluedroid/bta/./ag/bta_ag_sco.c:218: error: undefined reference to 'BTM_SetW
BSCodec'
/android/cm-10.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-li
nux-androideabi/bin/ld: /android/cm-10.1/out/target/product/enrc2b/obj/STATIC_LIBRARIES/libbt-brcm_bta_intermediates/libbt-brcm_bta.a(bta_a
g_sco.o): in function bta_ag_sco_conn_rsp:external/bluetooth/bluedroid/bta/./ag/bta_ag_sco.c:1529: error: undefined reference to 'BTM_Confi
gI2SPCM'
collect2: ld returned 1 exit status
make: *** [/android/cm-10.1/out/target/product/enrc2b/obj/SHARED_LIBRARIES/bluetooth.default_intermediates/LINKED/bluetooth.default.so] Err
or 1
make: *** Waiting for unfinished jobs....
Note: I didn't make the libGL.so symlink at first, but I have now and I've gone back and run brunch enrc2b again and I still get the same error.
woops i forgot all about that, the fix is'nt merged into CM yet
do the following
cd external/bluetooth/
rm -rf bluedroid
git clone https://github.com/maxwen/bluedroid.git
wait for that to download and then cd back into the root dir
(this will be needed for both devices when building)
n1gh7m4r3 said:
EDIT: Is your git link dead?
Click to expand...
Click to collapse
no....it's working, i just cloned from it to check to see if it was working
Code:
Package Complete: /android/cm-10.1/out/target/product/enrc2b/cm-10.1-20130313-UNOFFICIAL-enrc2b.zip
frankoid said:
Code:
Package Complete: /android/cm-10.1/out/target/product/enrc2b/cm-10.1-20130313-UNOFFICIAL-enrc2b.zip
Click to expand...
Click to collapse
grats :good:
Lloir said:
BTW I'm glad many of you can read this tutorial, i'am awful at doing instructions for other people...if anyone has opinions on the way it's written please PM or re-write it and PM me and i'll replace the current one with a friendlier version.
Click to expand...
Click to collapse
I personally found it very useful. I've built CM before for other devices, but I didn't realise how easy it was to build it using an unofficial device tree - I didn't know it was simply a case of dropping the device tree into devices/.
frankoid said:
I personally found it very useful. I've built CM before for other devices, but I didn't realise how easy it was to build it using an unofficial device tree - I didn't know it was simply a case of dropping the device tree into devices/.
Click to expand...
Click to collapse
my device tree is a very lazy tree, it's supposed to have a vendor tree, but i've slammed it all into one.
These instructions pretty much cover any ROM, except for where you grab the source from..
Sent from my HTC One X+ using Tapatalk 2
the ATT git clone command should be: git clone https://bitbucket.org/Lloir/android_device_htc_evitareul.git and not: git clone https://[email protected]/Lloir/an..._evitareul.git -b CM10.1
I believe this is/was my problem.
EDIT: or perhaps git clone https://bitbucket.org/Lloir/android_device_htc_evitareul.git -b CM10.1
EDIT2: It isn't showing correctly in the thread. replace the ... with device, and it should work.

[GUIDE] How to Setup Ubuntu 16.04 LTS Xenial Xerus for Compiling Android ROMs

--- reprinted with permission from nathanpfry.com ---
--- If you would rather use a ready-to-go Virtual Machine based on these instructions, check out this post! ---​
With a new version of Ubuntu comes an update to my guide for setting up a build environment to compile Android ROMs. The aim of this is to simplify the configuration process and teach a little bit about the command line.
Follow the directions step-by-step. All you have to do is copy and paste the code in order, it will be up and running in no time!
This guide applies to all variations of Ubuntu 16.04 LTS Xenial Xerus 64 bit. Do not use the 32 Bit version.
Also, PAY CLOSE ATTENTION when to use "sudo" and when to not. It can cause unexpected issues if you do something as root that you shouldn't.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
Ready to begin?
1) Unless it's a completely fresh Ubuntu installation, many people might have the wrong version of Java installed. Let's fix that first.
The command below makes sure you're starting with a clean slate. Copy and paste it into a terminal (command prompt) window:
Code:
sudo apt-get remove openjdk-* icedtea-* icedtea6-*
If necessary, follow the on-screen instructions to remove any stray Java versions. Otherwise, move on to the next step.
2) Install the main build tools with this command:
Code:
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven libc6-dev linux-libc-dev gcc-multilib g++-5-multilib libssl-dev
3) "repo" communicates with git servers for all that precious source code. The next command will grab it:
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
4) Use your favorite text editor to open ~/.bashrc - I like nano:
Code:
nano ~/.bashrc
5) At the very bottom (use the Page Down key) paste this code to a new line:
Code:
export PATH=~/bin:$PATH
export USE_CCACHE=1
6) Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:
Code:
source ~/.bashrc
7) In the terminal, navigate to where you would like to download the Android source code. The commands below will make it in your home folder, but if you have limited space you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external (even 3.0) will be comparatively slow. Here we go:
Code:
mkdir ~/android
cd ~/android
8) Now you're going to initialize the repo. This is where you decide the flavor of Android you want to build, i.e. AOKP, CyanogenMod, AOSP etc.
For the purposes of this tutorial, here's the command for Cyanogenmod 13 (Marshmallow) :
Code:
repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
9) Time to get the source, many gigabytes of downloading await.
Don't worry, it's automated. It's the last one!
Code:
repo sync
Check back periodically every hour or so. It all depends on how fast your connection is.
10) Now, for Java. Some ROMs (Android Lollipop / CM 12.1 and below) require OpenJDK 7. Marshmallow / CM 13 and above require OpenJDK 8. If you're building for reallllllly old devices, OpenJDK 6. Here's the easiest way to install on Ubuntu 16.04.
First, add the PPA for OpenJDK:
Code:
sudo add-apt-repository ppa:openjdk-r/ppa
Then, install the appropriate version of Java. In this case we're going to use 7, because it's popular. Simply replace openjdk-7-jdk with 6 or 8 as needed.
Code:
sudo apt-get update && sudo apt-get install openjdk-7-jdk
That's it! Everything should be ready to go.
If this guide helped you out, feel free to click the Thanks! button or donate to the new hardware fund​
Observations
I just happened to have a literally minutes-old ISO download of this version of Kubuntu (release - replacing beta 2) ready to install when I saw this, therefore I followed it to the T.
It was, in fact, helped that I did the repo sync prior to washing my hands before dinner.
After eating, putting away leftovers, etc. (the usual post-dinner cleanup detail), I came back to find the repo sync had completed.
Next was installing openjdk8 - only to find that it had, in fact, been already grabbed when I grabbed the prereqs - then I remembered why. Between Wiley and Xenial, both JDK and OpenJDK had finished their respective transitions from 7 to 8. Still, better safe than sorry - after making sure that both the Java-related settings matched (the last two sudos), I ran repo sync one last time before writing this post.
All five hundred sixteen projects in the CM-13 tree.
What helped - having loads of bandwidth. (No - I'm not on a college connection; I have a DOCSIS 3.0 cable modem - specifically an ARRIS SurfBoard SB-6183 - and Comcast's second SLOWEST DOCSIS 3 tier (Performance Pro) - which is STILL a frigging crapton of bandwidth; I've generally hit ten megaBYTES per second of transfer when connecting via Team Akamai - no git connection is gonna tax that.
Unless there is a massive-to-monstrous surge in projects against CM-13's tree, not a single subsequent repo sync will be as massive as the first one - which itself was less than thirty minutes.
(Each repo sync after the first downloads/uploads only the CHANGES in the tree - it's the FIRST sync that's the time and bandwidth eater due to it pulling the entire tree.)
Is there a way to install JDK-7 in 16.04 ? Some Roms needed JDK7
NoN1979 said:
Is there a way to install JDK-7 in 16.04 ? Some Roms needed JDK7
Click to expand...
Click to collapse
OP updated with directions at the bottom. Thanks for the support!
@sylentprofet thanks for this guide man:good:
sylentprofet said:
OP updated with directions at the bottom. Thanks for the support!
Click to expand...
Click to collapse
hi may i ask for some help here? compiling cm-12.1 on ubuntu 16.04. does my errors are related with 16.04 ? i had no problem with 15.10. thank you.
http://pastebin.com/1X0WcZAr
I set my ubuntu 16.04 lts like your guide thread, But I build CM 12.1, It show me 'unsupported reloc 43 against global symbol stderr'
Code:
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:31: error: unsupported reloc 43
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:787: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to fix it?
It show always what I build Android ROMs. :/
CNBLACK said:
I set my ubuntu 16.04 lts like your guide thread, But I build CM 12.1, It show me 'unsupported reloc 43 against global symbol stderr'
Code:
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:31: error: unsupported reloc 43
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:787: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to fix it?
It show always what I build Android ROMs. :/
Click to expand...
Click to collapse
Same problem here, see post above
desalesouche said:
Same problem here, see post above
Click to expand...
Click to collapse
humm.. I found solution this issue, but It is temporarily solution.
Code:
ln -sf /usr/bin/ld.gold /home/(your account name)/(build source repository)/prebuilts/gcc/linux-x86/host/(glibc version)/x86_64-linux/bin/ld
check your glibc version in terminal error line.
And If you find it, You need to type this command. And It'll be work.
And It has a one more problem.
Code:
mkdir -p /home/cnblack/build/sgs2/12.1/out/target/product/i9100/obj/PACKAGING/recovery_patch_intermediates/
PATH=/home/cnblack/build/sgs2/12.1/out/host/linux-x86/bin:$PATH /home/cnblack/build/sgs2/12.1/out/host/linux-x86/bin/imgdiff /home/cnblack/build/sgs2/12.1/out/target/product/i9100/boot.img /home/cnblack/build/sgs2/12.1/out/target/product/i9100/recovery.img /home/cnblack/build/sgs2/12.1/out/target/product/i9100/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p
Error: inflate failed [invalid block type] at file offset [2535779]
imgdiff only supports gzip kernel compression, did you try CONFIG_KERNEL_LZO?
failed to break apart target image
I don't know Why I have to fix this trouble :/
BuilduntuVM
@sylentprofet: Thanks a lot for that guide.
Do you consider to release an Ubuntu 16.04 LTS based BuilduntuVM (http://forum.xda-developers.com/showthread.php?t=2585828) sometime?
revuwa said:
@sylentprofet: Thanks a lot for that guide.
Do you consider to release an Ubuntu 16.04 LTS based BuilduntuVM (http://forum.xda-developers.com/showthread.php?t=2585828) sometime?
Click to expand...
Click to collapse
Yes, definitely!
I started work on it, but ran into some issues with the installation process. Once everything is working nicely I'll post an update.
Thanks for the support!
CNBLACK said:
And It has a one more problem.
I don't know Why I have to fix this trouble :/
Click to expand...
Click to collapse
It looks like you're compiling CM 12.1, which is based on Lollipop.
Are you using OpenJDK 7 instead of 8? L uses 7 to compile, 8 is only for M onward.
There are directions at the bottom of the post to switch back to OpenJDK 7 if needed.
Reserved
CNBLACK said:
I set my ubuntu 16.04 lts like your guide thread, But I build CM 12.1, It show me 'unsupported reloc 43 against global symbol stderr'
Code:
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: ~/cm12/out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:31: error: unsupported reloc 43
external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:787: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to fix it?
It show always what I build Android ROMs. :/
Click to expand...
Click to collapse
I used this fix from cyanogenMOD to solve that issue......good luck
for:
art / build/Android.common_build.mk
# Clang build support.
# Host.
ART_HOST_CLANG := false
- ifneq ($(WITHOUT_HOST_CLANG),true)
+ ifeq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
REF: http://review.cyanogenmod.org/#/c/120824/2/build/Android.common_build.mk
fgdn17 said:
I used this fix from cyanogenMOD to solve that issue......good luck
for:
art / build/Android.common_build.mk
# Clang build support.
# Host.
ART_HOST_CLANG := false
- ifneq ($(WITHOUT_HOST_CLANG),true)
+ ifeq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
REF: http://review.cyanogenmod.org/#/c/120824/2/build/Android.common_build.mk
Click to expand...
Click to collapse
I have it does not work, to build 12.1
should have specified: Marshmallow, doesn't work on Lollipop....
the "real" issue appears to be with libc6 and binutils
libc6 = 2.19-22
binutils = 2.25-4
seems depending on your combination of these sometimes a build works
correctly and sometimes not......so until a stable combo is pushed...this is a temp fix IMO
OP here.
Would it be more helpful for everyone if I separated the installation of OpenJDK into a different step, so you guys can choose 7 or 8 depending on which version of Android being built?
Thanks for the responses everyone!
CNBLACK said:
humm.. I found solution this issue, but It is temporarily solution.
Code:
ln -sf /usr/bin/ld.gold /home/(your account name)/(build source repository)/prebuilts/gcc/linux-x86/host/(glibc version)/x86_64-linux/bin/ld
check your glibc version in terminal error line.
And If you find it, You need to type this command. And It'll be work.
Click to expand...
Click to collapse
using this method , and the results worked well , thanks dude
qoejohn said:
using this method , and the results worked well , thanks dude
Click to expand...
Click to collapse
It just only work in CM 12.1, CM 13.0 is not needed to do this method

Categories

Resources