wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
6.07k stars 1.76k forks source link

wxPerl doesn't build under macOS #23885

Open vadz opened 1 year ago

vadz commented 1 year ago

Trying to build on MacOS 10.15.

Installed wxWidgets 3.2 using brew. Built Alien::wxWidgets → ok Unpacked Wx-0.9932 and applied the 3 patches. Building fails at Grid()

Running Mkbootstrap for Grid ()
chmod 644 "Grid.bs"
"/usr/local/Cellar/perl/5.34.0_1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Grid.bs ../../blib/arch/auto/Wx/Grid/Grid.bs 644
"/usr/local/Cellar/perl/5.34.0_1/bin/perl" "/usr/local/Cellar/perl/5.34.0_1/lib/perl5/5.34/ExtUtils/xsubpp"  -noprototypes -nolinenumbers  -typemap '/usr/local/opt/perl/lib/perl5/5.34/ExtUtils/typemap' -typemap '/Users/jv/Wx-0.9932/ext/grid/../../typemap' -typemap '/Users/jv/Wx-0.9932/ext/grid/typemap'  Grid.xs > Grid.xsc
Error: No INPUT definition for type 'wxGridCellEditor *', typekind 'O_WXSHAREDCLIENTDATACONTAINER_THR_SV' found in XS/GridCellEditor.xs, line 23
Error: No INPUT definition for type 'wxGridCellEditor *', typekind 'O_WXSHAREDCLIENTDATACONTAINER_THR_SV' found in XS/GridCellEditor.xs, line 30
...and many more...

And ideas?

If this is not appropriate here, is there another place to discuss this?

Originally posted by @sciurius in https://github.com/wxWidgets/wxWidgets/issues/23689#issuecomment-1725474053

vadz commented 1 year ago

@sciurius Can this Grid.xs file be seen online somewhere?

sciurius commented 1 year ago

I've put up a copy of the file tree at https://www.squirrel.nl/pub/Wx-0.9932/ .

vadz commented 1 year ago

I hoped there would be a Git tree somewhere for grepping things but, in any case, I'm afraid I can't help much here: this seems like a genuine XS problem and not due to any wx changes. I have no idea how did it work before (and still does under Linux?) and why did it find INPUT for this class. Grepping for it might help to understand why is it not detected, but I know next to nothing about XS...

sciurius commented 1 year ago

Ok, thanks so far. I'll try again later and see if I can find something.

sciurius commented 1 year ago

I'm pretty sure I posted a followup yesterday but apparently I forgot to submit it properly.

After fixing the Grid compile problems, which turned out to be a result of a crippled typemap file due to line endings (kudos to Scott, it's all in the Fedora spec file) I ran into a problem with the DND module. In short, the resultant code was (stripped out some less relevant lines):

#ifdef __WXGTK20__
    ...
    wxDataFormatId  format;
    wxDataFormat *  RETVAL;
    if (items < 2)
        format = wxDF_INVALID;
    else {
        format = (wxDataFormatId)SvIV(ST(1))
    ...
#else
    ...
    NativeFormat    format;
    wxDataFormat *  RETVAL;
    if (items < 2)
        format = wxDF_INVALID;
    else {
        format = (NativeFormat)SvIV(ST(1))
    ...
#endif

The 'else' part is compiled, and failed on format = wxDF_INVALID.

I changed #ifdef __WXGTK20__ to #if defined(__WXGTK20__) || defined(__WXMAC__) and then it compiles.

Testing does not reveal any anomalities in program behaviour so far. Great!

sciurius commented 1 year ago

The main reason I needed a newer version of wxWidgets is to get rid of issue https://github.com/wxWidgets/wxWidgets/issues/15705. But even with 3.2.2 I still get ASCII quotes substituted with typographical symbols when I insert a text in a wxTextCtrl.

Am I still missing something?

PBfordev commented 1 year ago

I know nothing about macOS or Perl but wxTextCtrl on macOS has methods dealing with automatic character substitution: https://github.com/wxWidgets/wxWidgets/blob/e570d85164af9a2bb1bf6ebb9a061cda97f1ae56/include/wx/osx/textctrl.h#L146-L149

They are mostly undocumented but vadim suggested they can be used in the user code: https://groups.google.com/g/wx-users/c/_auYnoBE8jE/m/y52IxfvDAQAJ

sciurius commented 1 year ago

As I understand from https://github.com/wxWidgets/wxWidgets/commit/c07523734f2d93a8c9042d80fdd458954b0e1d41#diff-b2ef97476784dbcada96f8b5529433a95ef01c3b8f3ec4b771c8b109b6becf87 it should be disabled by default.

PBfordev commented 1 year ago

As I understand from c075237#diff-b2ef97476784dbcada96f8b5529433a95ef01c3b8f3ec4b771c8b109b6becf87 it should be disabled by default.

I am sorry, I thought we were talking about wxWidgets 3.2, where I could not find that code from 2016 (grepping the source for setAutomaticQuoteSubstitutionEnabled), assuming it was replaced by the aforementioned methods (see also 3.2 wxNSTextViewControl ctor).

BTW, I think it would be better if this issue was left for the build issues and unrelated run-time issues were discussed elsewhere.

sciurius commented 1 year ago

My turn for misunderstanding... ☺

swt2c commented 1 year ago

I hoped there would be a Git tree somewhere for grepping things but, in any case, I'm afraid I can't help much here: this seems like a genuine XS problem and not due to any wx changes. I have no idea how did it work before (and still does under Linux?) and why did it find INPUT for this class. Grepping for it might help to understand why is it not detected, but I know next to nothing about XS...

The closest thing to a git repo is the Debian repository, but it is patches-unapplied, so you'd have to apply the patches to see the wx 3.2 changes. https://salsa.debian.org/perl-team/modules/packages/libwx-perl

vadz commented 1 year ago

If there is no official wxPerl source tree anywhere any longer, I think it would be nice to import it to GitHub and create wxWidgets/wxPerl repository for it and apply Scott's patches to it.

Anyhow, I think this issue got resolved in the meanwhile, i.e. you can build it now, right, Johan?

sciurius commented 1 year ago

If you setup a wxWidgets/wxPerl repository and give me access, I can reconstruct the history from 0.07 (2001-08-29) to latest known (0.9932, 2017-04-18). Then we can add Scott's patches for 3.2 and mine for MacOS. Note that Scott's and mine patches do not completely support all 3.2 enhancements. Just enough to get going, and maybe refine later.

And yes, the issue is resolved so it can be closed.