![]() |
cygwin gcc -O2 problem
Hi,
when I compile with the current cygwin g++ (v.3.4.4) I get 'strange' errors in the link step when I use the -O2 option for compiling. This happens since I use the stl. Example: g++ -mno-cygwin -w -O2 -march=i686 -I<some include dir...> -c -o xxx.o xxx.cpp g++ -mno-cygwin -fPIC -shared -o my.dll xxx.o yyy.o.... The linker then shows multiple errors like this: ...undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::_close()' This does not happen, when I do not use the -O2 option. Then everything works fine. What am I doing wrong? Markus |
Re: cygwin gcc -O2 problem
I'm using MinGW and it's no problem. Have you tried using the "dllwrap" command?
|
Re: cygwin gcc -O2 problem
Hi Whistler,
Quote:
Someone got any clues where the problem with the -O2 option is? Markus |
Re: cygwin gcc -O2 problem
It suggests a faulty STL implementation in GCC... Try downgrading the optimization level ?
|
Re: cygwin gcc -O2 problem
Yes, I tried already leaving -O2 away, that fixes the problem. But I want to optimize the binary, so that is no real solution. Maybe waiting for a new gcc version is the only option...
Markus |
Re: cygwin gcc -O2 problem
PHP Code:
PHP Code:
|
Re: cygwin gcc -O2 problem
The problem seems to come from the stl (I think). Since you use no stl in your example, there is no problem.
Strange is, that most of the stl code compiles fine with -O2, just some parts show this error. Markus |
Re: cygwin gcc -O2 problem
Try using -O1 on the files that have the error.
|
Re: cygwin gcc -O2 problem
Quote:
And what about cout << "test1" << endl; :) |
Re: cygwin gcc -O2 problem
that's std c++ library, stl would be rather std::list, vector whatever
|
Re: cygwin gcc -O2 problem
-O1 works fine. What may be the problem now?
Markus |
Re: cygwin gcc -O2 problem
well, try the STLPort or the latest gcc SVN snapshot and if problem disappeared then it's a gcc bug.
|
Re: cygwin gcc -O2 problem
OK, that's too much for me :-) I'll better wait for a new cygwin gcc package...
Thanks for your help. Markus |
All times are GMT +2. The time now is 10:44. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.