.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
cygwin gcc -O2 problem
Old
  (#1)
markus_heiden
Moderator / E[POD]bot developer
 
markus_heiden's Avatar
 
Status: Offline
Posts: 66
Join Date: Oct 2005
Location: Hamburg / Germany
Default cygwin gcc -O2 problem - 10-11-2005

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

Last edited by markus_heiden; 10-11-2005 at 17:57..
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#2)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: cygwin gcc -O2 problem - 11-11-2005

I'm using MinGW and it's no problem. Have you tried using the "dllwrap" command?
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#3)
markus_heiden
Moderator / E[POD]bot developer
 
markus_heiden's Avatar
 
Status: Offline
Posts: 66
Join Date: Oct 2005
Location: Hamburg / Germany
Default Re: cygwin gcc -O2 problem - 11-11-2005

Hi Whistler,

Quote:
Originally Posted by Whistler
I'm using MinGW and it's no problem. Have you tried using the "dllwrap" command?
I have never tried the dllwrap command. Whatfor is it good? I only use the dlltool.

Someone got any clues where the problem with the -O2 option is?

Markus

Last edited by markus_heiden; 11-11-2005 at 23:49..
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: cygwin gcc -O2 problem - 12-11-2005

It suggests a faulty STL implementation in GCC... Try downgrading the optimization level ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#5)
markus_heiden
Moderator / E[POD]bot developer
 
markus_heiden's Avatar
 
Status: Offline
Posts: 66
Join Date: Oct 2005
Location: Hamburg / Germany
Default Re: cygwin gcc -O2 problem - 16-11-2005

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
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#6)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: cygwin gcc -O2 problem - 17-11-2005

PHP Code:
k25@xg25 /cygdrive/c
g++ -O2 --o 1.o 1.cpp

k25
@xg25 /cygdrive/c
g++ -fPIC -shared -o 1.dll 1.o 
well I just can't resemble your problem here... the above thing runs well and no error. Here's my 1.cpp:
PHP Code:
#include <iostream>
using namespace std;

__declspec(dllexportint test1()
{
  
cout << "test1" << endl;

  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#7)
markus_heiden
Moderator / E[POD]bot developer
 
markus_heiden's Avatar
 
Status: Offline
Posts: 66
Join Date: Oct 2005
Location: Hamburg / Germany
Default Re: cygwin gcc -O2 problem - 25-11-2005

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
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#8)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: cygwin gcc -O2 problem - 25-11-2005

Try using -O1 on the files that have the error.


sfx1999.postcount++
  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#9)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 452
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: cygwin gcc -O2 problem - 25-11-2005

Quote:
Since you use no stl in your example
And what about cout << "test1" << endl;

  
Reply With Quote
Re: cygwin gcc -O2 problem
Old
  (#10)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: cygwin gcc -O2 problem - 26-11-2005

that's std c++ library, stl would be rather std::list, vector whatever


  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com