Page 1 of 1

gcc cross-compiler

Posted: Sat Jun 06, 2009 5:31 pm
by ru2aqare
I don't know where this should be posted, so if it's in the inappropriate in this forum, please move it.

Anyway. I've followed the GCC cross-compiler tutorial to the letter. I was trying to compile binutils-2.18, gcc-4.4.0, and gmp-4.3.1 with mpfr-2.4.1 on Cygwin. Host compiler is

Code: Select all

$ gcc --version
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Following the tutorial, I've successfully built binutils, gmp and (following the MPFR tutorial) the static part of mpfr. Bulding the shared library fails with

Code: Select all

$ ../mpfr-2.4.1/configure --prefix=/usr/local --disable-static --enable-shared
checking for a BSD-compatible install... /usr/bin/install -c
... snip ...
checking for DLL/static GMP... static
configure: error: gmp.h isn't a DLL: use --enable-static --disable-shared
During the configure process, there were multiple outputs of "checking whether we are crosscompiling... no" - is this correct? I mean the tutorial should build a cross-compiler, not? However, the resulting GCC cross-compiler works correctly, so this combination of gcc/binutils should be marked as "ok" in the Wiki.

Another thing is that regardless whether I specify --without-headers or not, the cross-compiler can't seem to find the system include files. Passing the -I/usr/include option helps, but the stock Cygwin compiler doesn't require this option. Is there an easy way to remedy this? I know the tutorial was written in mind with that the cross-compiler will be used to compile the user's kernel sources, but I'm not using it for that (at least not for now).

Re: gcc cross-compiler

Posted: Sat Jun 06, 2009 7:36 pm
by frank
The error message suggests that you cannot build a shared version of MPFR without a shared version of GMP. I successfully build the static versions of both and the went on to build the latest cross compiler. MPFR and GMP and just libraries used by GCC to help with floating point support so neither of them need to be cross compiled.

Re: gcc cross-compiler

Posted: Sun Jun 07, 2009 6:21 am
by ru2aqare
frank wrote:The error message suggests that you cannot build a shared version of MPFR without a shared version of GMP. I successfully build the static versions of both and the went on to build the latest cross compiler. MPFR and GMP and just libraries used by GCC to help with floating point support so neither of them need to be cross compiled.
Will try to build a shared version of GMP, just for curiosity. My gcc compiled and works fine with just the static libraries, however; it's just that this step was in the tutorial...

Re: gcc cross-compiler

Posted: Sun Jun 07, 2009 8:01 am
by frank
I don't understand why those directions are even in there. GCC is the only thing I've found that uses those libraries so the space savings is null. If you do get MPFR to build with a shared GMP then please post so we can add it to the Wiki.

BTW did you try building GCC with GMP and MPFR from Cygwin? I tried and got a weird error message about gmp.h.

Re: gcc cross-compiler

Posted: Sun Jun 07, 2009 11:37 am
by ru2aqare
frank wrote:I don't understand why those directions are even in there. GCC is the only thing I've found that uses those libraries so the space savings is null. If you do get MPFR to build with a shared GMP then please post so we can add it to the Wiki.

BTW did you try building GCC with GMP and MPFR from Cygwin? I tried and got a weird error message about gmp.h.
I previously built gcc with static libraries of gmp (4.3.1) and mpfr (2.4.1) without a hitch in Cygwin. I followed the instructions on the Wiki and tried building shared libraries of both, and after long hours of compiling (if I run make -j2 the build eventually fails for some obscure reason) I finally built shared versions of both libraries, and the self-checks ran okay.

Anyway, I also think that the build instructions for the shared libraries are somewhat misleading (as in, building shared libraries of these two packages is not required to a gcc cross-compiler).