Compiling newlib

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Velovix
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 11
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Tue Nov 27, 2012 12:19 am
Has thanked: 0
Been thanked: 0

Compiling newlib

Post by Velovix »

A little less than a year ago I got the DC toolchain working correctly, but now I've forgotten what I did. Specifically, I'm having a hard time setting up newlib. I tried to compile it with the following commands:
../src/configure --srcdir="../src/configure"
make

With a filesystem looking like this:
newlib
|__src (where I extracted newlib 2.0)
|__bin (empty directory at first, and where I'm at)

This results in the creation of some files, but nothing compiled.

I'm sure that I'm missing quite a bit here (like a target to give the configure script), but I can't find any resources explaining what parameters I should be using. Any direction would be appreciated!
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Compiling newlib

Post by BlueCrab »

If you're planning on using KOS, you probably should look at the utils/dc-chain directory. There's a Makefile in there that will do all the heavy lifting for you (including applying the required newlib and gcc patches before building them).

If you're not planning on using KOS for some reason, you could look at the Makefile in there for reference of what arguments are useful to pass to the various configure scripts for binutils, gcc, newlib, and gcc again.

Generally, you're looking for some subset of the following (depending on what package you're trying to build):

Code: Select all

--target=sh-elf --prefix=/opt/toolchains/dc/sh-elf --with-newlib --disable-libssp --disable-tls --enable-threads=kos --enable-languages=c,c++,objc,obj-c++ --with-multilib-list=m4-single-only,m4-nofpu,m4 --with-endian=little --with-cpu=m4-single-only
For newlib specifically, you'll need the target, prefix, multilib-list, endian, and cpu ones most likely (unless you didn't give the last three when you built your sh-elf-gcc, then you'd leave them off here too).
Velovix
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 11
Joined: Tue Nov 27, 2012 12:19 am
Has thanked: 0
Been thanked: 0

Re: Compiling newlib

Post by Velovix »

BlueCrab wrote:If you're planning on using KOS, you probably should look at the utils/dc-chain directory. There's a Makefile in there that will do all the heavy lifting for you (including applying the required newlib and gcc patches before building them).
I am planning on using KOS, and after taking a good look at the stuff in dc-chain, I see that the scripts take care of grabbing and building everything themselves. I was thinking that Newlib/Binutils/etc. were prerequisites before doing anything KOS-related, but looks like I was mistaken. That's very convenient! Thank you for the clarification!

While I have you all on the horn, I have to ask: Why don't newer versions of GCC work for KOS? Is it just that nobody has updated the patches yet, or is there some issue with the post-4.7.4 versions that make them unusable?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Compiling newlib

Post by BlueCrab »

The 4.8.x series has a rather ugly regression for the SuperH processor. This bug was fixed (I think?) in the 4.9.x line, but considering I've seen some rather ugly bugs reported on x86, it doesn't appear that 4.9.x is particularly all that stable to start with.

We often end up multiple versions behind for various reasons. Bugs are often among the reasons. Also, usually there's not all that much benefit with updating anyway, not enough to outweigh the amount of testing that people end up needing to do to make sure that everything works.
Ayla
DC Developer
DC Developer
Posts: 142
Joined: Thu Apr 03, 2008 7:01 am
Has thanked: 0
Been thanked: 4 times
Contact:

Re: Compiling newlib

Post by Ayla »

GCC 4.9.1 might be worth a try. It gives a great boost of performance on MIPS, it should be the same for the SH4 (as both aren't really "lively" archs, it's probably due to high-level optimizations).
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling newlib

Post by SWAT »

Ayla wrote:GCC 4.9.1 might be worth a try. It gives a great boost of performance on MIPS, it should be the same for the SH4 (as both aren't really "lively" archs, it's probably due to high-level optimizations).
GCC 4.9.1 works very good on SH4 too, I see boost of performance in the new version of my project. I recommend use it!

BlueCrab, I can upload GCC 4.9.1 patch for KOS toolchain if you want.
Image
Post Reply