Author Topic: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)  (Read 31986 times)

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« on: June 28, 2015, 07:17:37 pm »
I was going to wait for the 5.2.0 upstream release next month, but this build went so smoothly that I figured I'd go ahead and release a little sooner! It's time for...

TDM-GCC 5.1.0 and TDM-GDB 7.9.1
GCC's usual upstream improvements, some minor patches, plus 32-bit and 64-bit GDB including Python and auto-loading C++ pretty printers.

TDM-GCC 5.1.0, the first TDM release in the GCC 5 series, is now available for download. As always, I've tested it on wxWidgets (2.8.12) and Code::Blocks SVN (10348) to ensure good compatibility. When building wxWidgets as a MONOLITHIC DLL, you will probably need to use the "-fno-keep-inline-dllexport" flag (mingw32-make ... CXXFLAGS="-fno-keep-inline-dllexport").

Some TDM-specific changes since the last release:
  • There is now a 32-bit Python-enabled GDB package, similar to the 64-bit GDB that was previously available.
  • Both GDB packages attempt to automatically load the libstdc++ pretty printer scripts if they are available.

TDM-GCC comes in TWO editions:
You can choose between the classic TDM 32-bit edition and the TDM64 edition. The TDM64 edition is based on the MinGW-w64 runtime API and the x86_64-w64-mingw32 GCC target, and can create both 32-bit and 64-bit code, with the "-m32"/"-m64" compiler flags. Please never mix 32-bit object files (.o), libraries (.a), DLLs, or EXEs with 64-bit versions, and don't report it as a bug if you inadvertently do.

More information and downloads are available at <http://tdm-gcc.tdragon.net/>. TDM-GCC includes support for C, C++, Fortran, Objective-C/C++, and Ada, as well as support for the OpenMP multithreading extensions, packaged in a simple Windows installer.

Disclaimer:
As always, please remember:
  • TDM-GCC is not formally affiliated with or endorsed by the MinGW project.
  • No level of support for TDM-GCC is in any way guaranteed (although a best effort is made to fix bugs as they are found or forward them to GCC Bugzilla).

Cheers,
John E. / TDM
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #1 on: June 28, 2015, 08:42:50 pm »
Did you apply the PCH fix that was posted somewhere in a CB forum?

Edit: Link to post http://forums.codeblocks.org/index.php/topic,18568.msg138329.html#msg138329

Tim S.
« Last Edit: June 28, 2015, 08:45:33 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #2 on: June 28, 2015, 09:32:37 pm »
tdm-gcc is somehow less vulnerable to that bug, I suspect tdragon has already fixed that in his own builds (way before 5.1) or am I wrong?

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #3 on: June 28, 2015, 09:34:06 pm »
tdm-gcc is somehow less vulnerable to that bug, I suspect tdragon has already fixed that in his own builds (way before 5.1) or am I wrong?

It was NOT fixed in his 4.8 GCC based release. I do NOT remember if I tested the 4.9 based release for the bug or not.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #4 on: June 28, 2015, 10:28:34 pm »
Patch I am trying for building wxWidgets 3.0.2.
Edit: Building on Windows 7 32 bit.

In file pthread.h replaced below
Code
  struct timespec {
  time_t  tv_sec;   /* Seconds */
  long    tv_nsec;  /* Nanoseconds */
};

with
Code
#define _FAKE_TIME_H_SOURCED	1
#define __need_struct_timespec 1
#include <parts/time.h>

// struct timespec {
//  time_t  tv_sec;   /* Seconds */
//  long    tv_nsec;  /* Nanoseconds */
// };

Tim S.
« Last Edit: June 28, 2015, 10:35:22 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #5 on: June 29, 2015, 02:16:38 am »
tdm-gcc is somehow less vulnerable to that bug, I suspect tdragon has already fixed that in his own builds (way before 5.1) or am I wrong?

It was NOT fixed in his 4.8 GCC based release. I do NOT remember if I tested the 4.9 based release for the bug or not.

Tim S.

The PCH bug still exists in "5.1.0 - 2015-06-28" release.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #6 on: June 29, 2015, 02:36:40 am »
I can hack(binary edit) the cc1plus.exe, and upload it. Do you need that?
« Last Edit: June 29, 2015, 02:38:12 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #7 on: June 29, 2015, 02:51:25 am »
I can hack(binary edit) the cc1plus.exe, and upload it. Do you need that?

I do NOT need it; I am hoping the bug was fixed.

If you can post a patch it might speed up the fix by upstream people be it TDM, MinGW, or MinGW64.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #8 on: June 29, 2015, 03:02:56 am »
OK. There is a patch in gcc bugzilla posted by other people days ago which is said  better than my merhod.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #9 on: June 29, 2015, 05:13:18 am »
Why are those pthread.h changes needed for wxWidgets?

I hadn't seen that PCH patch before; so, it's not present in the 5.1.0 release.

-John E. / TDM
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #10 on: June 29, 2015, 06:16:16 am »
Why are those pthread.h changes needed for wxWidgets?

I hadn't seen that PCH patch before; so, it's not present in the 5.1.0 release.

-John E. / TDM

Some reason two different defines of the struct timespec was seen.
So, I changed the one in pthread.h to use the one defined in parts/time.h.

The one in parts/time.h matches the one used by time.h and parts/time.h is included by the header unistd.h.

So, if you include pthread.h and parts/time.h you get an error.

I removed my change and this is the error it stops on while building wxWidgets 3.0.2 using 32 bit TDM GCC.
Code
g++ -c -o gcc_mswudll51Xsjlj\monodll_file.o  -O2 -mthreads  -DHAVE_W32API_H -D__
WXMSW__   -DNDEBUG    -D_UNICODE  -I..\..\lib\gcc_dll51Xsjlj\mswu -I..\..\includ
e  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\p
ng -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -I..\..\src\stc\scin
tilla\include -I..\..\src\stc\scintilla\lexlib -I..\..\src\stc\scintilla\src -D_
_WX__ -DSCI_LEXER -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL   -Wno-ctor-dtor-pr
ivacy -Wmissing-include-dirs -std=gnu++11 -Wno-unused-local-typedefs -fno-keep-i
nline-dllexport -MTgcc_mswudll51Xsjlj\monodll_file.o -MFgcc_mswudll51Xsjlj\monod
ll_file.o.d -MD -MP ../../src/common/file.cpp
In file included from C:/Apps32/TDM-GCC5_1x-32/lib/gcc/mingw32/5.1.0/include/c++
/mingw32/bits/gthr-default.h:34:0,
                 from C:/Apps32/TDM-GCC5_1x-32/lib/gcc/mingw32/5.1.0/include/c++
/mingw32/bits/gthr.h:148,
                 from C:/Apps32/TDM-GCC5_1x-32/lib/gcc/mingw32/5.1.0/include/c++
/ext/atomicity.h:35,
                 from C:/Apps32/TDM-GCC5_1x-32/lib/gcc/mingw32/5.1.0/include/c++
/bits/basic_string.h:39,
                 from C:/Apps32/TDM-GCC5_1x-32/lib/gcc/mingw32/5.1.0/include/c++
/string:52,
                 from ..\..\include/wx/stringimpl.h:66,
                 from ..\..\include/wx/unichar.h:15,
                 from ..\..\include/wx/strvararg.h:22,
                 from ..\..\include/wx/string.h:46,
                 from ../../src/common/file.cpp:105:
C:/Apps32/TDM-GCC5_1x-32/include/pthread.h:227:8: error: redefinition of 'struct
 timespec'
 struct timespec {
        ^
In file included from C:/Apps32/TDM-GCC5_1x-32/include/unistd.h:95:0,
                 from ../../src/common/file.cpp:54:
C:/Apps32/TDM-GCC5_1x-32/include/parts/time.h:65:8: error: previous definition o
f 'struct timespec'
 struct timespec
        ^
makefile.gcc:6494: recipe for target 'gcc_mswudll51Xsjlj\monodll_file.o' failed
mingw32-make: *** [gcc_mswudll51Xsjlj\monodll_file.o] Error 1

Tim S.
« Last Edit: June 29, 2015, 06:49:23 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #11 on: June 29, 2015, 07:49:33 am »
Simplest code that gives the error.

Code
#include <pthread.h>
#include <unistd.h>

int main()
{
    return 0;
}


Code
-------------- Build: Release in testgcc51x (compiler: gcc-5.1.x)---------------

mingw32-g++.exe -Wall  -c C:\SourceCode\Test\testgcc51x\main.cpp -o obj\Release\main.o
In file included from C:/Apps32/TDM-GCC5_1x-32/include/unistd.h:95:0,
                 from C:\SourceCode\Test\testgcc51x\main.cpp:2:
C:/Apps32/TDM-GCC5_1x-32/include/parts/time.h:65:8: error: redefinition of 'struct timespec'
 struct timespec
        ^
In file included from C:\SourceCode\Test\testgcc51x\main.cpp:1:0:
C:/Apps32/TDM-GCC5_1x-32/include/pthread.h:227:8: error: previous definition of 'struct timespec'
 struct timespec {
        ^

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #12 on: June 29, 2015, 11:54:31 am »
tdm-gcc is somehow less vulnerable to that bug, I suspect tdragon has already fixed that in his own builds (way before 5.1) or am I wrong?

It was NOT fixed in his 4.8 GCC based release. I do NOT remember if I tested the 4.9 based release for the bug or not.

Tim S.
I haven't checked the code (I even didn't know where to check before ollydbg spotted it). I am just judging by the fact that tdm-4.9.2 (iirc also tdm-4.8.1) can compile wx2.8 in 64-bit bitness. It might be another factor though.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #13 on: June 29, 2015, 04:21:56 pm »
I hadn't seen that PCH patch before; so, it's not present in the 5.1.0 release.
Hi, John, I thought you could see it, because I post some messages in mingw-w64 maillist, see: [Mingw-w64-public] can anyone supply a debug version of cc1plus.exe? about one month ago.

The real bug report are in GCC bugzilla, see: 56926 – Crash (without ICE) while compiling Boost.Math, especially my Comment 17, in my comment, I see that the crash can be simply fixed by set a large value of "pch_VA_max_size". About two or three days ago, I see another person post a patch GCC bug 14940 Comment 47, he said this patch should work better than my change. I don't have ability to build GCC myself, so I can't confirm whether his patch works better. His comments are mainly in MinGW-w64 - for 32 and 64 bit Windows / Bugs / #382 PCH: cc1plus.exe crash on Windows8.1, see omgwtfbbq's comments in that Bug report.

Currently, PCH is disabled when building C::B with wx3.x under Windows, because of this crash issue. I hope next release of TDM gcc can solve this issue, thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: TDM-GCC 5 series (Latest: 5.1.0 - 2015-06-28)
« Reply #14 on: June 29, 2015, 06:24:57 pm »
Some reason two different defines of the struct timespec was seen.

Aha, the newer mingwrt-3.21 added a struct timespec definition that wasn't present in 3.20-2.

I think the correct place to fix this will be in winpthreads; now testing a patch. In the meantime I'm reverting to mingwrt-3.20 in the installer and as the recommended version as it didn't have this problem.

-John E. / TDM
« Last Edit: June 29, 2015, 10:56:03 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)