Page 1 of 2

gmp and mpfr ?

Posted: Mon Mar 26, 2012 11:24 am
by Sam111
I am trying to finish building this cross compiler.

But I am getting these errors

Code: Select all

configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.

when I execute

Code: Select all

./configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers
I have tried googles advice in the error message

Code: Select all

./configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/usr/lib/libgmp.so --with-mpfr=/usr/lib/libmpfr.so
But I got the same error.
Note building binutils was rather easy to build if I use the 2.20 version.

I am using the gcc-4.3.5 (4.3.x that was suggested on the tutorial of osdev)

So I don't know how to clear up this problem yet.

Note also I don't think this is a big issue but I am compiling gcc and binutils on partition 2 and partition one is where all the programs , lib's ,...etc folders are installed.

The only other thing I can think of is when I did a search for gmp in the /usr/lib folder I have a couple of different options I believe like libgmp.so.3 , libgmp.so.3.5 ,...etc I just chose the libgmp.so and libmpfr.so. But if they are not the right ones please in form.

I can try to reinstall gmp , mpfr but the package manager say's they are already installed.

I see in the error
checking for correct version of gmp.h... no


seems like I need to install or get the correct gmp version. But I don't know what that should be or if I already have it installed somewhere.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 12:15 pm
by Sam111
I found this on your tutorials
http://wiki.osdev.org/Cross-Compiler_Successful_Builds

Looking at this I see that maybe I should just try a different version that is not a ? and is more known to work.

But my main question is why does the other versions not work.
Is it physically that the makefile at those times is inconsistent with being able to make a cross compiler with the source files in gcc/binutils and could never be worked around without a ton of modifications? Essentially making one of the versions into a good workable version interms of the source code. (Basically I want to know if there is away to get any version working with a couple modifications or is it probably the fact that the whole code or large portions of the code have to be rewritten/modified/updated to ever be able to work. Thus making it not worth try for the most parts on the ? )

I see I am getting these common mpfr and gmp command errors every time would be nice to know why they separated this floating point stuff out of the original build of gcc and would also be nice to know how you usually go about fixing these issues?

Question 2)
Is there a place where they already have downloads of pre-built cross compilers for all host machines for every different compiling arch wanted. Would be nice to beable to just go and download tar file with all the binary already pre-built. No need to have to download the sources every time and compile/build every time you want to make a cross compiler. Doesn't make since lot of wasted time. When we have trillions of sites out there whats one more with all the downloads for everything. Because I after building a cross compiler a couple of times a really don't see the point in having to do it every time once you know how to do it why reinvent the wheel every time.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 12:28 pm
by Sam111
I have read the error message problem is don't know what I have to do to fix it.
Since gmp and mpfr is installed there .so are in the /usr/lib folder as usual and I have specified --with-gmp=/usr/lib/libgmp.so , with-mpfr=,..etc etc

So if nobody knows I am justing going to try another version and see if that works.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 12:35 pm
by Solar
Quite obviously you are not able to follow one of the most proof-read tutorials anyone could possibly offer.
Sam111 wrote:But my main question is why does the other versions not work.
It's quite likely they do. The "?" expresses that none of us here has so far tried that particular combination. If you intend to try one, you should ask yourself why you'd like to pair a binutils and GCC version that was not released at roughly the same time.

I'll ignore the rest of your question. I always debug only the first error message. :twisted:
Is there a place where they already have downloads of pre-built cross compilers for all host machines for every different compiling arch wanted.
No.
Would be nice to beable to just go and download tar file with all the binary already pre-built.
And a .tar file for x86, a .tar file for x64, a .tar file for ARMv8, a .tar file for PowerPC, a .tar file for SPARC, or a .deb file for one of those architectures, or a .rpm file for one of those, just a different libc version if you please, and that's one of the reasons why no-one bothers to host all the countless possible combinations.

You get the version hosted by your platform targeting your platform through your package manager. Please see Why do I need a cross-compiler? for reasons why we recommend not using that "system" compiler for OS development.

Then please continue to Required Knowledge and reconsider if this forum is really a good place for you.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 2:11 pm
by gravaera
Just stop replying to him...

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 4:23 pm
by brain
I don't understand how someone could have posted over 350 posts and still be getting hung up on the basic stuff you should have down at 'hello world'?...

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 6:06 pm
by TylerH
What OS are you using? I've never actually had it complain with GMP and MPFR installed from the package manager (with Fedora and Ubuntu).

Just install them from the package manager and run the commands exactly as they are in the tutorial.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 9:38 pm
by Sam111
well, I reinstalled gmp and mpfr and updated all my packages.

When I build again I get binutils building fine, gcc made fine.
But when I do make install for gcc I get

Code: Select all

....
make[3]: Entering directory `/media/disk2/gcc-4.4.3/host-i686-pc-linux-gnu/libiberty/testsuite'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/media/disk2/gcc-4.4.3/host-i686-pc-linux-gnu/libiberty/testsuite'
make[2]: Leaving directory `/media/disk2/gcc-4.4.3/host-i686-pc-linux-gnu/libiberty'
/bin/bash: line 3: cd: arm-linux/libstdc++-v3: No such file or directory
make[1]: *** [install-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/media/disk2/gcc-4.4.3'
make: *** [install] Error 2

However it looks like everything is installed correctly and works

I have under ../binout/arm-linux/bin

Code: Select all

ar  as  c++  g++  gcc  ld  nm  objcopy  objdump  ranlib  strip
and

And under ../binout/bin

Code: Select all

arm-linux-addr2line  arm-linux-cpp        arm-linux-gcov     arm-linux-objdump  arm-linux-strip
arm-linux-ar         arm-linux-g++        arm-linux-gprof    arm-linux-ranlib
arm-linux-as         arm-linux-gcc        arm-linux-ld       arm-linux-readelf
arm-linux-c++        arm-linux-gcc-4.4.3  arm-linux-nm       arm-linux-size
arm-linux-c++filt    arm-linux-gccbug     arm-linux-objcopy  arm-linux-strings
just curious why the error

Code: Select all

/bin/bash: line 3: cd: arm-linux/libstdc++-v3: No such file or directory
make[1]: *** [install-target-libstdc++-v3] Error 1
if everything is good.

I am using the binutils/gcc versions that are one version +- my gcc building compiler.

I am picky about seeing errors.

And yes I have learned my lesson it is a nightmare to build old or versions that are not around your build gcc compiler version.
Or at least versions that use libc and then ones that use glibc
and then the issue with the old versions not having gmp, mpfr and new versions need them...etc
either way all most set with building cross compilers

hell I got an old old version to go but I had to change in tc-arm.c
a few fucking lines of code like this

Code: Select all

as_bad (_(reg_expected_msgs[REG_TYPE_RN]));
to

Code: Select all

as_bad ("%s", _(reg_expected_msgs[REG_TYPE_RN]));
jesus do gcc guys have to fucking create another version every 5 fucking seconds.
god if people didn't change code that everybody depends on the world would be more portable.
plus in theory how much **** can you add on to gcc once you have all the supported archs , extension MMX SSE ,1,2,3,4,...etc , and really great to almost perfect optimizing code techniques. I mean at this point your just sacrificing usability just screwing around with the code.
GCC DONE UNTIL A NEW ARCH NEEDS TO BE ADD , REALLY PLEASE DON"T ADD ANY MORE **** INTO GCC C/C++ IS BETTER STOPPING WHERE IT IS RIGHT NOW INTERMS OF BUILTINS ,...etc etc since eventually the language itself over time is just going to be more complex and no one person will beable to know it all. Not to mention readability/maintainability of c programs sometimes change is not always good

Anyway the make install is my only real issue. I don't think it is actually a problem but I do want to know why its there.

next I think I am going to give newlibs a go it looks not to much harder that would allow me to connect up my syscalls and have my own c library for my target arms os that is :)

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 9:49 pm
by TylerH
Try "make install-gcc." Make install tries to install a whole system STL and all, and you didn't build that, you only built the compiler itself, no libraries.

It's possible to use Newlib to enable you to compile libstdc++-v3, but I would just get it working before I attempt that, if I were you.

Also, if you don't like the design of GCC, look into using LLVM/Clang. I recently switched to Clang, because it supports __attribute__((naked)) for x86 and is overall a better designed compiler.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 10:41 pm
by Sam111
I have built LLVM compiler though I haven't tried it out yet.

I am building cross compilers with gcc more for knowing how to do it.

I don't know what compiler I am going to use probably stick with gcc since I am most familiar with its c/c++ syntax's
But I have to say LLVM is really easy to build and from what I understand it is a cross compiler itself allowing you to specify a target different then your machine target.

darn make install-gcc thats right under the make all-gcc I used right on osdev. (I always screw up those stupid things hell its been along day) thanks though I think I got it post back when I know for sure.
But see this is the stuff I mean if you are on an old version or some other thing how are you suppose to know what make targetname you need.

make files ,...etc etc are a perfect example of people building to many options in a tool thats main point is just to make updating compiled large projects take not so long. Don't get me wrong make , cmake ,...etc are great tools but it should have a very basic set of options/syntax commands. So it would be easy for everybody to modify/follow the code. Eventually makefile writers are going to get to a point where they cannot even understand/maintain it. And it makes my life harder to read thru all of it when it comes to that.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 11:09 pm
by Solar
Sam111 wrote:I don't know what compiler I am going to use probably stick with gcc since I am most familiar with its c/c++ syntax's
:|

The "C/C++ syntax" of all compilers around the world is identical. Some compilers implement compiler-specific extensions, but those are by definition not "C/C++ syntax", few and far between, and usually easily replaced by some other, standard construct.
make files ,...etc etc are a perfect example of people building to many options in a tool thats main point is just to make updating compiled large projects take not so long. Don't get me wrong make , cmake ,...etc are great tools but it should have a very basic set of options/syntax commands. So it would be easy for everybody to modify/follow the code.
Dude, seriously. Drop that before you hurt yourself. Again, I have to point to Required Knowledge. If you complain that the average Makefile is too difficult to read, and given your track record here so far, you lack the experience to make this happen.

It would be nice if you could at least acknowledge that several people on this board have been warning you. There's some suspicion building that you might just be trolling us, which could lead to uncomfortable consequences.

Re: gmp and mpfr ?

Posted: Mon Mar 26, 2012 11:54 pm
by Sam111
Ok, well i got my binutils and gcc to build for my cross compiler.

I want to test it out so I used.

Code: Select all

int main(void)
{

    return 0;
}

then issued

Code: Select all

arm-linux-gcc testarm.c -o armout
got

Code: Select all

/media/disk2/binout/lib/gcc/arm-linux/4.4.3/../../../../arm-linux/bin/ld: crt1.o: No such file: No such file or directory
I know that crt1.o is the stuff that usually calls the main routine.

I am more wondering what you can do with this cross compiler seems to me you cann't build anything with it. (left out #include or libraries)
Do you have to do Step 2 - C Library to make it useable?
Or can you get a simple program running without having to get newlib running.

question
1) Like for example if I just wanted to make a cross compiler to develop application level programming

Re: gmp and mpfr ?

Posted: Tue Mar 27, 2012 12:25 am
by Solar
Because he neither really understood "targets", nor did he read the Wiki material carefully (as virtually all his questions so far are answered there).

Re: gmp and mpfr ?

Posted: Tue Mar 27, 2012 2:28 am
by Combuster
Can't we just borrow the banhammer for this guy and get it over with?

Re: gmp and mpfr ?

Posted: Tue Mar 27, 2012 4:05 am
by bubach
Combuster wrote:Can't we just borrow the banhammer for this guy and get it over with?
For what, ignorance? It's not like he's flooding the forums with questions like Yasha/KernelX did - this is nicely distributed over a longer period of time. ;)