Cross-compiler, libgcc, newlib

Programming, for all ages and all languages.
Post Reply
kr651129
Posts: 18
Joined: Fri Dec 02, 2011 11:02 pm

Cross-compiler, libgcc, newlib

Post by kr651129 »

Ok, this is driving me nuts. I'm able to make a flat cross compiler per the tutorial on FreeBSD 9.0 but every time I run

Code: Select all

gmake all-target-libgcc
gmake install-target-libgcc
I get errors (will post them later, I'm at work now)

I also can't port newlib with FreeBSD 9.0 as the host. I'm using all of the GNU tools for the build and I'm coming up with zilch.

I can however follow all of the tutorials step by step with no errors on cygwin.

Can someone tell me what I'm missing or point me in the right direction?

edit:
I meant to say I was using gmake not make
Last edited by kr651129 on Sun Jul 01, 2012 12:19 am, edited 1 time in total.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Cross-compiler, libgcc, newlib

Post by Brynet-Inc »

If you don't have the error output handy, what's the point of posting an incomplete message?

Because we're left guessing.. FreeBSD doesn't use GNU make, it's possible that the libgcc target of that particular version of gcc is broken.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Cross-compiler, libgcc, newlib

Post by bluemoon »

I get solutions (will post them later, I'm at holiday now) :mrgreen:

Anyway, newlib build with provided compiler as-is, so it probably drag in FreeBSD stuff if you configure to use the hosted compiler directly. You may either use a clean cross-compiler toolchain or provide enough flag to the configure script to specify a freestanding environment.
kr651129
Posts: 18
Joined: Fri Dec 02, 2011 11:02 pm

Re: Cross-compiler, libgcc, newlib

Post by kr651129 »

bluemoon -- thanks for the info! I'm looking forward to your solution when you get back.

Here is the error I'm getting

Code: Select all

$ gmake all-target-libgcc
...................
checking for suffix of object files... configure: error: in '/usr/home/kclark/build-gcc/i586-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See 'config.log' for more details.
config.log
http://pastebin.com/i8jMbQde
kr651129
Posts: 18
Joined: Fri Dec 02, 2011 11:02 pm

Re: Cross-compiler, libgcc, newlib

Post by kr651129 »

I compiled them all by themselves and put them In /use/local/cross then I pointed binutils.and gcc to them.
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Cross-compiler, libgcc, newlib

Post by Griwes »

kr651129 wrote:bluemoon -- thanks for the info! I'm looking forward to your solution when you get back.
bluemoon was trolling you, wasn't he?
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross-compiler, libgcc, newlib

Post by Solar »

Code: Select all

See 'config.log' for more details.
The log of what configure actually tried to do, and what the real error was, is the section after "## Core tests. ##", up to the section "## Running config.status. ##".

I always wonder how people miss this "hint". It cannot be any more obvious, really.
Every good solution is obvious once you've found it.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Cross-compiler, libgcc, newlib

Post by JamesM »

config.log is a hairy mess not really obviously easy to parse.
It really is all kinds of nasty. My technique is to reverse seach for "error" from the end. That usually gets the "right" erroring command.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross-compiler, libgcc, newlib

Post by Solar »

Seconded, it's not exactly easy. That's why I memorized "Running config.status". That's where the configure log ends and the environment dump begins.
Every good solution is obvious once you've found it.
JessyV
Posts: 4
Joined: Thu Mar 01, 2012 9:56 am

Re: Cross-compiler, libgcc, newlib

Post by JessyV »

Personnally, I'm on Windows (by obligation, not by choice ;) using TDM MinGW/MSYS and I've never used FreeBSD, but I already had problems making a cross-compiler.

Before anything else : http://wiki.osdev.org/GCC_Cross_Compiler

What actually matters ? The configure script or the make execution ?
If it is the configure script, the primary reason of configure failing could be that FreeBSD's shell is not compatible. You should use GNU Bash, which is known to be compatible. I don't know, however, how this is done, but it should be as simple as downloading the package from the GNU mirror FTP site,, unpacking it somewhere, doing a configure in a separate directory, doing make all and make install, and then prefixing ./configure of the name of the GNU Bash executable to ensure FreeBSD shell doesn' try to execute it by itself. If this works, skip the rest of this post.
Also, the make program is not in fault as the O.P. is using GNU make (I see it in the 'gmake' command) which is the preferred make program of all GNU programs, including GCC.

If it still doesn't work, I would recommend to use Binutils v2.22/GCC 4.6.3 (GCC can be higher, but it worked for me with 4.6.3). Just look at this table : http://wiki.osdev.org/Cross-Compiler_Successful_Builds .

Unpack the binutils to, say, /usr/src/binutils-2.22 and build them passing to the configure prefix your --prefix=* plus the --disable-nls (NLS support just gave me problems, while not being so useful to me, though my native language is French (fr-fr), I'm nearly 16 and actually speak English quite well, I think this is a bare minimum when thinking of lerning programming, as much of the documentation is written in Shakespeare's language).

Then, unpack gcc to, say, /usr/src/gcc-4.6.3. Then, unpack GMP MPFR and MPC to, respectively, usr/src/gcc-4.6.3/gmp, usr/src/gcc-4.6.3/mpfr and /usr/src/gcc-4.6.3/mpc. This will ensure that they are built with all the correct settings for GCC, and will avoid confusion with the options.
Also, think of getting the source code for libiconv and unpacking it to usr/src/gcc-4.6.3/iconv. I didn't have to do this as Windows doesn't use libiconv and lets MinGW use it's own which is the same for all programs. However, I heard that on FreeBSD, the system's version could not work, be found, or something in ths kind. This similarly ensures that it is built accordingly for GCC to use.

For GCC, you should configure it with the usual --prefix, plus --disable-nls to match the binutils configuration, --enable-languages=c (or =c,c++ if you want C++, that's up to you to decide), and eventually --without-headers if neded.
You don't need to add anything as the GMP/MPFR/MPC/iconv libraries will be found automatically.

If that still doesn't work, please send us the precise error messages that you get.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross-compiler, libgcc, newlib

Post by Solar »

Hmm... wouldn't the simplest thing be to have mpc / mpfr / gmp installed by the system package manager? You don't need them on the target (or cross) side, only on the host side, and the package manager is usually better-tested at providing packages than any tutorial-driven manual compile...
Every good solution is obvious once you've found it.
Post Reply