Author Topic: GCC 4.4.0-tdm-1 for MinGW (with installer)  (Read 85355 times)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #15 on: May 03, 2009, 05:40:46 pm »
Excuse me, What does the ICE means?
Thanks.

Internal Compiler Error, if I'm not wrong. ;)
Be a part of the solution, not a part of the problem.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5914
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #16 on: May 03, 2009, 05:44:06 pm »
It seems some DLL support OpenMP are lost in the new TDM GCC 4.4 release. ( It works fine in the TDM GCC 4.3.3)

Hi, I just generate the OpenCV library with OpenMP enabled. But it seems that a DLL file is lost. See the dependencies below.





[attachment deleted by admin]
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #17 on: May 03, 2009, 05:48:33 pm »
Excuse me, What does the ICE means?
Thanks.
Internal Compiler Error

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5914
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #18 on: May 03, 2009, 06:06:06 pm »
I understand.
Thanks to jens and Biplab. :D
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: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #19 on: May 03, 2009, 09:35:09 pm »
However, as described above, I found out that -fcaller-saves (which O2, O3, Os enable) is the culprit. Explicitely disabling caller saves makes the ICE go away. This might possibly give someone interested in the problem a clue where to look.

Alternatively, is there a way to tell gcc not to install signal handlers? Since it reports a segfault, this should actually kick off the just-in-time debugger if gcc didn't catch the exception, so I should be able to get a core dump.
Normally with an ICE GCC reports the line number and function within its own source; is that not happening?

It seems some DLL support OpenMP are lost in the new TDM GCC 4.4 release. ( It works fine in the TDM GCC 4.3.3)

Hi, I just generate the OpenCV library with OpenMP enabled. But it seems that a DLL file is lost. See the dependencies below.
It wouldn't really be so hard to do a search in the MinGW directory for libgomp-1.dll, would it? Check lib/gcc/mingw32/bin.
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)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #20 on: May 04, 2009, 12:23:22 am »
Normally with an ICE GCC reports the line number and function within its own source; is that not happening?
Afraid not :(
This is the complete thing (include paths etc. elided):
mingw32-g++-dw2.exe -O2 -Wall -g -fno-rtti -mfpmath=sse,387 -fbranch-target-load-optimize -pipe -march=core2 -msse2 -ftree-vectorize -ffast-math -funit-at-a-time -std=gnu++0x -U__STRICT_ANSI__ -funsafe-loop-optimizations -Wunsafe-loop-optimizations -Wall -Wextra -Wnon-virtual-dtor -Wfloat-equal -Wno-missing-field-initializers -Wno-multichar -Wcast-align -Wstrict-aliasing -Wshadow   -I (...)  -c (...) -o (...)
H:\checkout\mtc\trunk\sys\system.cpp: In function 'bool sys::init()':
H:\checkout\mtc\trunk\sys\system.cpp:177: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.tdragon.net/recentgcc/bugs.php> for instructions.
Process terminated with status 1 (0 minutes, 2 seconds)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #21 on: May 04, 2009, 01:43:36 am »
Well, if you posted the file I would be happy to try to narrow it down to a simple test case.

Also, this page has info on debugging a GCC segfault. TDM-GCC is compiled with --enable-checking=release (the default for upstream releases), but without -g and with -O2, so there may not be much else to be discovered without using a debug build of GCC.
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)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5914
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #22 on: May 04, 2009, 03:11:25 am »
It wouldn't really be so hard to do a search in the MinGW directory for libgomp-1.dll, would it? Check lib/gcc/mingw32/bin.
Shame on me :D!
It's there, Thanks for your help!

Edit

Why not move these DLLs from

MinGW/lib/gcc/mingw32/bin

to

MinGW/bin

Thanks.

« Last Edit: May 04, 2009, 05:29:40 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.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #23 on: May 08, 2009, 12:58:29 pm »
Here's an issue I also discovered in a TDM 4.3.x.

When I compile some simple code I get errors on GCC's own headers [I don't have this with the latest MinGW 4.2.1], the issue also does not occur on linux (4.3.1).

Quote
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/istream:40,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/sstream:39,
                 from C:\view_vipnt_buildserver\vipnt\Codec\src\CodecDisplay.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared

I can only get it to work when I use the following warning options :

Code
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -Wextra -Wall
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -Wextra -Wall

Normally I use :
Code
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -std=c++98 -Wextra -Wall -ansi

So the moment I add any of these the error already occurs :
-std=c++98
-ansi

Is there any chance this can be fixed ??

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #24 on: May 08, 2009, 03:39:14 pm »
Try this: -std=c++98 -U__STRICT_ANSI__.

Strict ANSI mode which all of the -std= options enable is pretty useless insofar as it disables 90% of CRT, at no benefit. However, you can get MinGW to compile your code using the respective standard without going into moron mode by undefining that macro in said manner.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline drac

  • Multiple posting newcomer
  • *
  • Posts: 27
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #25 on: May 08, 2009, 03:45:21 pm »
Quote
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared

You need to patch the cwchar header, others have done it http://www.nabble.com/-ANN--GCC-4.4.0-Released-td23207147.html

With that patch you can compile this new C++0x hello program (g++ hello.cpp -o hello.exe -std=c++0x)

Code
#include <iostream>
#include <vector>

int main()
{
  std::vector<char> v = {
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x43, 0x2b,
0x2b, 0x30, 0x78, 0x20, 0x57, 0x6f, 0x72, 0x6c,
0x64, 0x21 };
 
  for (auto it = v.begin(); it != v.end(); ++it)
  {
    std::cout << *it;
  }
 
  std::cout << std::endl;
}

C++0x is cool!

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #26 on: May 08, 2009, 04:07:53 pm »
I can confirm Thomas' suggestion works :-)

So I now have among the previously working options :
  -std=c98++ -ansi -U__STRICT_ANSI__

What will be the real difference, with this being undefined, with respect to ensuring portable codes and very little extensions creeping in from gcc ?

How save is the workaround of just commenting out the 2 offending lines ? Is this something that will make it in the official (mingw)-gcc ??

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #27 on: May 08, 2009, 10:26:59 pm »
Rather than commenting out the two lines in cwchar, surround them with #ifndef __STRICT_ANSI__/#endif. This is actually the correct fix for the problem, which I believe is merely a small oversight. This issue should be discussed with the mingw-runtime maintainer and then forwarded to GCC (probably Danny Smith).
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)

sahasranaman

  • Guest
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #28 on: June 12, 2009, 04:31:02 pm »
I have been trying this for some time. I installed from the latest bundled installer, then I've got the new -2 packages seperately, still I keep getting the error. By the way, I'm linking with libsigc++, which was actually built using MinGW GCC 3.4.5. I'm pasting the error. Could someone help?

Code
g++.exe -o dist/Debug/MinGW-Windows/urllib__ build/Debug/MinGW-Windows/urllibpp.o build/Debug/MinGW-Windows/main.o -L/C/Python26/libs -L/C/msys/1.0/local/lib -L../gtk+/lib -L/c/mingw/lib/gcc/mingw32/4.4.0 -lglibmm-2.4.dll -lpython26 -lboost_python-mgw44-mt-1_38 -lsigc-2.0 -lglib-2.0.dll 
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000019.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000016.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000017.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: GCC 4.4.0-tdm-1 for MinGW (with installer)
« Reply #29 on: June 12, 2009, 04:40:49 pm »
Seems like libsigc-2.0.dll.a was actually built with the first release of 4.4.0-tdm-1, or some other build that doesn't properly hide the _Unwind_* symbols. Whatever the case, it needs to be rebuilt, preferably with 4.4.0-tdm-1 r2.
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)