FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 03-12-2011, 04:17 PM
Hugo Vanwoerkom
 
Default errors with g++-4.5 not with g++-4.4

Hi,

I am looking for your opinion as to whose bug this is.

I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists of
more than 103 C++ sourcefiles (1000's of lines of code) that get copiled
into a single executable.


Suddenly using the g++-4.5 compiler it produces an error in the link phase:

...
grafrs.cpp.text+0x355d): undefined reference to `mutrec'
...

But when I use the g++-4.4 compiler everything compiles and links
without error, like it has for years with previous C++ compilers.


Do I file a bug with the g++-4.5 package?

Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: ilg9r9$lap$1@dough.gmane.org">http://lists.debian.org/ilg9r9$lap$1@dough.gmane.org
 
Old 03-12-2011, 05:05 PM
Axel Freyn
 
Default errors with g++-4.5 not with g++-4.4

Hi Hugo,
On Sat, Mar 12, 2011 at 11:17:19AM -0600, Hugo Vanwoerkom wrote:
> Hi,
>
> I am looking for your opinion as to whose bug this is.
>
> I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists of
> more than 103 C++ sourcefiles (1000's of lines of code) that get copiled
> into a single executable.
>
> Suddenly using the g++-4.5 compiler it produces an error in the link phase:
>
> ...
> grafrs.cpp.text+0x355d): undefined reference to `mutrec'
> ...
>
> But when I use the g++-4.4 compiler everything compiles and links
> without error, like it has for years with previous C++ compilers.
>
> Do I file a bug with the g++-4.5 package?

I would first assume an error in this project -- and not in g++-4.5 :-)

However, before writing a bug, it would be very usefull if you succeed
to reduce the test case: I'm almost sure that none of the g++-developers
will be happy with a bug report stating "somehow those 1000's lines of
code don't compile correctly" -- I would expect a much faster help if
you could reduce the problem and reduce it to a few hundred (or even a
few tenth) of lines of code...
Is that possible?

I just had a VERY quick look at the code: It seems that "mutrec" is
defined in "aa.cpp". Do you link aa.cpp and grafrs.cpp together?

Axel


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110312180542.GJ11958@axel">http://lists.debian.org/20110312180542.GJ11958@axel
 
Old 03-12-2011, 05:31 PM
Sven Joachim
 
Default errors with g++-4.5 not with g++-4.4

On 2011-03-12 18:17 +0100, Hugo Vanwoerkom wrote:

> I am looking for your opinion as to whose bug this is.
>
> I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists
> of more than 103 C++ sourcefiles (1000's of lines of code) that get
> copiled into a single executable.
>
> Suddenly using the g++-4.5 compiler it produces an error in the link phase:
>
> ...
> grafrs.cpp.text+0x355d): undefined reference to `mutrec'
> ...
>
> But when I use the g++-4.4 compiler everything compiles and links
> without error, like it has for years with previous C++ compilers.

Is this the squeeze version of g++-4.4 or the wheezy/sid version?

> Do I file a bug with the g++-4.5 package?

Please read this announcement about linker changes first:

http://lists.debian.org/debian-devel-announce/2011/02/msg00011.html

Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 8739msur5l.fsf@turtle.gmx.de">http://lists.debian.org/8739msur5l.fsf@turtle.gmx.de
 
Old 03-12-2011, 08:35 PM
Hugo Vanwoerkom
 
Default errors with g++-4.5 not with g++-4.4

Axel Freyn wrote:

Hi Hugo,
On Sat, Mar 12, 2011 at 11:17:19AM -0600, Hugo Vanwoerkom wrote:

Hi,

I am looking for your opinion as to whose bug this is.

I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists of
more than 103 C++ sourcefiles (1000's of lines of code) that get copiled
into a single executable.


Suddenly using the g++-4.5 compiler it produces an error in the link phase:

...
grafrs.cpp.text+0x355d): undefined reference to `mutrec'
...

But when I use the g++-4.4 compiler everything compiles and links
without error, like it has for years with previous C++ compilers.


Do I file a bug with the g++-4.5 package?


I would first assume an error in this project -- and not in g++-4.5 :-)

However, before writing a bug, it would be very usefull if you succeed
to reduce the test case: I'm almost sure that none of the g++-developers
will be happy with a bug report stating "somehow those 1000's lines of
code don't compile correctly" -- I would expect a much faster help if
you could reduce the problem and reduce it to a few hundred (or even a
few tenth) of lines of code...
Is that possible?

I just had a VERY quick look at the code: It seems that "mutrec" is
defined in "aa.cpp". Do you link aa.cpp and grafrs.cpp together?



Thanks Axel. It is stranger yet:
1. mutrec is defined in aa.cpp
2. It is used as extern in mc.cpp, grafrs.cpp and setfile.cpp
3. But g++-4.5 only finds undefined referenes in mc.cpp and grafrs.cpp,
*not* in setfile.cpp

4. Yet the extern for mutrec is defined in all three the same way.
5. And previous compilers have found no errors.
6. The whole bunch is linked together via aa.pro that is used in
'qmake-qt4 -o Makefile aa.pro' to create a makefile for make.


I have not found an errors when I create small testcases.
This happens both in 686 and amd64. Up todate Sid.

Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: ilgovs$sil$1@dough.gmane.org">http://lists.debian.org/ilgovs$sil$1@dough.gmane.org
 
Old 03-12-2011, 08:49 PM
Hugo Vanwoerkom
 
Default errors with g++-4.5 not with g++-4.4

Sven Joachim wrote:

On 2011-03-12 18:17 +0100, Hugo Vanwoerkom wrote:


I am looking for your opinion as to whose bug this is.

I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists
of more than 103 C++ sourcefiles (1000's of lines of code) that get
copiled into a single executable.

Suddenly using the g++-4.5 compiler it produces an error in the link phase:

...
grafrs.cpp.text+0x355d): undefined reference to `mutrec'
...

But when I use the g++-4.4 compiler everything compiles and links
without error, like it has for years with previous C++ compilers.


Is this the squeeze version of g++-4.4 or the wheezy/sid version?


Sid.




Do I file a bug with the g++-4.5 package?


Please read this announcement about linker changes first:

http://lists.debian.org/debian-devel-announce/2011/02/msg00011.html



I have to give that some thought. I explained the problem in full in my
answer to Axel. The linker finds some references but not al. In anycase
this is all linked together via the qmake utility of Qt. Thanks Sven


Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: ilgpov$c0$1@dough.gmane.org">http://lists.debian.org/ilgpov$c0$1@dough.gmane.org
 
Old 03-13-2011, 12:45 PM
Axel Freyn
 
Default errors with g++-4.5 not with g++-4.4

Hi Hugo,
On Sat, Mar 12, 2011 at 03:35:55PM -0600, Hugo Vanwoerkom wrote:
> Axel Freyn wrote:
>> Hi Hugo,
>> On Sat, Mar 12, 2011 at 11:17:19AM -0600, Hugo Vanwoerkom wrote:
>>> Hi,
>>>
>>> I am looking for your opinion as to whose bug this is.
>>>
>>> I have a C++ project ( http://gpc-qt.sourceforge.net/ ) that consists
>>> of more than 103 C++ sourcefiles (1000's of lines of code) that get
>>> copiled into a single executable.
>>>
>>> Suddenly using the g++-4.5 compiler it produces an error in the link phase:
>>>
>>> ...
>>> grafrs.cpp.text+0x355d): undefined reference to `mutrec'
>>> ...
>>>
>>> But when I use the g++-4.4 compiler everything compiles and links
>>> without error, like it has for years with previous C++ compilers.
>>>
>>> Do I file a bug with the g++-4.5 package?
>>
>> I would first assume an error in this project -- and not in g++-4.5 :-)
>>
>> However, before writing a bug, it would be very usefull if you succeed
>> to reduce the test case: I'm almost sure that none of the g++-developers
>> will be happy with a bug report stating "somehow those 1000's lines of
>> code don't compile correctly" -- I would expect a much faster help if
>> you could reduce the problem and reduce it to a few hundred (or even a
>> few tenth) of lines of code...
>> Is that possible?
>>
>> I just had a VERY quick look at the code: It seems that "mutrec" is
>> defined in "aa.cpp". Do you link aa.cpp and grafrs.cpp together?
>>
>
> Thanks Axel. It is stranger yet:
> 1. mutrec is defined in aa.cpp
> 2. It is used as extern in mc.cpp, grafrs.cpp and setfile.cpp
> 3. But g++-4.5 only finds undefined referenes in mc.cpp and grafrs.cpp,
> *not* in setfile.cpp
> 4. Yet the extern for mutrec is defined in all three the same way.
> 5. And previous compilers have found no errors.
> 6. The whole bunch is linked together via aa.pro that is used in
> 'qmake-qt4 -o Makefile aa.pro' to create a makefile for make.
Some updates from my checks:
a) I can't compile the code on amd64: in tranrs.cpp, lines 1789 and 1810
you convert "double *" to "int". However, on amd64 "double *" is of
size 8 bytes, "int" is only 4 bytes ==> You loose precision and get
quite unpredictable results. In addition, g++ from squeeze and wheezy
(4.4 and 4.5) do NOT compile it. Chaning "int" to "long", it works
correctly (maybe the "correct" type would be std:trdiff_t?)

b) The linker error: There is a difference between mc.cpp grafrs.cpp AND
setfile.cpp:
- setfile: you have "extern mutrc" OUTSIDE of all functions
- mc and grafrs: the extern mutrc appears IN a function (drwts and
weights)
Maybe that's the critical point?

Axel


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110313134535.GO11958@axel">http://lists.debian.org/20110313134535.GO11958@axel
 
Old 03-13-2011, 01:05 PM
Axel Freyn
 
Default errors with g++-4.5 not with g++-4.4

Hi Hugo,

> >
> > Thanks Axel. It is stranger yet:
> > 1. mutrec is defined in aa.cpp
> > 2. It is used as extern in mc.cpp, grafrs.cpp and setfile.cpp
> > 3. But g++-4.5 only finds undefined referenes in mc.cpp and grafrs.cpp,
> > *not* in setfile.cpp
> > 4. Yet the extern for mutrec is defined in all three the same way.
> > 5. And previous compilers have found no errors.
> > 6. The whole bunch is linked together via aa.pro that is used in
> > 'qmake-qt4 -o Makefile aa.pro' to create a makefile for make.
> Some updates from my checks:
> a) I can't compile the code on amd64: in tranrs.cpp, lines 1789 and 1810
> you convert "double *" to "int". However, on amd64 "double *" is of
> size 8 bytes, "int" is only 4 bytes ==> You loose precision and get
> quite unpredictable results. In addition, g++ from squeeze and wheezy
> (4.4 and 4.5) do NOT compile it. Chaning "int" to "long", it works
> correctly (maybe the "correct" type would be std:trdiff_t?)
>
> b) The linker error: There is a difference between mc.cpp grafrs.cpp AND
> setfile.cpp:
> - setfile: you have "extern mutrc" OUTSIDE of all functions
> - mc and grafrs: the extern mutrc appears IN a function (drwts and
> weights)
> Maybe that's the critical point?
I succeeded to create a testcase:
a.cc:
extern struct {int cnt;} mutrec;
int main(){
mutrec.cnt = 2;
}

b.cc:
struct{ int cnt; } mutrec = { 0};

This compiles fine with g++-4.4, but not with g++-4.5
(just try "g++-4.4 a.cc b.cc" and "g++-4.5 a.cc b.cc")
g++-4.5 states:
/tmp/cc06Uy69.o: In function `f()':
a.cc.text+0x6): undefined reference to `mutrec'
collect2: ld returned 1 exit status


However, both versions mention the problem:

a.cc:2:28: warning: non-local variable ‘f()::<anonymous struct> mutrec’ uses anonymous type
b.cc:1:23: warning: non-local variable ‘<anonymous struct> mutrec’ uses anonymous type

So, it compiles & links fine if you give those structures a name (e.g.
call them "A"):

a.cc:
extern struct A {int cnt;} mutrec;
int main(){
mutrec.cnt = 2;
}

b.cc:
struct A { int cnt; } mutrec = { 0};

Then, both g++-4.4 and g++-4.5 succeed to link the code.

However, I'm not sure what the C++-standard says to this problem --
should it work with anonymous structures or not?


HTH,

Axel


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110313140515.GQ11958@axel">http://lists.debian.org/20110313140515.GQ11958@axel
 
Old 03-13-2011, 03:15 PM
Hugo Vanwoerkom
 
Default errors with g++-4.5 not with g++-4.4

Axel Freyn wrote:

Hi Hugo,


Thanks Axel. It is stranger yet:
1. mutrec is defined in aa.cpp
2. It is used as extern in mc.cpp, grafrs.cpp and setfile.cpp
3. But g++-4.5 only finds undefined referenes in mc.cpp and grafrs.cpp,
*not* in setfile.cpp

4. Yet the extern for mutrec is defined in all three the same way.
5. And previous compilers have found no errors.
6. The whole bunch is linked together via aa.pro that is used in
'qmake-qt4 -o Makefile aa.pro' to create a makefile for make.

Some updates from my checks:
a) I can't compile the code on amd64: in tranrs.cpp, lines 1789 and 1810
you convert "double *" to "int". However, on amd64 "double *" is of
size 8 bytes, "int" is only 4 bytes ==> You loose precision and get
quite unpredictable results. In addition, g++ from squeeze and wheezy
(4.4 and 4.5) do NOT compile it. Chaning "int" to "long", it works
correctly (maybe the "correct" type would be std:trdiff_t?)

b) The linker error: There is a difference between mc.cpp grafrs.cpp AND
setfile.cpp:
- setfile: you have "extern mutrc" OUTSIDE of all functions
- mc and grafrs: the extern mutrc appears IN a function (drwts and
weights)
Maybe that's the critical point?

I succeeded to create a testcase:
a.cc:
extern struct {int cnt;} mutrec;
int main(){
mutrec.cnt = 2;
}

b.cc:
struct{ int cnt; } mutrec = { 0};

This compiles fine with g++-4.4, but not with g++-4.5
(just try "g++-4.4 a.cc b.cc" and "g++-4.5 a.cc b.cc")
g++-4.5 states:
/tmp/cc06Uy69.o: In function `f()':
a.cc.text+0x6): undefined reference to `mutrec'
collect2: ld returned 1 exit status


However, both versions mention the problem:

a.cc:2:28: warning: non-local variable ‘f()::<anonymous struct> mutrec’ uses anonymous type
b.cc:1:23: warning: non-local variable ‘<anonymous struct> mutrec’ uses anonymous type

So, it compiles & links fine if you give those structures a name (e.g.
call them "A"):

a.cc:
extern struct A {int cnt;} mutrec;
int main(){
mutrec.cnt = 2;
}

b.cc:
struct A { int cnt; } mutrec = { 0};

Then, both g++-4.4 and g++-4.5 succeed to link the code.

However, I'm not sure what the C++-standard says to this problem --
should it work with anonymous structures or not?




Hi Axel,

We got the workaround at the same time! The "fix" is to *not* make
mutrec anonymous ( you called it 'A' ).

IMHO this is a bug, anonymous structures are valid structures...

There are some bugs that crept up in the code of Gpc-qt that I haven't
uploaded yet:


1. You found the one with amd64 in transrs lines 1799 + 1812, I just
left the typedefs off...
2 In grafrs mutrec is made named and placed outside of the function
(lines 22 + 1235)
3 In application, line 1098 should be ...disable_button(8,... *not* 9,
that causes segfaults in places.

4. In bpltw line 464 with tkbfillq... is commented out
5. mc gets mutrec named (line 109)
6. setfile gets mutrec named (line 41)

Thanks for your efforts Axel.

Hugo












--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: iliqk1$664$1@dough.gmane.org">http://lists.debian.org/iliqk1$664$1@dough.gmane.org
 

Thread Tools




All times are GMT. The time now is 07:02 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org