yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] theGanymedes:
I think that double quote is because you might not have a permission for that folder - I remember making some changes like that once to use given toolkit with the NDK...

If this doesn't work as well, maybe you should make links to the /usr/bin (instead of erasing the gcc there :) ) or edit Makefile (replace every occurance of CC with <prefix>-gcc )

Also, don't give prefix folder with "/" at the end, always make prefix folder different from the source dir (to keep stuff unmixed) and if all those doesn't work, just make a new toolchain for yourself - believe me it's not that complicated, you don't need to know anything about the process if you don't want to with crostool-ng .. Instructions are at the first page, written too. At least you can be sure what config is present (God knows what options those guys from Google used to make them.. :/ )
[Desire Android Development] theGanymedes:
Also, noticed something today, that some Makefiles want you to make definitions after make command; which makes command line as

<wherever> make CC=arm-linux-gcc ....[i]other flags above[/i].......
[Desire Android Development] Droidzone:
I think you're hit the nail there, mate....Now it's actually giving me a lot of errors! ;)

Missing a whole lot of header files, by the look of it..

droidzone@ubuntu:~/android/dosfsck/dosfstools-3.0.9$ make CC="arm-eabi-gcc --static" LD="arm-eabi-ld" AR="arm-eabi-ar" RANLIB="arm-eabi-ranlib" AS="arm-eabi-as" PREFIX=/home/droidzone/android/dosfsck/dosfstools-3.0.9/
arm-eabi-gcc --static -g -O2 -static -c -o dosfsck.o src/dosfsck.c
In file included from src/dosfsck.c:29:
/home/droidzone/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/include-fixed/stdio.h:50:23: error: sys/cdefs.h: No such file or directory
/home/droidzone/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/include-fixed/stdio.h:51:24: error: sys/_types.h: No such file or directory
In file included from src/dosfsck.c:29:
/home/droidzone/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/include-fixed/stdio.h:160: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'extern'

And so on and so forth... :)

At least we know now that it's using the correct toolchain!

Update:

I located the .h files, and finally copied them over from another subfolder to include-fixed folder (the option -I to change include path didnt seem to work)

Final error message:

droidzone@ubuntu:~/android/dosfsck/dosfstools-3.0.9$ make CC="arm-eabi-gcc --static" LD="arm-eabi-ld" AR="arm-eabi-ar" RANLIB="arm-eabi-ranlib" AS="arm-eabi-as" PREFIX=/home/droidzone/android/dosfsck/dosfstools-3.0.9
arm-eabi-gcc --static -g -O2 -static -c -o dosfsck.o src/dosfsck.c
arm-eabi-gcc --static -g -O2 -static -c -o boot.o src/boot.c
arm-eabi-gcc --static -g -O2 -static -c -o check.o src/check.c
arm-eabi-gcc --static -g -O2 -static -c -o common.o src/common.c
arm-eabi-gcc --static -g -O2 -static -c -o fat.o src/fat.c
arm-eabi-gcc --static -g -O2 -static -c -o file.o src/file.c
arm-eabi-gcc --static -g -O2 -static -c -o io.o src/io.c
arm-eabi-gcc --static -g -O2 -static -c -o lfn.o src/lfn.c
arm-eabi-gcc --static dosfsck.o boot.o check.o common.o fat.o file.o io.o lfn.o -o dosfsck
/home/droidzone/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: crt0.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make: *** [dosfsck] Error 1
droidzone@ubuntu:~/android/dosfsck/dosfstools-3.0.9$

Missing a source file named crt0.c?? Hmm..

I think I have to wind up my efforts at compilation for the moment..Will be back in a couple of weeks..

Thanks for the awesome support and insight you've given!
[Desire Android Development] theGanymedes:
DON'T GO FURTHER FROM HERE! -- Read ahead

CRT*.o files are the files which are referred as C/C++ "starter" files. These files include some small assembly commands which will load the program and stack to the memory and is platform specific.

You can only compile them if you know the assembly of your machine, kernel etc. and such - or can obtain them from your device manufacturer (well, that's not always case but, keep reading.. :) )

You can find those CRT buddies for android which are generated with Bionic at NDK lib folder; but I definitely don't recommend you to use these if you're to build complex applications. Because you'll see that you'll have to make a lot of changes in those folders, linkings etc. and it's really going to give you nothing but headaches :)

There are also some scripts in GlibC distribution which allows you to compile CRT files properly (thank god ARM is among those - actually various versions of ARM is supported), and those files will be compiled when you're making your toolchain - so you'll have better versions when you make your toolchain.

Really, at this point, I recommend you to make your own toolchain, cos in time you'll see that as the new applications need new libraries (like dosfstools will ask of you to find libC and LibGCC libraries if you copy CRT files) you'll have to compile them again and it won't be possible with your half-baked google toolchain :)
[Desire Android Development] Droidzone:
Ok, installed crosstool..Now at crosstool menuconfig, staring at a huge list of features waiting to be configured~! lol..

Set:

Target Architecture (arm)

Toolchain options: cross

Target OS: baremetal (should I go for linux?)

..hope there's nothing else to configure here.. :)
[Desire Android Development] Droidzone:
crosstool build over...It says toolchain was built, but for the life of me I cant figure where it put all those files. My target dir is full of .in files! No gcc anywhere!

Funny...locate gcc didnt find it (or I missed it)

It was at ~/x-tools/arm-unknown-eabi

Didnt set the toolchain string...Rebuilding...

Love menuconfig btw... :)

droidzone@supernova:~/android/mydev/dosfstools/dosfstools$ ls -l
total 712
drwxrwxr-x 2 droidzone droidzone 4096 2011-10-29 15:03 bin
-rw-rw-r-- 1 droidzone droidzone 28872 2011-10-29 15:04 boot.o
-rw-rw-r-- 1 droidzone droidzone 26993 2011-10-29 15:03 ChangeLog
-rw-rw-r-- 1 droidzone droidzone 53312 2011-10-29 15:04 check.o
-rw-rw-r-- 1 droidzone droidzone 8484 2011-10-29 15:04 common.o
-rw-rw-r-- 1 droidzone droidzone 35147 2011-10-29 15:03 COPYING
drwxrwxr-x 3 droidzone droidzone 4096 2011-10-29 15:03 debian
drwxrwxr-x 2 droidzone droidzone 4096 2011-10-29 15:03 doc
-rwxrwxr-x 1 droidzone droidzone 140326 2011-10-29 15:04 dosfsck
-rw-rw-r-- 1 droidzone droidzone 14680 2011-10-29 15:04 dosfsck.o
-rwxrwxr-x 1 droidzone droidzone 136036 2011-10-29 15:04 dosfslabel
-rw-rw-r-- 1 droidzone droidzone 10920 2011-10-29 15:04 dosfslabel.o
-rw-rw-r-- 1 droidzone droidzone 26068 2011-10-29 15:04 fat.o
-rw-rw-r-- 1 droidzone droidzone 14428 2011-10-29 15:04 file.o
-rw-rw-r-- 1 droidzone droidzone 14444 2011-10-29 15:04 io.o
-rw-rw-r-- 1 droidzone droidzone 22612 2011-10-29 15:04 lfn.o
-rw-rw-r-- 1 droidzone droidzone 3512 2011-10-29 15:03 Makefile
drwxrwxr-x 2 droidzone droidzone 4096 2011-10-29 15:03 man
-rwxrwxr-x 1 droidzone droidzone 58284 2011-10-29 15:04 mkdosfs
-rw-rw-r-- 1 droidzone droidzone 75000 2011-10-29 15:04 mkdosfs.o
drwxrwxr-x 2 droidzone droidzone 4096 2011-10-29 15:03 src
droidzone@supernova:~/android/mydev/dosfstools/dosfstools$ rm *.o
droidzone@supernova:~/android/mydev/dosfstools/dosfstools$ which gcc
/home/droidzone/x-tools/arm-unknown-eabi/arm-unknown-eabi/bin/gcc
droidzone@supernova:~/android/mydev/dosfstools/dosfstools$ make CC="arm-unknown-eabi-cc --static" LD="arm-unknown-eabi-ld" AR="arm-unknown-eabi-ar" RANLIB="arm-unknown-eabi-ranlib" AS="arm-unknown-eabi-as" PREFIX=/home/droidzone/compiledarm-unknown-eabi-cc --static -O2 -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g -c -o dosfsck.o src/dosfsck.c
In file included from src/dosfsck.c:35:0:
src/common.h:22:23: fatal error: asm/types.h: No such file or directory
compilation terminated.
make: *** [dosfsck.o] Error 1
droidzone@supernova:~/android/mydev/dosfstools/dosfstools$
[Desire Android Development] Droidzone:
Update:

I was thinking that a properly compiled toolchain would solve my issues, and I could just type "make" :D

Unfortunately it still misses all those standard header files! :)

I think I can include the system header files found at /usr/src/linux-headers-3.0.0-12/arch/arm/include/asm/types.h

But am I supposed to. Once I include that, it's asking for something else, once I add that, it's another thing!

Damn.. compiling needs a lot of determination!!
[Desire Android Development] theGanymedes:
Man, are you insane? Why didn't you read post #5, all the options you need to set were there!

Also, if you're to use this toolchain, don't choose bare-metal, pick linux.

Here's the link of the post: http://xdaforums.com/showpost.php?p=18356849&postcount=5
[Desire Android Development] Droidzone:
Kudos

Wow...It's only today that I fully appreciate the work you did to write that invaluable info in post #5!

Followed your steps one by one..so I hope there wont be any problems..however I saw that crosstool doesnt give me updated versions of some stuff..version numbers are a bit older than yours, though crosstool version we have is the same..

Also, I couldnt locate "Force Unwind Support" option in my menuconfig. It just isnt there!

Found a couple of minor typos..

-> Should be arch/arm/mach-msm/include

-> You meant read-only

Thanks for the awesome guide!
[Desire Android Development] Droidzone:
I think I'll need to change the location of the tarball source for at least cloog-ppl
[Desire Android Development] theGanymedes:
Thanks for the correction, yeah, I fixed them :)

Did you enable "Experimental Features" thingy? You should to see some settings - most probably the Forced Unwind is among them :)

Also, if Crosstool-NG doesn't download the files you want; you can download them manually and put it to the tarball directory yourself - it also will work. Just make you sure you download Gzip ones, not Bz or Xz ones - it doesn't support them.
[Desire Android Development] Droidzone:
I think mine is a connectivity problem.. :)

Do you know where the tool stores the list of files/URLs to be downloaded?
[Desire Android Development] Droidzone:
Failed! :(

[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20111030.091649
[INFO ] Building environment variables
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[INFO ] Retrieving needed toolchain components' tarballs: done in 0.06s (at 00:01)
[INFO ] =================================================================
[INFO ] Extracting and patching toolchain components
[ERROR] Build failed in step 'Extracting and patching toolchain components'
[ERROR] Error happened in '/home/droidzone/compile/crosstool/lib/ct-ng-1.9.3/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)
[ERROR] called from '/home/droidzone/compile/crosstool/lib/ct-ng-1.9.3/scripts/functions' at line # 680 in function 'CT_Extract'
[ERROR] called from '/home/droidzone/compile/crosstool/lib/ct-ng-1.9.3/scripts/build/cc/gcc.sh' at line # 30 in function 'do_cc_extract'
[ERROR] called from '/home/droidzone/compile/crosstool/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 567 in function 'main'
[ERROR] Look at '/home/droidzone/x-tools/arm-msm-linux-gnueabi/build.log' for more info on this error.
[ERROR] (elapsed: 0:15.85)
[00:16] / make: *** [build] Error 2
droidzone@supernova:~/compile/crosstool/bin$
[Desire Android Development] Droidzone:
My tarballs downloaded are .tar.bz2

Is that a problem?

Can you attach

crosstool/lib/ct-ng-1.9.3/scripts/functions

Fixed it. Bad archive.

Build.log showed the error
[Desire Android Development] theGanymedes:
OK, well, sorry for the late post. I'll edit the post to make it more "obvious"

In order to suppress PPL thingy -> go to ./ct-ng menuconfig ; go to C Compiler-> Link libstdc++ statically -> yes .

it'll make this linkage static, ergo won't need PPL.. I already wrote that but you didn't see it - are you skimming the whole entry? :) Don't do that at your first time, read every instruction carefully and don't make any changes unless you're 100% sure of what are you doin :)

BTW: It doesn't matter to give kernel parent folder or include folder, it does find it anyway.
[Desire Android Development] Droidzone:
libstdc++ is already statically linked in my config..PPL build fine. It's the one after that, cloog that fails. The config is word for word the same as post #5, so it's weird that some features are missing from the menu (yes, experimental features is on).

When kernel include folder is given, the header path taken becomes /include/include at the end, because the script is like "$stringpath"/include. It failed once, and was fixed when the parent of include was given as string..

I might have some packages missing/different version from yours, though how it affects crosstool-ng, I'm not sure. I tried this on a fresh Kubuntu install.
[Desire Android Development] theGanymedes:
Weird.. I'm using Ubuntu 10.10 here, and now I checked build log and there is nothing like "Cloog" - actually all the cloog I found was saying "with-cloog=no" or such :S

It's quite interesting that you don't have the same options. I'm going to make another toolchain from scratch today, I think i'll check it out all again.

About Xorg - it's a deadend I think. It does need some sort of PCI device probing - which is not available for Android. Now I'm going to try if I can just compile libraries and make the applications run - rather than complete X itself..

About PPL : Try to install it to your own machine (try something like sudo apt-get libppl* ) - maybe you need some headers or such for your host machine - it's definitely not something your toolchain wants :)

BTW: You wrote "sudo apt-get install build-essential" before right? - I should've told this, in order to build anything from source, you need it ..
[Desire Android Development] Droidzone:
Removing "graphite loop optimizations" made it build without cloog..

So it finally fails at this one:
[Desire Android Development] theGanymedes:
It shows that it couldn't validate version of the linux kernel. Just open a terminal, go to the kernel directory and write "make ARCH=arm menuconfig". After writing this, look through all options - you shall find one that allows you to pick your board model, cpu model etc. Pick board model as Qualcomm/msm and as cpu model pick qsd8x50. Sorry that I don't know the exact names of the options.

After this, quit from that menu with esc-esc keys, and save config. The other options are unnecessary, just board and cpu type is all we need.

Now, write make ARCH=arm CROSS_COMPILE=arm-linux- . It's going to fail, but will create the necessary version files and this was all we need. Now you can use crosstool-ng.
[Desire Android Development] Droidzone:
How long have you been building? You know everything!! :D
[Desire Android Development] Droidzone:
Props to you!

[STATE] ./arm-msm-linux-gnueabi/debug-root/
[STATE] Saving log file
[INFO ] =================================================================
[INFO ] Cleaning-up the toolchain's directory
[INFO ] Stripping all toolchain executables
[EXTRA] Installing the populate helper
[EXTRA] Installing a cross-ldd helper
[EXTRA] Creating toolchain aliases
[ALL ] `arm-linux-addr2line' -> `arm-msm-linux-gnueabi-addr2line'
[ALL ] `arm-linux-ar' -> `arm-msm-linux-gnueabi-ar'
[ALL ] `arm-linux-as' -> `arm-msm-linux-gnueabi-as'
[ALL ] `arm-linux-c++' -> `arm-msm-linux-gnueabi-c++'
[ALL ] `arm-linux-c++filt' -> `arm-msm-linux-gnueabi-c++filt'
[ALL ] `arm-linux-cc' -> `arm-msm-linux-gnueabi-cc'
[ALL ] `arm-linux-cpp' -> `arm-msm-linux-gnueabi-cpp'
[ALL ] `arm-linux-ct-ng.config' -> `arm-msm-linux-gnueabi-ct-ng.config'
[ALL ] `arm-linux-g++' -> `arm-msm-linux-gnueabi-g++'
[ALL ] `arm-linux-gcc' -> `arm-msm-linux-gnueabi-gcc'
[ALL ] `arm-linux-gcc-4.5.1' -> `arm-msm-linux-gnueabi-gcc-4.5.1'
[ALL ] `arm-linux-gccbug' -> `arm-msm-linux-gnueabi-gccbug'
[ALL ] `arm-linux-gcov' -> `arm-msm-linux-gnueabi-gcov'
[ALL ] `arm-linux-gprof' -> `arm-msm-linux-gnueabi-gprof'
[ALL ] `arm-linux-ld' -> `arm-msm-linux-gnueabi-ld'
[ALL ] `arm-linux-ldd' -> `arm-msm-linux-gnueabi-ldd'
[ALL ] `arm-linux-nm' -> `arm-msm-linux-gnueabi-nm'
[ALL ] `arm-linux-objcopy' -> `arm-msm-linux-gnueabi-objcopy'
[ALL ] `arm-linux-objdump' -> `arm-msm-linux-gnueabi-objdump'
[ALL ] `arm-linux-populate' -> `arm-msm-linux-gnueabi-populate'
[ALL ] `arm-linux-ranlib' -> `arm-msm-linux-gnueabi-ranlib'
[ALL ] `arm-linux-readelf' -> `arm-msm-linux-gnueabi-readelf'
[ALL ] `arm-linux-size' -> `arm-msm-linux-gnueabi-size'
[ALL ] `arm-linux-strings' -> `arm-msm-linux-gnueabi-strings'
[ALL ] `arm-linux-strip' -> `arm-msm-linux-gnueabi-strip'
[EXTRA] Removing access to the build system tools
[INFO ] Cleaning-up the toolchain's directory: done in 2.37s (at 18:08)
[INFO ] Build completed at 20111030.223937
[INFO ] (elapsed: 18:08.05)
[INFO ] Finishing installation (may take a few seconds)...
droidzone@supernova:~/compile/crosstool/bin$

Whew....finally! :D
[Desire Android Development] theGanymedes:
No, actually, I was to say "don't use 4.5 .. It's the most buggiest Gcc I've ever seen" :)

Instead, at the Crostool-ng, you shall see, as an experimental option, "use linaro versions" option- use it. Allegedly, it's a better developed one.

You can also cross-compile a gcc version you want yourself with the cross-compiler you have now; then replace everything at your toolchain directory with it (/home/<yourname>/x-tools directory, normally).

Also, next time try to use "--disable-werror" option of GCC - because as I see, the errors you take are actually just warnings.. :/ (You an also un-pick "disable warning messages as errors" option at kernel's menuconfig).

Me? I'm just compiling for 1 month or so now; weirdly I kinda got the process a little bit - the other half is just google :)

I want to say a few words from here as well: linux community is the weirdest community I've ever seen. People create stuff and then magically expect you to understand everything like they did - I've seen so many "erase and then reinstall" kinda empty comments; this is just annoying. It's precisely why I want to help people about - cos I know how annoying it is to try to do everything yourself.

EDIT: Yeah, I guessed right: even your GCC warns you :" cc1: warnings being treated as errors "
[Desire Android Development] Droidzone:
Ah...Dont worry..This time I've added gcc 4.6.2. Let's see how it goes. :D
[Desire Android Development] Droidzone:
I found out how to do that from cmd line for a single gcc build. But how does one set that when there are Makefiles and multiple Kconfigs? I'm trying to compile a kernel, and the msgs are disturbing.. :)
[Desire Android Development] theGanymedes:
Well, hate to say that but, you took the long way : There was an option in kernel menuconfig (invoke with "make ARCH=arm menuconfig") and there was a "system type" menu. Under it, there was "Force Warning as Error" option; just untick it and you're done :)

The defined but unused warning is nothing important - for since crostool-ng compiles your gcc with -O2 optimization (which produces faster binary by altering some codes), it sometimes makes some variables unnecessary - don't make a big deal out of it ;)
[Desire Android Development] Droidzone:
True. But a lot of stupid warnings mean that I might miss other real warnings.. :)

Yes, I see that option now..but no issues. I learned a lot of things now, that I previously didn't know..

Wow..having my own toolchain feels really great! I have even the latest gcc. :)

TouchPal-d from my Desire running Supernova Extreme Rom - 450 apps and counting. .
[Desire Android Development] Droidzone:
Did you actually try compiling a native app from within the Desire..can it handle it? :)

TouchPal-d from my Desire running Supernova Extreme Rom - 450 apps and counting. .
[Desire Android Development] theGanymedes:
Theoretically, it should. LibC works well, right? :)

I never knew I was going that far before. Right now, I'm thinking of feddling with Debian Kernel and ramdisk to see if I can make it work for Desire too. Bad thing is, I know very little about linux kernel yet, so I don't know how can I make kernel output printed to the screen (because this HTC Logo hides everything and ADB is not available in standard Debian. Can try to patch it in sometimes, but well, we'll see)

About GCC; well, I can compile it sometime - next week maybe - to see. It might be better to compile some applications at native host, anyway ;)

EDIT: Eheh, you can even compile qemu to run x86 applications under Desire .. Funny :D (no graphics yet tho, Xorg still pending.. :/ )
[Desire Android Development] Droidzone:
Try...

dmesg | tail

from the shell

And printk from within the source

You can even load an init.d script to write dmesg | tail > /sdcard/somefile
[Desire Android Development] theGanymedes:
Didn't know dmesg.. it can help - hey I can even make it out to USB terminal /dev/ttyMSM thingy to read from usb - this seems like can lead to something.

Well, by the way, I've gone a little astray guys because I'M INSTALLING DEBIAN TO MY DESIRE AS WE SPEAK!!! :D :D :D

After this is done, I'm going to try to integrate Android into linux - instead of trying to do inverse. After all, Zygote is just a binary, right :)

Wow, God, I love meddling with those stuff :D
[Desire Android Development] Droidzone:
Did it install?

TouchPal-d from my Desire running Supernova Extreme Rom - 450 apps and counting. .
[Desire Android Development] theGanymedes:
Living some problems at booting it, it did install but I somehow can't make kernel boot it natively..

I don't want to edit ramdisk, do it without it but we'll see..

EDIT: Did it! I just missed a few things first time :) Damn, it booted into Debian; now I can merge it with Android!
[Desire Android Development] Droidzone:
Wow...any photos? You can put it on the OP...

A qn which is not exactly on topic:

Suppose I want to setup crosstool-ng to build for my linux machine, where do I get the C library headers from? (string.h and so on)
[Desire Android Development] theGanymedes:
it's in the GlibC package, you can install it with "make install_headers DESTDIR=/some/place" - you should make the configure according to your machine, though).

Well, this thing definitely became helpful: Xorg didn't work on android because of Kernel - it lacked Virtual Terminal support... Now I compiled one using Gingercakes' source, with VT, and shall test it now (some posts about Nexus shows success, why not Desire? ;) )

Screenshots? I'll look into that :P ;)

Apropos, I learned "sendevent" during this process (while examining /dev).. It's awesome that actually you can emulate commands with ADB. I can make a "remote controller" application for PC with this - I already can unlock my phone and switch thorough screens with it :D - touchscreen needs a little more examination tho :) )
[Desire Android Development] Droidzone:
What did you write to do that?

TouchPal-d from my Desire running Supernova Extreme Rom - 450 apps and counting. .
[Desire Android Development] Droidzone:
Thinking whether busybox can actually be integrated into the kernel source

TouchPal-d from my Desire running Supernova Extreme Rom - 450 apps and counting. .
[Desire Android Development] cdesai:
Didn't read the whole thread yet but there is a way to execute scripts before init(better than init.d)

In the Kennel ramdisk, rename init to init.original and make a new file named init

contents of the new init file

#!/sbin/sh

# OR /system/bin/sh

all what you want to do here

# below line at end of the file

exec /init.original