yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] Bladehawkz:
Seems to break on compiling sultan's OPO kernel with the following error:

LD .tmp_vmlinux1

drivers/built-in.o: In function `dump_lim_send_rrm_action':

governor_msm_cpufreq.c:(.text+0x4ac8c0): undefined reference to `__aeabi_ldivmod'

Makefile:876: recipe for target '.tmp_vmlinux1' failed

make: *** [.tmp_vmlinux1] Error 1

Seems to be 64 bit instructions on our 32 bit kernel, any suggestions?
[Miscellaneous Android Development] nathanchance:
I'll try to pull it down and test tonight.
[Miscellaneous Android Development] nathanchance:
New toolchains have been released!

I will pretty much update these once a month, GCC 7.1.1 is in a very stable spot.

All you should need to do is run a git pull. If for some reason there are any odd errors, get your current branch by typing git branch then run the following commands:

git fetch origin <branch_name>
git reset --hard origin/<branch_name>

Nothing else to note, enjoy!
[Miscellaneous Android Development] psndna88:
im trying to compile kenzo N kernel, turning off many Werrors, it fails to boot with any 7.x gcc and bootloops on bootloader logo...
[Miscellaneous Android Development] nathanchance:
I've heard Kenzo has had issues with booting GCC 7, even with the commits in the OP. As I do not have the device, I cannot test. See if there are any kernels with it working.
[Miscellaneous Android Development] inflames91:
Hey [MENTION=6842057]The Flash[/MENTION]

Any chance you can build a GCC 7 toolchain for ROM building?

No hard and fast, whenever you get some free time is also all good. :)
[Miscellaneous Android Development] nathanchance:
Sorry, I barely have time to do these as it is. Check out UberTC, they use bionic as the C library so it should be able to compile ROMs.
[Miscellaneous Android Development] inflames91:
I tried Uber 7.x and it failed which is why I thought I'd ask you. :P

Any chance you'd be able to help if I give you a build log?
[Miscellaneous Android Development] BlackSoulxxx:
Hi, can you make GCC 6.4 with Linaro changes? I have a device that would refuse to boot with GCC 7 and the last 6.3.1 working fine so I would like an update to it.
[Miscellaneous Android Development] nathanchance:
Sorry, I don't have time to do this. Open up the build script and change the second GCC variable declaration to the latest 6.4 branch from https://git.linaro.org/toolchain/gcc.git
[Miscellaneous Android Development] ZaneZam:
Hi nathan,

first of all many thanks for the TC's they do a very good jop in my workshop!

aand just for a little heads-up u still have "gcc version 7.1.1 20170707" in your builds but meanwhile they are newer, aren't they?

just in case it wasn't intentional and probably for the next build to change ;)

cheers

ZZ
[Miscellaneous Android Development] nathanchance:
Hey! That date is from the GCC date file, which is accurate. I don't merge in GCC updates to the Linaro toolchains as it results in too many conflicts. I leave that up to the Linaro team.
[Miscellaneous Android Development] USBhost:
On normal linaro is about 1 month behind stock gcc.

So your good.
[Miscellaneous Android Development] nathanchance:
Update!

Couple of major updates I am pleased to announce:

1. All of the toolchains are compiled with bionic (Android's C library) instead of glibc, meaning (in theory) these toolchains can now be used for ROM compilation in addition to kernel compilation. I have not tried this though.

2. I have completely redone the git repo from scratch, resulting in (hopefully) a smaller repo size. I have also started offering tarballs, which will have a constant URL so you can use either curl or wget to constantly get those without the additional repo history (links for the direct tarballs are available in the table in the README).

Please update by either recloning (recommended) or using the following commands:

git fetch origin
git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)

3. I have updated the build script repo to allow you to compile GCC 4.x, 5.x, 6.x, 7.x, or 8.x with ease. Please see the README and built in help menu for more info. NOTE: These will still be built with glibc, as I have not studied how to compile with bionic.

Enjoy!
[Miscellaneous Android Development] nathanchance:
Update!

Toolchains have been updated to GCC 7.2.1 with bionic from NDK r15c and binutils 2.29. Either use git pull or download the tarball using the links in the README. Enjoy!
[Miscellaneous Android Development] deepongi:
i think there's issues with the build script building linaro aarch64 5.x, 6.x and gnu 8.x

it always compile gcc 7.2.1

i even manually tried setting the values here: https://github.com/nathanchance/build-tools-gcc/blob/master/build#L104-L109

but no luck.

screenshot in attachment.

@ OP can you please make a fresh git clone, and try to reproduce?

edit: linaro 4.x builds fine, screen in attachment.
[Miscellaneous Android Development] nathanchance:
I'll take a look later today.

[MENTION=1077833]infected_[/MENTION], I can't reproduce this. I just compiled GCC 8.0.0, Linaro GCC 5.4.1 and 6.4.1 just fine.
[Miscellaneous Android Development] deepongi:
grabbing a build log right now.

edit: did you checked aarch64..../bin/aarch64-linux-gnu-gcc --version, after compiled them? because it zips fine, regarding the name.

build log (shell commands included) of linaro 5.x

https://mega.nz/#!ntISWTAb!HOD99OebbuKFYOK93op4rJugSFJ-77F8kISBOoq5Tp4 (updated the link)

the output is a 7.2.1 toolchain, despite the name, as you can confirm on the logs

[MENTION=6842057]The Flash[/MENTION], i was able to build now to build 6.x, and 4.x and i am compiling 5.x as we speak..

the only thing i made different was the command to launch the build script, and manually set linaro and the version on the script.:

./build -c -b -l -u -p gz -v 6 -j16

i was doing:

./build -c -b -l -p gz -v 6 -j16

so i only issue the update command, but i can't see how that's causing troubles.
[Miscellaneous Android Development] nathanchance:
Okay, I see. I will look into modifying the script to checkout the correct branch with or without the update flag (as that is the only way that it will currently).
[Miscellaneous Android Development] nathanchance:
Update!

Some kernel compilers probably noticed some spam like this after the last toolchain update:

Warning: ignoring attempt to redefine built-in register 'lr'

Turns out there is something up with the released tarball of binutils 2.29; I have used the upstream git repo and everything works fine now.

Some other people have reported issues with kernels not booting after the August 5th toolchains. I am not having any issues so I have no way to diagnose issues. Sorry!

Lastly, I added some commits to crosstool-NG that allows me to remove that horrible versioning in the package name so now gcc --version's output (and by extension, the full kernel version from /proc/version) is much cleaner. Something small but super necessary imo.

Update by using git pull or downloading the latest tarball. Enjoy!

Changelog:

* Update GNU version to latest from upstream

* Fix binutils

* Update headers
[Miscellaneous Android Development] robcore:
That was YOU??

Gah thanks so much! Haha I was scrambling trying to find all of the places where they hide variables in that maze?
[Miscellaneous Android Development] Watanabe_You:
Hi, how do you actually optimize the toolchain for ARM versions? I have an octa-core device with all A53 cores, are there any guides that I can reference?
[Miscellaneous Android Development] nathanchance:
What do you mean by optimize the toolchain? I don't do anything to the toolchain. If you mean optimize the kernel with the toolchain, you can use the mcpu or mtune flags in arch/<ARCH>/Makefile like this: https://github.com/nathanchance/one...0971d83#diff-82d9df7fd555765d1ab6fac84080586d

https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/AArch64-Options.html#index-mtune
[Miscellaneous Android Development] Watanabe_You:
Oh, thanks. I saw your branches had personal a57.a53 and a73, so I thought they were made specifically for those.
[Miscellaneous Android Development] robcore:
[MENTION=6842057]The Flash[/MENTION]

Out of curiosity, how are you finding the 4.13 headers? I build for a kernel that's a mixed grab bag of 3.4, 3.18, 4.13, you name it. So ive been using 3.16 as my target to sort of...average it out you know?
[Miscellaneous Android Development] nathanchance:
They are because I own a Nexus 6P and OnePlus 5; I don't do that for the public toolchains though lol.

I haven't had any issues with them, I tend to use the latest everything unless it causes issues I can't resolve.
[Miscellaneous Android Development] robcore:
Lol story of my life, good to know mate
[Miscellaneous Android Development] adixtx:
It is possible to build latest arm-linaro-linux-androideabi gcc toolchain for a specific api level ?

I used prebuild arm-linaro-linux-androideabi 7.2.1 20170817 for building for an old device and old api (I9100 , api level 16) , and when exec on device i get : "reloc_library...cannot locate 'random' ... cannot link executable

When using ndk standalone toolchain with gcc 4.9 all is ok.

If it is not possible , what prebuilded linaro toolchain do you recommend for this (i9100 and android 4.1.2) ?

Thankyou.
[Miscellaneous Android Development] nathanchance:
Lowest crosstool-NG will let me go is 21. I don't know of any other toolchains.
[Miscellaneous Android Development] adixtx:
I figured out.

I just replaced sysroot in your toolchain with the one generated from ndk for api level 16.

I builded openvpn with success and used some optimization flags for my old I9100.

I want to make some tests with this latest linaro generated binary , to see if performs better.

Anyway, is time to buy a new phone :)

Thanks.
[Miscellaneous Android Development] nathanchance:
Update!

Regular update here, updated GCC to their latest versions in addition to all the relevant components. Should have no issues but let me know if you do!

Update by either running git pull or downloading the latest tarball. Enjoy!

If you run into issues with git pull, run the following commands:

git fetch origin
git reset --hard origin/$( git rev-parse --abbrev-ref HEAD )

Changelog

Update GNU GCC to 20170916

Update Linaro GCC to Linaro GCC 7.2-2017.10~dev

Update binutils to 2.29.1

Update Linux headers to 7318413077a5141a50a753b1fab687b7907eef16
[Miscellaneous Android Development] Vaughnn:
Hi, im having a problem with booting the device after compiling with aarch64-linaro-linux-android- it succesfully compiled it and but after flashing it, like the readme said "Without this, the phone will boot to the Google logo, hang for a

few seconds, then reboot, and repeat the process." i've made a couple of changes that the readme suggest for kernel building, but it still wont do much.

Compiling a kernel for : SM-G950F / Samsung Galaxy S8 , OS: Ubuntu 16.04, Makefile line 670

all the necessary files : https://drive.google.com/drive/folders/0B4aQ6mLrVMusbjZQZjNZd2RxVlk?usp=sharing

I'm using the toolchain that you just updated 2 days ago.

EDIT : i've manage to boot with the GNU version arm64 that you just updated 2 days ago, but i was wondering what causes the phone wont boot with kernel compiled with linaro toolchian anyway?
[Miscellaneous Android Development] nathanchance:
Alright took me forever to get around to it but [MENTION=1077833]infected_[/MENTION], I have improved the script so it will always make sure you are on the correct branch with the correct source every time you run the script. Both the -d and -u paramters have been eliminated, they are done automatically (unless you opt out of updating with the -nu flag). Let me know if you have any more issues!
[Miscellaneous Android Development] deepongi:
nice! syncing now.

i'll test building them (arm64) all and i'll report later.

edit; [MENTION=6842057]nathanchance[/MENTION] it's working like a charm ;)
[Miscellaneous Android Development] KuranKaname:
[MENTION=6842057]nathanchance[/MENTION] Nice work! Just a question, does it come with -gomp?
[Miscellaneous Android Development] KuranKaname:
Thanks :)
[Miscellaneous Android Development] KuranKaname:
during RTL pass: sms

arch/arm64/kernel/io.c: In function ‘__memcpy_fromio’:

arch/arm64/kernel/io.c:51:1: internal compiler error: Segmentation fault

}

^

Any fix for this?
[Miscellaneous Android Development] nathanchance:
Remove all optimization flags and try building.
[Miscellaneous Android Development] KuranKaname:
And... With flags it isn't possible? Is it really worth the trade off of using gcc 7+ vs gcc 6 with all the optimization flags?
[Miscellaneous Android Development] nathanchance:
I don't know. I'm not a GCC developer. Feel free to go look how to file a bug report if/when you figure out what flag calls it. I go minimal on my optimization flags, they're usually pointless for performance.
[Miscellaneous Android Development] KuranKaname:
Alright thanks. Will look into that
[Miscellaneous Android Development] nathanchance:
Hmmm I am a little confused with how you have set everything up. Because you're compiling busybox when it errors. Are you trying to use these to build a whole ROM or just your kernel?
[Miscellaneous Android Development] FSadino:
Sorry i forgot to specify that i'm building Rom and kernel together but i think i solved by changing the path to toolchain... Is running fine lets see if it finish ok.

Thanks for your time and for this amazing guide :good:
[Miscellaneous Android Development] Bladehawkz:
Also keep in mind that ICE's are often caused by one flag, or one variety of flag (like graphite) not all your flags. You could probably single it out after a few compile attempts.
[Miscellaneous Android Development] KuranKaname:
Oh alright. I'll give it a shot. Thanks!
[Miscellaneous Android Development] sunmughans:
In the Git, i saw this line mentioned in your ReadME.md

"export CROSS_COMPILE=$(pwd)/gcc-prebuilts/bin/<prefix>"

What is <prefix> here? please tell me as i wanna compile kernel for my samsung j2lte.
[Miscellaneous Android Development] nathanchance:
It's in the README for future reference but it's what's before the gcc in the binary name (e.g. aarch64-linaro-linux-android-)
[Miscellaneous Android Development] sunmughans:
Thankyou for your valuable and easy guide. I had compiled a custom kernel for Samsung J2 (SM 200G) successfully. But it had an issue with screen flickering when brightness reduced to its lowest value. How do i fix it? I need a patch for it so i can implement it in my kernel source to stop screen flickering. It actually happens with lots of samsung devices. Please help me fixing it out.
[Miscellaneous Android Development] Flashhhh:
I get the following error while building linaro 5.5 with your build script.

../../gcc/gcc/graphite-optimize-isl.c: In function ‘isl_union_map* getScheduleMap(isl_schedule*, isl_union_map**)’:

../../gcc/gcc/graphite-optimize-isl.c:529:67: error: ‘isl_schedule_get_band_forest’ was not declared in this scope

isl_band_list *BandList = isl_schedule_get_band_forest (Schedule);

Any help would be appreciated. Thanks!
[Miscellaneous Android Development] krasCGQ:
Hey!

Looks like it's occurred due to incompatibility of ISL 0.18 (both development version from git and release tarball) with GCC 5 and older, as I face the same error when building Linaro 4.9. I workaround the issue by using ISL 0.17.1 tarball for GCC 5 and older.

Commit (temporary, as it's tricky to deal with for now)

EDIT: "Patchset 2" with minor updates.

Let me know if it works for you!
[Miscellaneous Android Development] USBhost:
[MENTION=6842057]nathanchance[/MENTION] after some thinking could we have an option to choose between git or tarball for isl and binutils? We can also add a option to change the kernel Branch too, if someone wanted to use an older version.

I for one don't like using git for them but that's just my thoughts.

I could come up with some rough drafts for it.
[Miscellaneous Android Development] nathanchance:
Looks fine to me but I think doing what [MENTION=5501864]USBhost[/MENTION] recommended is probably a smarter idea to account for any future breakage that might happen. If you pull request, I'll merge it then [MENTION=5501864]USBhost[/MENTION] can base those changes upon it to account for it.

Draft something up and I'll review it :) Choosing between git and zips is definitely smart especially for GCC and the Linux kernel. I'm actually thinking that updating those repos would be a good candidate for a wrapper function...

function update_repo() {
cd ${1}
git remote update
git checkout ${2}
git merge origin/${2}
[[ -f autogen.sh ]] && ./autogen.sh
cd ..
}

update_repo gcc ${GCC}
update_repo binutils ${BINUTILS}
update_repo linux master
[Miscellaneous Android Development] krasCGQ:
PR created ;)
[Miscellaneous Android Development] nathanchance:
And merged! Will take a look at some of the other stuff tomorrow or maybe during the week.
[Miscellaneous Android Development] adekboreanaz:
was this the right command

./build -a arm64 -mtune=cortex-a53 -mcpu=cortex-a53 android -s linaro -v 7

it straight to download, but not sure when building later
[Miscellaneous Android Development] nathanchance:
Those mtune and mcpu flags won't actually do anything but yes, it should start building afterwards.
[Miscellaneous Android Development] Sands207:
could i use the arm toolchain to compile an armeabi-v7a kernel? I keep trying using Ubuntu 14.04 but im either missing a required package or just braindead
[Miscellaneous Android Development] nathanchance:
You should be able to. What is the error or issue?
[Miscellaneous Android Development] Sands207:
I'm going to try downloading the toolchain again, i just discovered i had installed the incorrect ndk already so im guessing that is related, im still learning how the kernel compile process works. Thank you
[Miscellaneous Android Development] gokart2:
[MENTION=6842057]nathanchance[/MENTION]

Thanks for posting this! I haven't compiled anything in awhile, but plan on it when I get my build machine back from storage. Have only used prebuilt UBER toolchains, and have only recently learned how to compile kernels in the past year or so. That being said, I have a few questions?

1) Last I knew, only GCC 4.9 could compile kernels without a billion issues? So is 7.2.1 ok?

2) How would I go about this procedure to compile an optimal rom building toolchain?

3) IIRC, I have 16.04.x OS loaded on the build PC. Is there any benefit to flash and use 17.04?

4) Was unaware you could use optimization flags when compiling a toolchain, had only used them compiling a kernel. Makes sense though. What flags do you use/recommend?

Again, thanks for this. Have learned so much from this site and it's knowledgeable users like yourself.
[Miscellaneous Android Development] nathanchance:
1. You need to add a few supporting commits for anything above 4.9.

2. You'd need to use crosstool-NG, that's kind of beyond the scope of this thread.

3. Not sure, I use Arch Linux.

4. I use mcpu and mtune to tune for a specific chipset and a few other safe flags. You can search my kernel repos for those, I don't know them off the top of my head.
[Miscellaneous Android Development] gokart2:
1) The ones posted in the README I assume.

2) Will read up on that, but just now realized you are offering pre-builts via links in the README. Will likely follow that route unless I need to compile a lower branch (4.9).

3) :good: :good:

4) I have looked through your kernel makefiles already and am somewhat knowledgeable on those flags. But I was referencing a few posts back regarding:

./build -a arm64 -mtune=cortex-a53 -mcpu=cortex-a53 android -s linaro -v 7

Which looked like optimizations could be used for building the toolchain itself? But it seems like that is incorrect.

Thanks again, much appreciated! :good:
[Miscellaneous Android Development] Bladehawkz:
Those flags, as he said, were useless, since the target optimisation has to be towards the kernel, not the toolchain. It's probably possible to optimise the toolchain for your cross-compiling machine, but it's pointless hard work editing the script to shave off a few seconds of compilation time with 0 benefit to resulting kernel binary.
[Miscellaneous Android Development] deepongi:
[MENTION=6842057]nathanchance[/MENTION] the script is building v7.x again, when i select to build the v5 toolchain.
[Miscellaneous Android Development] nathanchance:
Are you sure? There haven't been any major changes to the script since I fixed it last time...
[Miscellaneous Android Development] deepongi:
yep, check above post, the screenshot. or here.

edit: [MENTION=6842057]nathanchance[/MENTION], i am not being able to attach images, il just leave it here
[Miscellaneous Android Development] nathanchance:
I don't have any problem using the latest commits from build-tools-gcc, I have flipped between 5, 6, and 7 seamlessly.
[Miscellaneous Android Development] deepongi:
ok .. going to delete everything and clone again, maybe i missed something while pulling...
[Miscellaneous Android Development] deepongi:
i needed to delete whole repo and init again. was able to build 7.x and 6.x just fine, but i am getting an error while trying to compile 5.x.

you have any clue? can grab a log if you want.
[Miscellaneous Android Development] Jonas Cardoso:
Is it normal for me to have this error?

EDIT: removed CFLAGS worked fine
[Miscellaneous Android Development] albertoduqe:
Hi!

This is GREAT stuff, thanks for the work!

I am having this error while trying to compile arm64 linaro v7:

cd .. \
&& CONFIG_FILES=po/Makefile.in:po/Make-in \
CONFIG_HEADERS= /bin/bash ./config.status
config.status: creating po/Makefile.in
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing bfd_stdint.h commands
config.status: executing default commands
make[3]: Nothing to be done for 'info'.
make[3]: Leaving directory '/home/albertoduqe/build-tools-gcc/build-binutils/bfd/po'
make[3]: Entering directory '/home/albertoduqe/build-tools-gcc/build-binutils/bfd'
make[3]: Nothing to be done for 'info-am'.
make[3]: Leaving directory '/home/albertoduqe/build-tools-gcc/build-binutils/bfd'
Makefile:1743: recipe for target 'info-recursive' failed
make[2]: *** [info-recursive] Error 1
make[2]: Leaving directory '/home/albertoduqe/build-tools-gcc/build-binutils/bfd'
Makefile:2692: recipe for target 'all-bfd' failed
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory '/home/albertoduqe/build-tools-gcc/build-binutils'
Makefile:849: recipe for target 'all' failed
make: *** [all] Error 2

Error while building binutils!

Any idea of the origin of the issue and solution?

Thanks!