Problem when porting Newlib (toolchain binaries missing ?)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Problem when porting Newlib (toolchain binaries missing ?)

Post by fiveayem »

Hello,

I'm currently trying to port Newlib for my OS and I need you help because I cannot manage compile it. I first compiled successfully an i586 toolchain (GCC Cross-Compiler) and now I'm porting Newlib according to the instructions of this tutorial : Porting Newlib. I use Newlib 1.15.0 to be as close as possible to tutorial. After configuring, I fixed the Makefile, correcting the path to makeinfo, which was wrong ("/usr/src/newlib-1.15.0/missing makeinfo" instead of "/usr/bin/makeinfo"). Then, the compilation started well, with no error, no warning, but after a minute, I got an error saying that i586-elf-ar could not be found. I had set the following variables before configuring and compiling :

PREFIX=/usr/local/cross
TARGET=i586-elf
PATH=$PATH:$PREFIX/bin


I used the same variables to build binutils and gcc. The /usr/local/cross/bin directory contains the following binaries :

i586-elf-cpp i586-elf-gcc i586-elf-gcc-4.6.2 i586-elf-gcov

Any idea of where the problem comes from ?

Thank you for your help.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Problem when porting Newlib (toolchain binaries missing

Post by gerryg400 »

Does i586-elf-ar work when you type it from the command line ?

BTW, use the newest newlib.
If a trainstation is where trains stop, what is a workstation ?
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Re: Problem when porting Newlib (toolchain binaries missing

Post by fiveayem »

No, i586-elf-ar does not work. I will try with Newlib 1.20.0.
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Re: Problem when porting Newlib (toolchain binaries missing

Post by fiveayem »

Well, I get the same error with the last version.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Problem when porting Newlib (toolchain binaries missing

Post by gerryg400 »

Wait a minute, if it doesn't work then it's not installed or the path is wrong. It's not anything to do with new lib. Binutils is wrong.
If a trainstation is where trains stop, what is a workstation ?
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Problem when porting Newlib (toolchain binaries missing

Post by gerryg400 »

Have you tested your assembler/compiler/linker toolchain. I'd advise writing a few test programs and making sure all your paths are correct first before trying something like newlib.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Problem when porting Newlib (toolchain binaries missing

Post by Solar »

fiveayem wrote:i586-elf-cpp i586-elf-gcc i586-elf-gcc-4.6.2 i586-elf-gcov
That's all from the GCC package. Where is binutils? i586-elf-as, i586-elf-ld, i586-elf-ar, ...

It looks like your cross-binutils is utterly missing. Which begs the question, how did you actually build the crosscompiler? ;-)
Every good solution is obvious once you've found it.
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Re: Problem when porting Newlib (toolchain binaries missing

Post by fiveayem »

I'm going to build binutils again, then.
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Re: Problem when porting Newlib (toolchain binaries missing

Post by fiveayem »

Now I have built binutils again and I have got the necessary files in /usr/local/cross/bin directory, but I get the following error when compiling Newlib :

"i586-elf-gcc: internal compiler error: Segmentation fault (program as)"
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Problem when porting Newlib (toolchain binaries missing

Post by bluemoon »

As solar asked, how did you actually build the crosscompiler?

Specifically, what's your host platform, which versions of the tools, newlib and their and configure flags?

I'm not sure on gcc 4.6.2 but I'm using binutils 2.21, gcc 4.6.1 and newlib 1.19.0 and they works perfectly.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Problem when porting Newlib (toolchain binaries missing

Post by Solar »

fiveayem wrote:Now I have built binutils again and I have got the necessary files in /usr/local/cross/bin directory, but I get the following error when compiling Newlib :

"i586-elf-gcc: internal compiler error: Segmentation fault (program as)"
You could not have built the cross-compiler according to the tutorial, as that would have given you functional binutils executables in /usr/local/cross in the first place. That means your cross-compiler - if it even is a cross-compiler - was configured to use a different binutils backend.

Now you built the binutils - not "again", but for the first time in the right place - and suddenly the cross-compiler uses a different binutils backend, one it was not configured for.

My suggestion: Don't waste your time patching around. Delete /usr/local/cross, and re-build your toolchain from scratch.
Every good solution is obvious once you've found it.
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Re: Problem when porting Newlib (toolchain binaries missing

Post by fiveayem »

I changed my gcc and binutils version and I built the whole toolchain in /usr/local/cross directory. Now, it is OK, thanks.
Post Reply