Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ouch on June 12, 2018, 06:28:20 pm

Title: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: ouch on June 12, 2018, 06:28:20 pm
Just tried compiling on win 7 64bit with the 32 bit version of mingw. I have tried both versions of mingw 7.1 and mingw 8.1 and they both fail at the same place below:

Code: [Select]
i686-w64-mingw32-g++.exe -shared  -Wl,--out-implib=..\..\..\devel31\libwxflatnotebook.a -Wl,--dll -LC:\Programming\wxWidgets\wxWidgets\lib\gcc_dll ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\fnb_customize_dlg.o ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\fnb_resources.o ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\popup_dlg.o ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\renderer.o ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.o ..\..\..\.objs31\plugins\contrib\wxContribItems\wxFlatNotebook\wxFlatNotebook\src\wxFlatNotebook\xh_fnb.o  -o ..\..\..\devel31\wxflatnotebook.dll -Wl,--enable-auto-import -mthreads  -lwxmsw31u
In file included from C:\Programming\wxWidgets\wxWidgets\include/wx/arrstr.h:16,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/filefn.h:15,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/utils.h:20,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/cursor.h:75,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/event.h:21,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/window.h:18,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/control.h:22,
                 from C:\Programming\wxWidgets\wxWidgets\include/wx/statline.h:23,
                 from wxFlatNotebook\include/wx/wxFlatNotebook/fnb_customize_dlg.h:14,
                 from C:\Programming\codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\fnb_customize_dlg.cpp:10:
wxFlatNotebook\include/wx/wxFlatNotebook/wxFlatNotebook.h:58:43: error: expected ')' before '*' token
 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxWindow*, wxWindowPtrArray, WXDLLIMPEXP_FNB);
                                           ^

edit: Fixed typo in subject.
Title: Re: Codeblocks contrib plugins for wx31 fails to compaile with mingw v8.1.0
Post by: stahta01 on June 12, 2018, 06:40:15 pm
Just tried compiling on win 7 64bit with the 32 bit version of mingw. I have tried both versions of mingw 7.1 and mingw 8.1 and they both fail at the same place below:

Post link to at least one compiler installer that fails with build error.

Edit: Also, post the wxWidgets version information.

Tim S.
Title: Re: Codeblocks contrib plugins for wx31 fails to compaile with mingw v8.1.0
Post by: BlueHazzard on June 12, 2018, 06:41:52 pm
Does this wxWidgets version work with an other compiler?
Title: Re: Codeblocks contrib plugins for wx31 fails to compaile with mingw v8.1.0
Post by: ouch on June 12, 2018, 06:49:38 pm
The wxWidgets I used was the trunk version that was just updated today before building. ( last revision was 71bb680 )

and the mingw version I used was their installer:

https://mingw-w64.org/doku.php/download

Specifically:

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download

and yes the wxWidgets version I'm using seems to work fine with my software that I wrote.
Title: Re: Codeblocks contrib plugins for wx31 fails to compaile with mingw v8.1.0
Post by: stahta01 on June 12, 2018, 07:11:12 pm
Downloading the win32-sjlj version of Mingw64 gcc 8.1.0; Edited typo in GCC version number.

It will take several hours to build wxWidgets and then build Code::Blocks.

Note: My guess is that the wxWidgets changed an header file; and, the fix is the include a header in Code::Blocks source code.

Tim S.
Title: Re: Codeblocks contrib plugins for wx31 fails to compaile with mingw v8.1.0
Post by: ouch on June 12, 2018, 08:09:16 pm
If you want I could upload my libs to google drive or something.

My compiler has the following selection: i686-8.1.0-posix-sjlj-rt_v6-rev0

edit: it's uploading now. You just nee the mono DLL release and debug builds right?
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: BlueHazzard on June 12, 2018, 08:30:01 pm
and yes the wxWidgets version I'm using seems to work fine with my software that I wrote.

I meant if codeblocks builds with a other compiler but the same wx version. Because i think this is a wx issue and not a compiler issue...
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: ouch on June 12, 2018, 09:08:11 pm
That I don't know. I was using mingw 7.1 and an old trunk release of wxWidgets. Which doesn't help much.

I originally had this error trying to compile codeblocks with mingw 7.1 and the new updated trunk build of wxWidgets. I then updated mingw to 8.1 hoping to fix the issue only to get the same message. So it very well could be a wxWidgets issue.

And for whatever reason google drive won't let me upload that file. It gets stuck on "finishing upload" I've uploaded it 3 times with the same result. :(

also, my shift is done, so I won't have access to this computer again until thursday.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: stahta01 on June 12, 2018, 09:39:30 pm
Does not seem to be a missing wxWidgets header include problem.

I did confirm the problem with wxWidgets recent git master and Mingw64 32 bit GCC 8.1.0 compiler.
Now building with an GCC 6.4.0 and wxWidgets recent git master to see if wxWidgets or compiler was the trigger of the issue.

Tim S.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: stahta01 on June 12, 2018, 10:00:33 pm
Starting on Date: 5/31/2018 there was many changes to WX_DECLARE_USER_EXPORTED_OBJARRAY [header file] I think the changes resulted in only classnames being supported instead of pointers to classnames. This is theory I have done nothing to confirm it.

Edit: I have stopped work on this and I am going with the likely problem is in Code::Blocks source code; and, it is beyond me to either fix or definitely confirm that C::B wxContrib code is the real problem.

Tim S.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: Miguel Gimenez on June 13, 2018, 10:12:53 am
These are the changes mentioned by stahta01. The original macro definition was

Code: [Select]
#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, decl) \
    typedef T _wxObjArray##name;                            \
    _WX_DECLARE_OBJARRAY(_wxObjArray##name, name, wxArrayPtrVoid, decl)

and the current is

Code: [Select]
#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, classdecl)                     \
    classdecl wxObjectArrayTraitsFor##name                                    \
    {                                                                         \
    public:                                                                   \
        static T* Clone(const T& item);                                       \
        static void Free(T* p);                                               \
    };                                                                        \
    typedef wxBaseObjectArray<T, wxObjectArrayTraitsFor##name>                \
        wxBaseObjectArrayFor##name;                                           \
    typedef int (wxCMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2);         \
    classdecl name : public wxBaseObjectArrayFor##name                        \
    {                                                                         \
    public:                                                                   \
        name() : wxBaseObjectArrayFor##name() { }                             \
        name(const name& src) : wxBaseObjectArrayFor##name(src) { }           \
    }

but this comment in wxWidgets docs (see http://docs.wxwidgets.org/trunk/dynarray_8h.html#a015654ccb706038e60295cc202679be3 (http://docs.wxwidgets.org/trunk/dynarray_8h.html#a015654ccb706038e60295cc202679be3))

Quote
// note: not "MyClass *"!

suggests that

Code: [Select]
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxWindow*, wxWindowPtrArray, WXDLLIMPEXP_FNB);
is incorrect. The original macro definition was tolerant, but the new is not.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: gd_on on June 13, 2018, 12:32:46 pm
Just to add some informations.
I tried to compile wxwidgets 3.1.1 and codeblocks svn 11416 with mingw 64 bits 7.3 (I used x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z, but I'm not sure if it's the best choice !). It's OK.
With x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z, wxwidgets 3.1.1 compilation fails with problems decribed above (WX_DECLARE...), so no way to compile C::B.
gd_on
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: Miguel Gimenez on June 13, 2018, 01:57:55 pm
This patch solves the issue with Windows 7, wxWidgets-master, CB trunk, GCC 7.2.0, 32 bits.

If somebody tests it successfully in another environment (p.e. GCC 8 ) I will post a ticket with the patch in SF.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: ouch on June 14, 2018, 08:58:20 pm
Codeblocks Trunk: 11416

wxWidgets trunk: 1adc3ba

MingW64: i686-8.1.0-posix-sjlj-rt_v6-rev0

On windows 7 64bit home edition.

I can confirm that patch allows it to compile, And upon testing Codeblocks opens up and I'm able to edit files.

So I would say it looks like this fixes it.

Thanks Miguel Gimenez!
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: stahta01 on June 14, 2018, 10:58:31 pm
To be [more] sure it is safe the Lib Finder plugin needs to be tested.

Tim S.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: gd_on on June 15, 2018, 10:00:04 am
I tried to compile wxwidgets 3.1.1 with MinGW 8.1, in 32 bits (with i686-8.1.0-release-posix-sjlj-rt_v6-rev0) or 64 bits (with x86_64-8.1.0-release-posix-seh-rt_v6-rev0) without success.
Many wanings (warning: cast between incompatible function types from 'wxLongToLongHashMap_wxImplementation_HashTable::size_type (*)...) and finally errors (invalid static_cast from type 'long long unsigned int' to type 'HANDLE' {aka 'void*'}).
Some of the users seem to compile without problems wxwidgets 3.1.1 with this 8.1 version. Could you tell me the command line you have used ?
I have : mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fpermissive -fno-keep-inline-dllexport -std=gnu++11 -Wno-deprecated-declarations".
It works for me with MinGW 4.9 -> 7.3.

gd_on
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: Miguel Gimenez on June 15, 2018, 12:44:17 pm
I have never used Libfinder, but the FlatNotebook part seems to work.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: Miguel Gimenez on June 15, 2018, 02:46:56 pm
@gd_on, wxWidgets must always be fixed for the newer compilers. The error you get with static_cast was fixed in trunk three weeks ago, you can backport the fix to wx3.1.1 easily:

https://github.com/wxWidgets/wxWidgets/commit/424f64f27d94f83ed946ebfcf9b9543c828f9f25 (https://github.com/wxWidgets/wxWidgets/commit/424f64f27d94f83ed946ebfcf9b9543c828f9f25)

The wx forums are better for wxWidgets compilation problems.
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: gd_on on June 15, 2018, 04:22:48 pm
Thanks.
I'll try that (or wait 3.1.2 version  ;) )
gd_on
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: Miguel Gimenez on June 15, 2018, 04:55:53 pm
Ticket #704

https://sourceforge.net/p/codeblocks/tickets/704/ (https://sourceforge.net/p/codeblocks/tickets/704/)
Title: Re: Codeblocks contrib plugins for wx31 fails to compile with mingw v8.1.0
Post by: headkase on June 16, 2018, 12:59:25 am
@gd_on, wxWidgets must always be fixed for the newer compilers. The error you get with static_cast was fixed in trunk three weeks ago, you can backport the fix to wx3.1.1 easily:

https://github.com/wxWidgets/wxWidgets/commit/424f64f27d94f83ed946ebfcf9b9543c828f9f25 (https://github.com/wxWidgets/wxWidgets/commit/424f64f27d94f83ed946ebfcf9b9543c828f9f25)

The wx forums are better for wxWidgets compilation problems.

Yup, I reported it: https://forums.wxwidgets.org/viewtopic.php?f=19&t=44671

At the time with MinGW-Builds 64-bit 8.1.0 I built wxWidgets as it was then from git and compiled the latest SVN Code::Blocks wx31_64 against it with all contrib plugins.  It compiled successfully but then if you clicked into the main code editing frame Code::Blocks would crash.  I back-ported that one commit to wxWidgets 3.1.1 and compiled with MinGW 8.1.0 64-bit, still crashed when clicking in the editor frame.  At that point I decided to wait until things brewed some more and an official 3.1.2 comes out instead of the work-in-progress git.