Bug 491779 - compat-wxGTK26: wx/filename.h doesn't build with g++-4.4
Summary: compat-wxGTK26: wx/filename.h doesn't build with g++-4.4
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: compat-wxGTK26
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Michael Schwendt
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-24 00:43 UTC by Scott Tsai
Modified: 2009-03-25 08:55 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-24 16:15:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Scott Tsai 2009-03-24 00:43:47 UTC
Description of problem:
Building any program that includes "wx/help.h" in compat-wxGTK26 with the g++-4.4 that's in rawhide fails with an "ambiguous overload" error.

Version-Release number of selected component (if applicable):
compat-wxGTK26-2.6.4-5.x86_64
gcc-c++-4.4.0-0.23.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. printf '#include <wx/help.h>\nint main() { return 0; }\n' > t.cc
2. g++ $(wx-2.6-config --cflags) $(wx-2.6-config --libs) t.cc -o t
  
Actual results:
$ g++ $(wx-2.6-config --cflags) $(wx-2.6-config --libs) t.cc -o t
In file included from /usr/include/wx-2.6/wx/filesys.h:31,
                 from /usr/include/wx-2.6/wx/html/helpdata.h:25,
                 from /usr/include/wx-2.6/wx/html/helpfrm.h:24,
                 from /usr/include/wx-2.6/wx/html/helpctrl.h:24,
                 from /usr/include/wx-2.6/wx/help.h:36,
                 from t.cc:1:
/usr/include/wx-2.6/wx/filename.h: In static member function ‘static wxChar wxFileName::GetPathSeparator(wxPathFormat)’:
/usr/include/wx-2.6/wx/filename.h:351: error: ambiguous overload for ‘operator[]’ in ‘wxFileName::GetPathSeparators(wxPathFormat)()[0u]’
/usr/include/wx-2.6/wx/filename.h:351: note: candidates are: operator[](const wxChar*, long int) <built-in>
/usr/include/wx-2.6/wx/string.h:813: note:                 wxChar& wxString::operator[](int)
/usr/include/wx-2.6/wx/string.h:815: note:                 wxChar& wxString::operator[](size_t)


Expected results:
Successful compile.

Additional info:

Comment 1 Michael Schwendt 2009-03-24 10:38:46 UTC
Latest in Rawhide is g++ 4.4.0-0.29.

Can't reproduce the problem:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1256202

Comment 2 Scott Tsai 2009-03-24 13:54:16 UTC
I manually downloaded and installed this gcc-4.4.0-0.29 build:
http://koji.fedoraproject.org/koji/buildinfo?buildID=95191
but I still see the problem. When I run:

set -x
g++ --version
printf '#include <wx/help.h>\nint main() { return 0; }\n' > t.cc
g++ $(wx-2.6-config --cflags) $(wx-2.6-config --libs) t.cc -o t

The output is:
+ g++ --version
g++ (GCC) 4.4.0 20090323 (Red Hat 4.4.0-0.29)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ printf '#include <wx/help.h>\nint main() { return 0; }\n'
++ wx-2.6-config --cflags
++ wx-2.6-config --libs
+ g++ -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA -pthread -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 -lwx_gtk2u_html-2.6 -lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6 t.cc -o t
In file included from /usr/include/wx-2.6/wx/filesys.h:31,
                 from /usr/include/wx-2.6/wx/html/helpdata.h:25,
                 from /usr/include/wx-2.6/wx/html/helpfrm.h:24,
                 from /usr/include/wx-2.6/wx/html/helpctrl.h:24,
                 from /usr/include/wx-2.6/wx/help.h:36,
                 from t.cc:1:
/usr/include/wx-2.6/wx/filename.h: In static member function ‘static wxChar wxFileName::GetPathSeparator(wxPathFormat)’:
/usr/include/wx-2.6/wx/filename.h:351: error: ambiguous overload for ‘operator[]’ in ‘wxFileName::GetPathSeparators(wxPathFormat)()[0u]’
/usr/include/wx-2.6/wx/filename.h:351: note: candidates are: operator[](const wxChar*, long int) <built-in>
/usr/include/wx-2.6/wx/string.h:813: note:                 wxChar& wxString::operator[](int)
/usr/include/wx-2.6/wx/string.h:815: note:                 wxChar& wxString::operator[](size_t)

Comment 3 Michael Schwendt 2009-03-24 15:09:48 UTC
Well, here's the Rawhide scratch-build of your test code that succeeded on all architectures:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1256202

x86_64 build log:
http://koji.fedoraproject.org/koji/getfile?taskID=1256204&name=build.log

x86_64 root log:
http://koji.fedoraproject.org/koji/getfile?taskID=1256204&name=root.log

Comment 4 Scott Tsai 2009-03-24 15:57:51 UTC
Reading the x86_64 root.log over again carefully I found the problem :)

I installed compat-wxGTK26-devel.i586 on my x86-64 rawhide box to build 32 bit x86 binaries but forgot to pass "-m32" to g++. "g++ -m32" works so that was totally my fault. Thanks a lot for spending the time to help me!

I noticed that the x86_64 and i586 compat-wxGTK26 packages conflicts with each other though:
Transaction Check Error:
  file /usr/lib/wx/include/gtk2-unicode-release-2.6/wx/setup.h from install of compat-wxGTK26-devel-2.6.4-5.x86_64 conflicts with file from package compat-wxGTK26-devel-2.6.4-5.i586

The two 'setup.h' files are actually identical so I guess it's the timestamp that conflicts?

Comment 5 Scott Tsai 2009-03-24 16:15:16 UTC
The two setup.h files are in fact not identical (I made a stupid mistake when copying the files previously):
--- /home/scottt/setup.h-i586	2009-03-24 23:55:02.688132525 +0800
+++ /home/scottt/setup.h-x86_64	2009-03-25 00:11:07.781382096 +0800
@@ -20,7 +20,7 @@
 #endif /* __cplusplus */
 
 /* fill in with the string wxGetOsDescription() will return */
-#define WXWIN_OS_DESCRIPTION "Linux 2.6.18-128.1.1.el5 i686"
+#define WXWIN_OS_DESCRIPTION "Linux 2.6.18-128.1.1.el5 x86_64"
 
 /* the installation location prefix from configure */
 #define wxINSTALL_PREFIX "/usr"
@@ -832,10 +832,10 @@
 #define SIZEOF_INT 4
 
 /* The number of bytes in a pointer.  */
-#define SIZEOF_VOID_P 4
+#define SIZEOF_VOID_P 8
 
 /* The number of bytes in a long.  */
-#define SIZEOF_LONG 4
+#define SIZEOF_LONG 8
 
 /* The number of bytes in a long long.  */
 #define SIZEOF_LONG_LONG 8
@@ -844,13 +844,13 @@
 #define SIZEOF_SHORT 2
 
 /* The number of bytes in a size_t.  */
-#define SIZEOF_SIZE_T 4
+#define SIZEOF_SIZE_T 8
 
 /* Define if size_t on your machine is the same type as unsigned int. */
-#define wxSIZE_T_IS_UINT 1
+/* #undef wxSIZE_T_IS_UINT */
 
 /* Define if size_t on your machine is the same type as unsigned long. */
-/* #undef wxSIZE_T_IS_ULONG */
+#define wxSIZE_T_IS_ULONG 1
 
 /* Define if you have the dlopen function.  */
 #define HAVE_DLOPEN 1

So I guess expecting to install both i586 and x86_64 compat-wxGTK26-devel packages on the same machine is unreasonable. Sorry for the invalid bug report!

Comment 6 Michael Schwendt 2009-03-25 08:55:30 UTC
The conflict will be fixed with 2.6.4-7 in Rawhide.


Note You need to log in before you can comment on or make changes to this bug.