OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Paul Smedley on August 18, 2013, 11:40:13 am

Title: Test build of GCC 4.7.3 available
Post by: Paul Smedley on August 18, 2013, 11:40:13 am
Hi All,

I've compiled GCC 4.7.3 including the patches from the recent builds of GCC 4.5.4 and it seems to be working reasonably well based on the example builds I've tried.

The build can be downloaded from: https://dl.dropboxusercontent.com/u/76425158/gcc-4.7.3-os2-20130818.zip and feedback is appreciated.

Per my other GCC builds, it requires an installed libc development environment.

Cheers,

Paul.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on August 31, 2013, 06:27:04 am
Not that it seems that too many people care (based on the level of response to the initial build), but an updated build is coming.

Found/fixed some bugs that have been around for a while in my previous GCC 4.x builds.

Firefox 10.12ESR built with this now compiles/starts, GCC can build itself, and I'm mostly through building Qt4. I think it's getting pretty solid now.

GCC 4.7.x is likely to be the last release of GCC I will build, as with GCC 4.8.x they moved to a C++ implementation for the compiler, so the patches would need to be completely rewritten for GCC 4.8.  Based on the levels of interest in the OS and developer tools....... I will continue to investigate bugs in this and other GCC releases I've done, as well as bump the version for any further GCC minor releases (ie GCC 4.7.4)
Title: Re: Test build of GCC 4.7.3 available
Post by: Greg Pringle on August 31, 2013, 04:08:18 pm
Hello Paul:
 I greatly appreciate the compiler work you have done. I have used many of the versions with success.
Please keep them coming. In the past I have contributed, maybe you need some more :-)

I have been swamped and have not had time to test the test-build you just posted.

greg
Title: Re: Test build of GCC 4.7.3 available
Post by: Doug Bissett on August 31, 2013, 05:52:14 pm
Quote
Not that it seems that too many people care (based on the level of response to the initial build)

Paul, you should know by now, that three things come into play here:

1) People don't say anything when something works. When it doesn't work, most users assume that they are doing something wrong, and will spend some time trying to figure it out for themselves, before reporting a problem.

2) It is nearing the end of summer, in the northern hemisphere, so people are busy enjoying what is left of it, leaving little time for #1..

3). EVERYBODY is waiting for eCS 2.2 to show up again. (Hopefully, they get it right this time).

FWIW, I downloaded your previous attempt, meaning to get around to trying it, but #2 has intervened. Now, I will wait for your new version, and I still won't have the time to try it out. #3 will take priority, when it shows up.

Never fear. ALL eCS (OS/2) users appreciate what you do.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 01, 2013, 12:45:36 am
G'day Greg,

I greatly appreciate the compiler work you have done. I have used many of the versions with success.
Please keep them coming. In the past I have contributed, maybe you need some more :-)

I have been swamped and have not had time to test the test-build you just posted.

Appreciate all of your past contributions.  I'll keep maintaining the current releases - but I think GCC 4.7.x will be able to serve the remaining OS/2 developers for some time yet. Heck GCC 3.3.x was years out of date when I first compiled a GCC 4.x version.
Title: Re: Test build of GCC 4.7.3 available
Post by: mickhead on September 01, 2013, 02:33:08 am
I too appreciate your efforts, Paul.  Been waiting on 2.2 from mensys
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 01, 2013, 11:42:52 am
Updated build @ https://dl.dropboxusercontent.com/u/76425158/gcc-4.7.3-os2-20130901.zip

Changelog:
- 20130818 - Initial GCC 4.7.3 release (c/c++ only)
- Fixed crashes of some executables compiled with GCC 4.7.3
- Fixed support for linker options like '-Zlinker "DISABLE 1058,1121"'
- Fixed garbage in libstdc++.la breaking support for static-libgcc with c++ apps
- Fixed 'g++ -shared xxx.o' generates -lm.dll not xxx.dll
- Probably some other stuff I forget
- 20130901 - 2nd Public GCC 4.7.3 build (c/c++ only)

Doing a build now with Fortran and Go enabled
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on September 02, 2013, 06:56:28 pm
Tested by running the FFMpeg FATE test-suite. With 4.4.6 and a P4 all tests pass. With a core2duo (now dead) and 4.4.6 there were perhaps a dozen failures, probably related to SSE3 alignment issues (possibly nasm bugs?). With 4.7.3 there were quite a few errors including hangs forcing me to kill the script.
To test, clone master, configure with something like configure --enable-gpl --disable-debug --disable-doc --samples=/fate.ffmpeg/fate-suite --enable-os2threads --cpu=i686
make && make fate-rsync && make fate.
Need the --cpu=i686 to pull in the GCC atomics. I'd guess the problems are alignment related but could be related to the GCC atomic operations.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 04, 2013, 11:59:55 am
New release:
https://dl.dropboxusercontent.com/u/76425158/gcc-4.7.3-os2-20130904.zip

- Fixed -Zmap to allow optional parameters
- Added legacy -Zmt and -Zmtd as allowed options
- 20130904 - 3rd Public GCC 4.7.3 build (c/c++ only)
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 07, 2013, 09:52:35 am
New build of GCC 4.7.3 and also binutils 2.23.2 added to http://os2ports.smedley.id.au

Thanks for those that took the time to test provide feedback. (+ve and -ve)
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 07, 2013, 12:15:51 pm
I also built Python 2.7.5 today - http://smedley.id.au/tmp/python-2.7.5-os2-20130907.zip

Not on my site yet as it has had minimal testing
Title: Re: Test build of GCC 4.7.3 available
Post by: Ian Manners on September 07, 2013, 06:40:15 pm
Hi Paul,

Thanks for all your work, just want to add my voice to those you are letting you know that we appreciate it greatly :)
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on September 07, 2013, 09:15:54 pm
Hi Paul, also a thanks here though everytime I download a build, you post a new one :)
Can you brand your builds, perhaps with the date? I see other builds with things like,
gcc 4.0.1 (GCC) (Apple Inc. build 5493)
gcc 4.4.7 (FreeBSD Ports Collection) 20111108 (prerelease)
gcc 4.4.5 (Debian 4.4.5-8)
and such. Perhaps a version.h or configure option?
Thanks
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 07, 2013, 11:10:07 pm
HI Dave,

Will see what I can do - I think GCC 3.3.5 had something similar too...

Still need to investigate your ffmpeg issue too.

Cheers,

Paul
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 08, 2013, 12:05:45 am
fate tests fail here with:
Test eval failed. Look at tests/data/fate/eval.err for details.

http://smedley.id.au/tmp/eval.err
Title: Re: Test build of GCC 4.7.3 available
Post by: Andy Willis on September 08, 2013, 03:14:23 am
Thank you...
Built nasm, glibidl, and mzftcfg and used these to build Seamonkey (esr10 build) with 4.7.3 and binutils 2.23... posting from said Seamonkey now.
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on September 08, 2013, 04:28:58 am
fate tests fail here with:
Test eval failed. Look at tests/data/fate/eval.err for details.

http://smedley.id.au/tmp/eval.err

That'll be the FPU exception bug where the Presentation Manager re-enables FPU exceptions without saving state and restoring state, my V4+free updates install doesn't have it.
Easiest fix is to add
 
Code: [Select]
#ifdef __i386
    short fcr;
    __asm__ volatile ("fstcw        %0 \n"
                      "or      $63, %0 \n"
                      "fldcw        %0 \n"
                      : "=m"(fcr));
#endif
or from Cairo,
Code: [Select]
static inline void
DisableFPUException (void)
{
    unsigned short usCW;

    /* Some OS/2 PM API calls modify the FPU Control Word,
     * but forget to restore it.
     *
     * This can result in XCPT_FLOAT_INVALID_OPCODE exceptions,
     * so to be sure, we disable Invalid Opcode FPU exception
     * before using FPU stuffs.
     */
    usCW = _control87 (0, 0);
    usCW = usCW | EM_INVALID | 0x80;
    _control87 (usCW, MCW_EM | 0x80);
}
after main() in all executables.
Plan9 has a similar bug and there is an alternative main() in compat/plan9/main.c where main() is undefined and replaced but I never could get it to work on OS/2, multiple symbol errors, I guess it would be needed to be added to crt0.obj and perhaps used with another flag much like -Zbin-args.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on September 08, 2013, 01:05:00 pm
fate tests fail here with:
Test eval failed. Look at tests/data/fate/eval.err for details.

http://smedley.id.au/tmp/eval.err

That'll be the FPU exception bug where the Presentation Manager re-enables FPU exceptions without saving state and restoring state, my V4+free updates install doesn't have it.
Easiest fix is to add

OK will try it tomorrow - too many beers tonight - had an engagement party this afternoon :)
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on November 09, 2013, 09:51:21 am
GCC 4.7.x is likely to be the last release of GCC I will build, as with GCC 4.8.x they moved to a C++ implementation for the compiler, so the patches would need to be completely rewritten for GCC 4.8.  Based on the levels of interest in the OS and developer tools....... I will continue to investigate bugs in this and other GCC releases I've done, as well as bump the version for any further GCC minor releases (ie GCC 4.7.4)

Seems I was wrong about GCC 4.8.x

I downloaded the sources this evening and applied the 4.7.3 patches fairly cleanly. Now will see if it builds....
Title: Re: Test build of GCC 4.7.3 available
Post by: mickhead on November 10, 2013, 11:38:16 pm
That's good news, indeed  :)
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on November 11, 2013, 12:03:27 pm
4.8.2 is built, however it currently has issues compiling apps that use API's declaring using _System - ie most/all OS/2 api's declared in os2emx.h.

dllexport is not (yet) tested.  Will try get this sorted out in the next week or so, but running short on spare time recently....
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on November 20, 2013, 11:11:15 am
4.8.2 is built, however it currently has issues compiling apps that use API's declaring using _System - ie most/all OS/2 api's declared in os2emx.h.

dllexport is not (yet) tested.  Will try get this sorted out in the next week or so, but running short on spare time recently....

GCC 4.8.2 seems to be working pretty well now :) Qt4 builds ok and seems to work, trying to build Firefox 17 with it now.  Those two are pretty robust c++ test cases :)
Title: Re: Test build of GCC 4.7.3 available
Post by: Alex Taylor on November 21, 2013, 10:04:01 am
GCC 4.8.2 seems to be working pretty well now :) Qt4 builds ok and seems to work, trying to build Firefox 17 with it now.  Those two are pretty robust c++ test cases :)

That's great news! Thanks for all the amazing work, Paul!
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on December 14, 2013, 09:20:24 am
GCC 4.8.2 seems to be working pretty well now :) Qt4 builds ok and seems to work, trying to build Firefox 17 with it now.  Those two are pretty robust c++ test cases :)

That's great news! Thanks for all the amazing work, Paul!

GCC 4.8.2 binaries now at http://os2ports.smedley.id.au

I'll get the source up at github when i get a spare afternoon
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on December 21, 2013, 06:58:39 am

GCC 4.8.2 binaries now at http://os2ports.smedley.id.au

I'll get the source up at github when i get a spare afternoon

Finally tested the C part by running the FFmpeg FATE suit which consists of about 2000 tests.  http://ffmpeg.org/fate.html (http://ffmpeg.org/fate.html).
While GCC 4.4.6 usually passes all tests (I get failures on 2 HEVC (H265) compliance tests after a few days of up time, see http://fate.ffmpeg.org/history.cgi?slot=x86.os2.446 (http://fate.ffmpeg.org/history.cgi?slot=x86.os2.446) and for comparison fate.ffmpeg.org (http://fate.ffmpeg.org)), 4.8.2 failed between 24 and 30 tests and ffmpeg.exe and especially ffprobe.exe froze multiple times forcing me to kill them. There's still something wrong, I'd guess alignment issues.
If you want to test, you need to configure with cpu=i486 or higher to pull in the GCC atomics (could they be broken?) and I'll attach a patch for eCS to work around the buggy PMSHELL. Note this also tests your environment as things like diff not supporting stdin or a bad bc will cause falures. Need to use [k]sh to run configure as well due to buggy ash (doesn't set CWD).
Anyways thanks for the great work and I wish I knew how to debug some of this stuff.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on December 22, 2013, 09:28:25 am

GCC 4.8.2 binaries now at http://os2ports.smedley.id.au

I'll get the source up at github when i get a spare afternoon

Finally tested the C part by running the FFmpeg FATE suit which consists of about 2000 tests.  http://ffmpeg.org/fate.html (http://ffmpeg.org/fate.html).
While GCC 4.4.6 usually passes all tests (I get failures on 2 HEVC (H265) compliance tests after a few days of up time, see http://fate.ffmpeg.org/history.cgi?slot=x86.os2.446 (http://fate.ffmpeg.org/history.cgi?slot=x86.os2.446) and for comparison fate.ffmpeg.org (http://fate.ffmpeg.org)), 4.8.2 failed between 24 and 30 tests and ffmpeg.exe and especially ffprobe.exe froze multiple times forcing me to kill them. There's still something wrong, I'd guess alignment issues.
If you want to test, you need to configure with cpu=i486 or higher to pull in the GCC atomics (could they be broken?) and I'll attach a patch for eCS to work around the buggy PMSHELL. Note this also tests your environment as things like diff not supporting stdin or a bad bc will cause falures. Need to use [k]sh to run configure as well due to buggy ash (doesn't set CWD).
Anyways thanks for the great work and I wish I knew how to debug some of this stuff.

Hi Dave - were you able to test with 4.7.3 at al? I'm curious when the regression started as it may help in the debugging.
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on December 23, 2013, 03:37:50 am

Hi Dave - were you able to test with 4.7.3 at al? I'm curious when the regression started as it may help in the debugging.

Hi Paul, tested 4.7.3 and had similar results.
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on December 29, 2013, 11:27:37 pm

Hi Dave - were you able to test with 4.7.3 at al? I'm curious when the regression started as it may help in the debugging.

Hi Paul, tested 4.7.3 and had similar results.

I will have to get this replicated locally when step through 4.4.6 -> 4.5.4 -> 4.6.x -> 4.7.x and see where the failed tests started from

Another one for the todo list
Title: Re: Test build of GCC 4.7.3 available
Post by: Paul Smedley on December 30, 2013, 10:00:34 am
fate tests fail here with:
Test eval failed. Look at tests/data/fate/eval.err for details.

http://smedley.id.au/tmp/eval.err

That'll be the FPU exception bug where the Presentation Manager re-enables FPU exceptions without saving state and restoring state, my V4+free updates install doesn't have it.
Easiest fix is to add
 
Code: [Select]
#ifdef __i386
    short fcr;
    __asm__ volatile ("fstcw        %0 \n"
                      "or      $63, %0 \n"
                      "fldcw        %0 \n"
                      : "=m"(fcr));
#endif
or from Cairo,
Code: [Select]
static inline void
DisableFPUException (void)
{
    unsigned short usCW;

    /* Some OS/2 PM API calls modify the FPU Control Word,
     * but forget to restore it.
     *
     * This can result in XCPT_FLOAT_INVALID_OPCODE exceptions,
     * so to be sure, we disable Invalid Opcode FPU exception
     * before using FPU stuffs.
     */
    usCW = _control87 (0, 0);
    usCW = usCW | EM_INVALID | 0x80;
    _control87 (usCW, MCW_EM | 0x80);
}
after main() in all executables.
Plan9 has a similar bug and there is an alternative main() in compat/plan9/main.c where main() is undefined and replaced but I never could get it to work on OS/2, multiple symbol errors, I guess it would be needed to be added to crt0.obj and perhaps used with another flag much like -Zbin-args.

Don't suppose you have a diff with this already in place? I don't fancy modifying multiple source files due to time constraints...
Title: Re: Test build of GCC 4.7.3 available
Post by: Dave Yeo on December 30, 2013, 05:19:49 pm
Don't suppose you have a diff with this already in place? I don't fancy modifying multiple source files due to time constraints...

I posted a patch here on the 21st. Here it is again freshly rebased. If you have problems with git, eg complaining about not being able to merge when pulling or cloning try
git fetch --force && git reset --hard origin/master
BTW I tested 4.5.4 and had the same failures even with optimizations turned off. Just tried 3.3.5, had to use pthreads as GCC is too old to have atomics and disable sse and mmx but it actually passed. I'll do some more experimenting later today.