Opened 2 years ago
Closed 2 years ago
#820 closed defect (worksforme)
mingw build failure with Windows header
Reported by: | Ralf Habacker | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Other | Version: | 1.4.21 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Operating System: | Microsoft Windows |
Description
An error was reported by openSUSE Build Service at https://bugzilla.opensuse.org/show_bug.cgi?id=1205190 that xapian core could not be built with mingw gcc12.
The reason for this problem is the extensive use of "using namespace std" in the sources, which makes the definition of 'byte'
enum class byte : unsigned char;
maps from the std namespace into the global namespace, which then conflicts with definitions from Windows headers:
/usr/i686-w64-mingw32/sys-root/mingw/include/rpcndr.h:397:170: error: reference to 'byte' is ambiguous
and within the source code:
./common/internaltypes.h:32:17: note: 'typedef uint8_t byte' 32 | typedef uint8_t byte;
A corresponding patch based on version 1.4.21 that fixes the problem can be found at https://build.opensuse.org/package/view_file/windows:mingw:win32/mingw32-xapian-core/xapian-core-1.4.21-std-fixes.patch?expand=1.
Change History (3)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Ah yes, https://build.opensuse.org/request/show/1034701 seems to show the problem was found with 1.4.5.
Please try dropping the patch from your build to check that this has indeed already been addressed.
comment:3 by , 2 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
No response from submitter, but I'm confident we've addressed this already so closing.
If you can reproduce the problem with unpatched 1.4.21 (or later once there are newer versions) please comment with details and we can reopen.
Thanks for the patch, but this problem was addressed years ago (2018) by f527b61a65f259ce68b11ef9d89a959f5cf62a12 which was in xapian-core 1.4.8 - since then the
typedef uint8_t byte;
line isn't present incommon/internaltypes.h
(or anywhere else).It looks to me like your bug reporter must have been using xapian-core 1.4.7 or earlier to get this error.
The use of
using namespace std;
has been cleaned up on git master. I'm reluctant to apply such changes to 1.4.x as they touch a lot of code and it's hard to be certain they won't introduce bugs.