KOS 2.0.1 + GCC 4.5.2

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.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

After many experiments and failures, I came to the conclusion that I need to roll back from 4.8.2 not to 4.7.3, need more, back to 4.5.2, this version has the fewest problems (after 3.4.6 of course, it's most stable!).
But I failed, latest KOS does not compile on GCC 4.5.2 (with newlib 2.0.0 of course), it's has a lot of errors on the structures - isp_settings_t, pw_isp_settings_t, tcp_sock etc...
This can be fixed? I'm tired of fighting with the mystical code behavior that is compiled on 4.7+.
With each new GCC version was getting worse and worse (it really trace dependencies).
I'm not trying to convince anyone, I just want to compile all code on 4.5.2 as before, in the hope that it will solve at least part of the problems.
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

If you're noticing bugs in the compiler, the best thing to do is to report them to the GCC developers, rather than simply rolling back to older versions of the compiler. If the compiler's producing broken code, then they need to know about it to be able to fix it. I haven't found anything really broken about GCC 4.7.3 myself on any of the machines I've built it on.

That said, you're going to have to elaborate more on the errors you're seeing. Nothing in KOS itself has really changed drastically since when the patch for GCC 4.5.2 was put into the dc-chain patches directory, so my best guess is that the problem lies in something that changed in Newlib between then and now. You might need to use Newlib 1.20.0, since that was the version that was used in dc-chain when GCC 4.5.2 was current.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

BlueCrab wrote:If you're noticing bugs in the compiler, the best thing to do is to report them to the GCC developers, rather than simply rolling back to older versions of the compiler. If the compiler's producing broken code, then they need to know about it to be able to fix it. I haven't found anything really broken about GCC 4.7.3 myself on any of the machines I've built it on.
I agree, this is the right way. But unfortunately I have not got time for this, I just need to speed up the process. Maybe later I'll get to that.
BlueCrab wrote:That said, you're going to have to elaborate more on the errors you're seeing. Nothing in KOS itself has really changed drastically since when the patch for GCC 4.5.2 was put into the dc-chain patches directory, so my best guess is that the problem lies in something that changed in Newlib between then and now. You might need to use Newlib 1.20.0, since that was the version that was used in dc-chain when GCC 4.5.2 was current.
Thanks, for some reason I thought that for the latest KOS need exactly newlib 2.0.0. I'll try it.
Image
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

Seems the problem in GCC version (c99 maybe?).
Newlib 2.0.0 or 1.20.0 doesn't matter:

Code: Select all

flashrom.c:366:6: предупреждение: декларация ничего не описывает
flashrom.c: В функции ‘flashrom_get_ispcfg’:
flashrom.c:380:26: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:381:28: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:382:28: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:383:28: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:384:28: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:385:32: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:386:32: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:387:34: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e0’
flashrom.c:398:31: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e2’
flashrom.c:407:30: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e4’
flashrom.c:416:30: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e5’
flashrom.c:425:36: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e6’
flashrom.c:434:37: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e7’
flashrom.c:435:36: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e7’
flashrom.c:444:30: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e8’
flashrom.c:445:35: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e8’
flashrom.c:454:36: ошибка: ‘isp_settings_t’ не содержит элемента с именем ‘e9’
flashrom.c: На верхнем уровне:
flashrom.c:595:6: предупреждение: декларация ничего не описывает
flashrom.c: В функции ‘flashrom_get_pw_ispcfg’:
flashrom.c:608:23: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b80’
flashrom.c:613:15: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b80’
flashrom.c:618:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b80’
flashrom.c:623:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b80’
flashrom.c:630:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b80’
flashrom.c:643:42: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b81’
flashrom.c:646:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b81’
flashrom.c:655:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b82’
flashrom.c:663:50: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b83’
flashrom.c:667:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b83’
flashrom.c:672:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b83’
flashrom.c:680:15: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘b84’
flashrom.c:690:23: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:695:15: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:699:15: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:704:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:709:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:714:38: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:718:33: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c0’
flashrom.c:725:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c1’
flashrom.c:730:38: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c1’
flashrom.c:734:33: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c1’
flashrom.c:741:30: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c2’
flashrom.c:742:30: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c2’
flashrom.c:747:32: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c2’
flashrom.c:748:32: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c2’
flashrom.c:755:32: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c3’
flashrom.c:759:31: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c3’
flashrom.c:766:36: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c4’
flashrom.c:771:31: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c4’
flashrom.c:776:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c4’
flashrom.c:783:41: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c5’
flashrom.c:788:38: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c5’
flashrom.c:793:37: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c5’
flashrom.c:798:30: ошибка: ‘pw_isp_settings_t’ не содержит элемента с именем ‘c5’
make[4]: *** [flashrom.o] Ошибка 1
make[4]: Выход из каталога `/usr/local/dc/kos/kos/kernel/arch/dreamcast/hardware'
make[3]: *** [_dir_hardware] Ошибка 2
make[3]: Выход из каталога `/usr/local/dc/kos/kos/kernel/arch/dreamcast'
make[2]: *** [all] Ошибка 2
make[2]: Выход из каталога `/usr/local/dc/kos/kos/kernel/arch'
make[1]: *** [_dir_arch] Ошибка 2
make[1]: Выход из каталога `/usr/local/dc/kos/kos/kernel'
/bin/sh: 1: exit: Illegal number: -1
make: *** [all] Ошибка 2
Sorry for the localized messages...

Code: Select all

flashrom.c: 380:26: error: 'isp_settings_t' does not contain an element named 'e0'
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

That file hasn't changed in any significant manner since when we were using older versions of GCC... Try changing the KOS_CSTD line in your environ_base.sh file (in the kos root directory) from "-std=c99" to "-std=gnu99" instead and see if that fixes the problem.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

Now with gnu99 it's compiled, but with warnings on each nmmgr list:

Code: Select all

net_ipv4.c:23:1: предупреждение: пропущен инициализатор
net_ipv4.c:23:1: предупреждение: (где-то рядом с инициализацией для ‘ipv4_stats.pkt_send_failed’)
kos-cc  -c net_udp.c -o net_udp.o
net_udp.c:63:1: предупреждение: пропущен инициализатор
net_udp.c:63:1: предупреждение: (где-то рядом с инициализацией для ‘udp_stats.pkt_send_failed’)
kos-cc  -c net_dhcp.c -o net_dhcp.o
kos-cc  -c net_ipv4_frag.c -o net_ipv4_frag.o
kos-cc  -c net_thd.c -o net_thd.o
kos-cc  -c net_ipv6.c -o net_ipv6.o
net_ipv6.c:18:1: предупреждение: пропущен инициализатор
net_ipv6.c:18:1: предупреждение: (где-то рядом с инициализацией для ‘ipv6_stats.pkt_send_failed’)

Code: Select all

net_ipv4.c: 23:1: warning: missing initializer 
net_ipv4.c: 23:1: warning: (somewhere near initialization for 'ipv4_stats.pkt_send_failed')
Ext2 file system apparently all warnings are treated as errors:

Code: Select all

cc1: warnings being treated as errors
fs_ext2.c: 1760:9: error: missing initializer 
fs_ext2.c: 1760:9: error: (somewhere near initialization for 'vh.nmmgr.list_ent.le_prev')
Newlib 1.20 and 2.0 works equally with GCC 4.5.2
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

Bah... Those warnings are stupid, considering they're warning about perfectly valid code that's pretty unambiguous. :?

I wouldn't worry about them in KOS proper, as they're not important. If you want to build libkosext2fs, then change line 9 of its Makefile to remove "-Werror" from the KOS_CFLAGS.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

Thank you.
I'll try to compare the stability of the code with different versions GCC. Maybe not make much sense to go back to the old version, because some problems can be in other place.
Image
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Hello SWAT,

Just wondering, are you compiling under Cygwin or MinGW?
I'm still trying to compile under MinGW, it successfully worked GCC 4.5.2, but I'm unable to do that under GCC 4.7.3 or 4.8.2.

So my latest MinGW toolchain remains KOS 1.3 svn xxx and GCC 4.5.2...

Thank you :)
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

Hello.
I use two environments, depending on where I am :)
Linux (x64) and Windows (x64) with Cygwin (x86).
For both I'm successfully compile all toolchains.

btw, on the topic, I stayed on 4.7.3.
Image
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Thanks for your answer!

I was able to compile the complete toolchain with this tutorial, but in the latest version of MinGW, the arm compiler can't be compiled... I'm getting the following error:
Win32 error 487: Couldn't reserve space for cygwin's heap, Win32 error 0 error

I saw that the heap memory space was hardcoded in msys-1.0.dll and was fixed to 256M, so I decided to modify the binary by recompiling that DLL with the official MinGW SDK... I modified the value to 1024M (beyond this limit, the DLL crashes), the compilation works longer, but it crashes anyway with the same message...

Sorry to bother your topic with my problem, I'm stopping to write right now :)
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 193
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SWAT »

Use cygwin and will have no problems ;)
Image
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Yup I know that, but I prefer the MinGW lightweight and no-dependency scheme :)
But at least I know if I want to use KOS 2.0.1, I can't use GCC 4.8.2.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

A few weeks ago, I tried to build a toolchain with MinGW/MSYS and ended up with the same problem (the random heap error). I found that re-running the make command in the directory where it failed pushed it along a bit further. After doing so about 4 or so times, the build actually did finish entirely.

I never ran into that problem on building the SuperH side of the toolchain, only on the ARM side, which technically isn't really necessary for building KOS anyway (unless you want to change the ARM program that runs the sound system).
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Hey BlueCrab,

I done the same thing (re-running the make command) but the process stops itself to a random point anyway. By the way I'm compiling my environment inside a VM by using VMware Workstation (with 4GB of virtual RAM setting). Maybe it's the problem? I guess you're using Linux. What kind of VM tool are you using, VirtualBox? Maybe I should test to build the whole thing under VirtualBox instead of VMware...?

Like you I successfully built the SH toolchain, only the ARM toolchain's faulty. I know that part's pretty useless but I prefer to build everything just in case...
Ayla
DC Developer
DC Developer
Posts: 142
Joined: Thu Apr 03, 2008 7:01 am
Has thanked: 0
Been thanked: 4 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by Ayla »

SiZiOUS wrote:But at least I know if I want to use KOS 2.0.1, I can't use GCC 4.8.2.
Who cares about 4.8.2? Try 4.9.0 :mrgreen:
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

SiZiOUS wrote:Hey BlueCrab,

I done the same thing (re-running the make command) but the process stops itself to a random point anyway. By the way I'm compiling my environment inside a VM by using VMware Workstation (with 4GB of virtual RAM setting). Maybe it's the problem? I guess you're using Linux. What kind of VM tool are you using, VirtualBox? Maybe I should test to build the whole thing under VirtualBox instead of VMware...?

Like you I successfully built the SH toolchain, only the ARM toolchain's faulty. I know that part's pretty useless but I prefer to build everything just in case...
I don't use Linux or a VM for Dreamcast stuff at all, actually. I pretty much do everything on OS X 10.9, which is what I use as my day-to-day OS anyway.

If you are going to go the VM route, I don't think you'll have any different of an experience with VMware or VirtualBox. I've never actually used VMware Workstation myself (since the only VMware version on OS X is non-free), so I really can't comment on it at all. I've had no troubles with VirtualBox running Linux VMs before for various tasks though (such as when I was teaching the Operating Systems course that I taught a few semesters ago -- which involved compiling the Linux kernel for projects).
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Thanks for your answer BlueCrab.

So when you used MinGW in the past, what was the OS you used? Windows XP or 7, in x86 or x64 mode?

Yeah I heard that VMware for Mac OS X "VMware Fusion" is a commercial product only, there isn't VMware Player equivalent for OS X.
It's a shame because VMware is really a good product, I'm using it widely every day...
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5683
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 10 times
Been thanked: 69 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by BlueCrab »

SiZiOUS wrote:So when you used MinGW in the past, what was the OS you used? Windows XP or 7, in x86 or x64 mode?
Well... It was actually long enough ago that the answer to the question is Windows 98. :wink:

Now, when I tried to build it recently just to see if it worked, I was using Windows 7 x64.
User avatar
SiZiOUS
DC Developer
DC Developer
Posts: 404
Joined: Fri Mar 05, 2004 2:22 pm
Location: France
Has thanked: 27 times
Been thanked: 19 times
Contact:

Re: KOS 2.0.1 + GCC 4.5.2

Post by SiZiOUS »

Windows 98 ? :o
I think I still have it somewhere :-)

My virtual machine was initially under Windows XP but when I saw that it wasn't working I switched the OS to Windows 7 x64... And it doesn't work either. So I guess my problem is due to the virtualisation software. I think I should try with my real system OS which is Windows 7 x64 too (with 32GB of RAM... I really need to use VMs ;-))

Thank you very much for your answers by the way!
Cheers!
Post Reply