Skip Menu |

This queue is for tickets about the Wx CPAN distribution.

Report information
The Basics
Id: 121464
Status: open
Priority: 0/
Queue: Wx

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Compile fails with "error: expected identifier before string constant" from /CORE/unicode_constants.h

Message body is not shown because it is too large.

From: ppisar [...] redhat.com
Dne Ne 30.dub.2017 05:37:28, KENTNL napsal(a): Show quoted text
> In file included from > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > nodot/lib/5.25.12/x86_64-linux/CORE/utf8.h:30:0, > from > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > nodot/lib/5.25.12/x86_64-linux/CORE/regexp.h:21, > from > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > nodot/lib/5.25.12/x86_64-linux/CORE/perl.h:3914, > from ../../cpp/wxapi.h:57, > from RichText.c:23: > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > nodot/lib/5.25.12/x86_64-linux/CORE/unicode_constants.h:72:22: > error: expected identifier before string constant > # define BOM_UTF8 "\xEF\xBB\xBF" /* U+FEFF */ > ^ > /usr/include/wx-2.8/wx/convauto.h:54:9: note: in expansion of macro > ‘BOM_UTF8’ > BOM_UTF8 > ^
/usr/include/wx-2.8/wx/convauto.h Wx header file defines BOM_UTF8 enum value: class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv { private: // all currently recognized BOM values enum BOMType { BOM_None, BOM_UTF32BE, BOM_UTF32LE, BOM_UTF16BE, BOM_UTF16LE, BOM_UTF8 }; } While Perl's CORE/unicode_constants.h defines a same-named macro: # define BOM_UTF8 "\xEF\xBB\xBF" /* U+FEFF */ String literals cannot be enum values.
From: ppisar [...] redhat.com
Dne St 07.čen.2017 10:46:19, ppisar napsal(a): Show quoted text
> Dne Ne 30.dub.2017 05:37:28, KENTNL napsal(a):
> > In file included from > > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > > nodot/lib/5.25.12/x86_64-linux/CORE/utf8.h:30:0, > > from > > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > > nodot/lib/5.25.12/x86_64-linux/CORE/regexp.h:21, > > from > > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > > nodot/lib/5.25.12/x86_64-linux/CORE/perl.h:3914, > > from ../../cpp/wxapi.h:57, > > from RichText.c:23: > > /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc- > > nodot/lib/5.25.12/x86_64-linux/CORE/unicode_constants.h:72:22: > > error: expected identifier before string constant > > # define BOM_UTF8 "\xEF\xBB\xBF" /* U+FEFF */ > > ^ > > /usr/include/wx-2.8/wx/convauto.h:54:9: note: in expansion of macro > > ‘BOM_UTF8’ > > BOM_UTF8 > > ^
> > /usr/include/wx-2.8/wx/convauto.h Wx header file defines BOM_UTF8 enum > value: > > class WXDLLIMPEXP_BASE wxConvAuto : public wxMBConv > { > private: > // all currently recognized BOM values > enum BOMType > { > BOM_None, > BOM_UTF32BE, > BOM_UTF32LE, > BOM_UTF16BE, > BOM_UTF16LE, > BOM_UTF8 > }; > } > > While Perl's CORE/unicode_constants.h defines a same-named macro: > > # define BOM_UTF8 "\xEF\xBB\xBF" /* U+FEFF */ > > String literals cannot be enum values.
Because BOM_UTF8 belongs to public Perl API and it's private to Wx, I think Wx should rename it.
From: ppisar [...] redhat.com
Dne St 07.čen.2017 11:05:07, ppisar napsal(a): Show quoted text
> Because BOM_UTF8 belongs to public Perl API and it's private to Wx, I > think Wx should rename it.
Actually wxGTK has already done it in commit: commit 038809c2f657f03d8688d7a75ca416878dfa0de7 Author: Vadim Zeitlin <vadim@wxwidgets.org> Date: Thu Oct 27 22:48:54 2011 +0000 Make BOM-detection code in wxConvAuto public. Export GetBOM() and DetectBOM() functions. Also rename BOMType enum elements to use "wx" prefix now that they're public. Closes #13599. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
From: ppisar [...] redhat.com
Dne St 07.čen.2017 10:46:19, ppisar napsal(a): Show quoted text
> /usr/include/wx-2.8/wx/convauto.h Wx header file defines BOM_UTF8 enum > value: >
[...] Show quoted text
> While Perl's CORE/unicode_constants.h defines a same-named macro: >
A work around for Perl's Wx is attached.
Subject: Wx-0.9932-Undefine-BOM_UTF8.patch
From 142f895ce9a6631bb874b93052a2d3ff6c7747ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 7 Jun 2017 17:27:43 +0200 Subject: [PATCH] Undefine BOM_UTF8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Work around BOM_UTF8 clash between wxGTK-2.8.18 and perl-5.26.0. CPAN RT#121464 http://trac.wxwidgets.org/ticket/13599 Signed-off-by: Petr Písař <ppisar@redhat.com> --- cpp/wxapi.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/wxapi.h b/cpp/wxapi.h index bdee14f..c0a2924 100644 --- a/cpp/wxapi.h +++ b/cpp/wxapi.h @@ -55,6 +55,12 @@ inline FILE* _wxPli_stderr() { return stderr; } WXPL_EXTERN_C_START #include <EXTERN.h> #include <perl.h> +/* Perl 5.26.0 BOM_UTF8 clashes with WxGTK's BOM_UTF8 + * CPAN RT#121464, + * fixed in newer WxGTK <http://trac.wxwidgets.org/ticket/13599>. */ +#ifdef BOM_UTF8 +#undef BOM_UTF8 +#endif #if WXPERL_P_VERSION_GE( 5, 16, 0 ) && WXPERL_P_VERSION_LT( 5, 18, 0 ) && defined(__WXOSX_COCOA__) #ifdef dNOOP -- 2.9.4
Some more follow up for people who stumble upon this bug:

This problem as stated only occurs in with wxGTK 2.8, not with wxGTK 3.0

wxGTK 3.0 uses 'wxBOM_UTF8' for the enum instead and thus doesn't collide with perls UTF8_BOM macro.

Subsequently, a viable fix that might be at your disposal is to make sure your tooling only builds against wxGTK 3.0, not wxGTK 2.8.

Note that if you go that way, you'll have to do so with Alien-wxWidgets first.

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )