Page 2 of 3

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 12:26 am
by sortie
MonaLisaOverdrive wrote:The cross compiler is the only gcc installed. Are you saying that I need to install gcc for the build system (i.e. CentOS)?
Wait. So what you are saying is: 1) You don't have a gcc that produces executables for your build system 2) You complain that when cross-compiling gcc it fails to produce executables for your build system.

Do you see your problem? Yes, you really *do* need a native gcc here.

@dozniak: It's *very* unlikely that gcc has these cross-compilation problems, I can assure you that it is tested very often whether it cross-compiles properly.

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 3:52 am
by MonaLisaOverdrive
dozniak wrote:Yes, for example arm-none-eabi is valid. (Also, switching a project of size of gcc from autotools is probably over one week of work).[/code]

Which makes sense...but is it acceptable to hard-code it in such a way that it overrides the --build and --host specified in the top level Makefile?
Or is this a special case for gmp because it needs to have 'none' as the processor specification?
dozniak wrote:Quick googling shows that gen-fac_ui is part of gmp and apparently has to be built using the native toolchain (afaict, it runs on the build machine during build to generate some constants).
Make sure you have host gcc and friends available.

*snip*
Just to make sure that I'm understanding the above:
1. I need the native (i.e. CentOS version) of gcc installed to build gen-fac_ui
2. When you say 'have the host gcc/binutils available' you mean the Android NDK cross toolchain I am currently using?

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 4:24 am
by Combuster
host gcc = gcc running on your host, and building for your host

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 5:58 am
by MonaLisaOverdrive
Progress! Sort of.

Installed gcc 4.7 from the devtoolsrepo and configured appropriate symlinks and PATH. Now (thanks all!) I'm using the native gcc to build gen-fac_ui...but now it won't build.

Good news: It seems like a simple missing headers issue
gen-fac_ui.c:20:19: fatal error: stdio.h: No such file or directory

Bad news: Where do I find that header?

Headed off to look now...

EDIT: May have found them in the devtoolset repo....

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 8:30 am
by MonaLisaOverdrive
sortie wrote:
MonaLisaOverdrive wrote:The cross compiler is the only gcc installed. Are you saying that I need to install gcc for the build system (i.e. CentOS)?
Wait. So what you are saying is: 1) You don't have a gcc that produces executables for your build system 2) You complain that when cross-compiling gcc it fails to produce executables for your build system.

Do you see your problem? Yes, you really *do* need a native gcc here.

@dozniak: It's *very* unlikely that gcc has these cross-compilation problems, I can assure you that it is tested very often whether it cross-compiles properly.
To be fair, I *did* ask in one of my initial posts if I needed a native gcc. And I wasn't aware until doziak posted that gen-fac_ui needed to be built to run on the build system. By the way doziak, if you have the link with that info handy could you post it? I'll add it to the informal documentation i'm building.

At any rate, I've installed gcc for my build system again. I'd installed an older version previously when I ran into this issue, I've installed a version closer to the gcc source I'm trying to build.

Unfortunately, I've run into the same error now as I did before:

gen-fac_ui.c:20:19: fatal error: stdio.h: No such file or directory

I couldn't figure out why it couldn't find that header before and I can't seem to figure it out now. There are a number of stdio.h files on my system in various locations, but even when I set the path to what I hope is the correct stdio.h file, I still get the same error.

I'm wondering if I need to symlink the stdio.h in the gmp/ directory...and if so, which one.

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 9:08 am
by dozniak
MonaLisaOverdrive wrote:gen-fac_ui.c:20:19: fatal error: stdio.h: No such file or directory
stdio.h is part of libc, you need some development package like libc-dev.
MonaLisaOverdrive wrote:By the way doziak, if you have the link with that info handy could you post it? I'll add it to the informal documentation i'm building.
I just googled up the source file itself. Since you're building gmp, it should be right there on your machine. Reading it reveals that it generates some stuff for gmp.

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 10:05 am
by MonaLisaOverdrive
dozniak wrote:
MonaLisaOverdrive wrote:gen-fac_ui.c:20:19: fatal error: stdio.h: No such file or directory
stdio.h is part of libc, you need some development package like libc-dev.
MonaLisaOverdrive wrote:By the way doziak, if you have the link with that info handy could you post it? I'll add it to the informal documentation i'm building.
I just googled up the source file itself. Since you're building gmp, it should be right there on your machine. Reading it reveals that it generates some stuff for gmp.
What in the source told you that it would need to be built natively instead of for the host system? Was it the >mpz/fac_ui.h?

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 1:51 pm
by dozniak
MonaLisaOverdrive wrote:What in the source told you that it would need to be built natively instead of for the host system? Was it the >mpz/fac_ui.h?
For me, natively means "for the host system". The fact that compile script tries to run it during build is a clear indication it should be built for the host system.

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 3:02 pm
by sortie
The <stdio.h> header is basically the most common and iconic header of the C programming language, as it allows easily writing a Hello World program using printf. If your C compiler is installed correctly, it should just be able to use that header (otherwise, arguably, your C compiler isn't installed). If you fail to install a local gcc that can compile trivial programs - that's not a question for this forum, that's something you'd need to consult your distribution's documentation for. That said - the part where you cross-compile GCC is kinda relevant (although, an Android development community would likely be more appropriate).

@dozniak: You say "host" system, when you really mean "build system". The goal here is that build=linux-gnu host=andorid target=android. He needs to install the build compiler such that local programs can be built during the cross-compilation of GCC to android (cross-compiling the compiler).

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 3:16 pm
by MonaLisaOverdrive
dozniak wrote:
MonaLisaOverdrive wrote:What in the source told you that it would need to be built natively instead of for the host system? Was it the >mpz/fac_ui.h?
For me, natively means "for the host system". The fact that compile script tries to run it during build is a clear indication it should be built for the host system.
Now I'm confused again:

My build system (CentOS) and my host system (Android ARM) are different. I'm building a toolchain ON CentOS that will run ON Android ARM...i.e. cross compiling. The target is also Android ARM, so only build and host are different.

In the case above, do I still need a native gcc for build (CentOS)? Or, do I just need a cross-compile gcc for build?
sortie wrote:The <stdio.h> header is basically the most common and iconic header of the C programming language, as it allows easily writing a Hello World program using printf. If your C compiler is installed correctly, it should just be able to use that header (otherwise, arguably, your C compiler isn't installed). If you fail to install a local gcc that can compile trivial programs - that's not a question for this forum, that's something you'd need to consult your distribution's documentation for.
I installed the RedHat developer gcc toolset because the CentOS 6.2 repos only had gcc 4.4.7. Relevant link: https://access.redhat.com/site/document ... r_Toolset/

It is installed in /opt/..., but I've symlinked gcc in /usr/bin...which is where the GMP configure script looks for the build GCC by default.

I also verified that the kernel-headers and kernel-devel installed package versions matched the kernel version I'm running. I also ran 'yum info lib*-devel | less' to look for a libc package...nada
sortie wrote:That said - the part where you cross-compile GCC is kinda relevant (although, an Android development community would likely be more appropriate).
I actually hit up the Android devel communities over at stackoverflow...no luck so far over the past two days. I'll keep trying, but for now I want to make sure I've got the correct tools installed for what I'm trying to do. I don't think that's specific to Android, but I could be wrong.
sortie wrote:@dozniak: You say "host" system, when you really mean "build system". The goal here is that build=linux-gnu host=andorid target=android.
Clarification: I already have a GCC toolchain installed that runs on my build system (CentOS) but targets the host system (Android ARM). What I'm trying to determine is if I need to keep the GCC toolchain I *just* installed, which runs on build (CentOS) and targets build (CentOS).
He needs to install the build compiler such that local programs can be built during the cross-compilation of GCC to android (cross-compiling the compiler).
She, actually. Eh...tomato, tomahto...

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Tue Oct 08, 2013 6:21 pm
by MonaLisaOverdrive
Mother pussbucket....

Code: Select all

[tom@localhost arm-gcc]$ yum list *libc*      <----------- durrr...maybe wildcard after AND BEFORE
Failed to set locale, defaulting to C
Plugin "refresh-packagekit" can't be imported
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.lstn.net
 * centosplus: mirrors.bluehost.com
 * contrib: centos.mirror.constant.com
 * extras: mirror.team-cymru.org
 * updates: mirrors.usinternet.com
*snip*
Available Packages
*snip*            
glibc-devel.i686                                                         2.12-1.107.el6_4.4                                              updates          
glibc-static.i686                                                        2.12-1.107.el6_4.4                                              updates          
glibc-utils.x86_64                                                       2.12-1.107.el6_4.4                                              updates          
I could just kick myself...

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Wed Oct 09, 2013 2:41 am
by dozniak
MonaLisaOverdrive wrote: Clarification: I already have a GCC toolchain installed that runs on my build system (CentOS) but targets the host system (Android ARM). What I'm trying to determine is if I need to keep the GCC toolchain I *just* installed, which runs on build (CentOS) and targets build (CentOS).
You need CentOS toolchain building for CentOS, you need CentOS toolchain building for Android. That's all.

Re: Preliminary Question: OK To Ask Cross-Native Question H

Posted: Wed Oct 09, 2013 3:43 am
by MonaLisaOverdrive
dozniak wrote:
MonaLisaOverdrive wrote: Clarification: I already have a GCC toolchain installed that runs on my build system (CentOS) but targets the host system (Android ARM). What I'm trying to determine is if I need to keep the GCC toolchain I *just* installed, which runs on build (CentOS) and targets build (CentOS).
You need CentOS toolchain building for CentOS, you need CentOS toolchain building for Android. That's all.
Original problem (stdio.h no such file or directory) solved after figuring out how to use wildcards with 'yum list' AND that it would be helpful to have a native gcc along with the cross-compiler.

Off to figure out how to resolve an auto-build.h target issue...or lack thereof. Thanks all!

Re: Preliminary Question: OK To Ask...UPDATE: Build Success

Posted: Thu Oct 10, 2013 6:46 pm
by MonaLisaOverdrive
Quick Update:
Finally got it to build successfully. Install threw one error about target libgcc, but the gcc binaries were copied to the install location. Uploading the tarball now to download to Nook. Now I just need to pull together a 'hello world' to test.

Thanks again, everyone who posted, for your help and patience.

Re: Preliminary Question: OK To Ask...UPDATE: Build Success

Posted: Fri Oct 11, 2013 8:04 am
by sortie
Note that libgcc is mandatory for all code generated by gcc, so if you ported gcc to your android system, then you'd need a libgcc on that system too, especially if you wish to compile native programs.