Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Pecan on September 28, 2019, 10:13:42 pm

Title: MouseSap fails to compile with wxgtk + gtk3
Post by: Pecan on September 28, 2019, 10:13:42 pm
...snipped...
mouse-sap plugins (which btw fails to compile with wxgtk + gtk3 :( )

I'm very confused about what to install on Mint19 reguarding wxgtk + gtk3.
The instructions at [http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux (http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux) do not match the wxWidgets web page.

When I click on the download button then "source for linux" on the wxWidgets webpage, it wants to download wxWidgets-3.1.2.tar.bz2.
Is that the same as wxgtk ?

Is my synaptic showing that wxgtk is present on my system. Is that actually wxWidgets?
(http://forums.codeblocks.org/index.php?action=dlattach;topic=23485.0;attach=9836;image)
.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: oBFusCATed on September 29, 2019, 01:38:15 am
Yes, it is the same thing. Use wx-config --list to see what versions you have installed.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: Pecan on September 30, 2019, 08:09:33 am
After two day of work, I cannot get CB to compile using gtk3, much less solve the MouseSap plugin problems (using Mint 19 based on gtk3).

So..., I'll remove all use of gtk from MouseSap to get it to work under windows and Linux gtk2 and disable it for use under gtk3 until CB itself compiles using gtk3.

I'm just not savvy enough on Linux to solve the gtk3 compiler errors in scintilla.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: oBFusCATed on September 30, 2019, 02:43:33 pm
What do you mean by compiler errors? If you're using autotools it compiles fine. If you're using projects you have to find all mentions of pkg-config for gtk and gdk and replace -2.0 with -3.0 and it should build fine at least the core.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: Pecan on September 30, 2019, 05:25:26 pm
What do you mean by compiler errors? If you're using autotools it compiles fine. If you're using projects you have to find all mentions of pkg-config for gtk and gdk and replace -2.0 with -3.0 and it should build fine at least the core.

Code
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -DcbDEBUG -DCB_PRECOMP -std=c++11 -pthread -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/pecan/proj/cbBeta30/trunk/src/sdk/wxscintilla/src/ScintillaWX.cpp -o .objs30/sdk/wxscintilla/src/ScintillaWX.o
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:30:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /home/pecan/proj/cbBeta30/trunk/src/sdk/wxscintilla/src/ScintillaWX.cpp:58:
/usr/include/gtk-3.0/gdk/gdktypes.h:143:39: error: conflicting declaration ‘typedef struct _GdkWindow GdkWindow’
 typedef struct _GdkWindow             GdkWindow;
                                       ^~~~~~~~~
In file included from /usr/include/wx-3.0/wx/wxprec.h:12:0,
                 from /home/pecan/proj/cbBeta30/trunk/src/sdk/wxscintilla/src/ScintillaWX.cpp:17:
/usr/include/wx-3.0/wx/defs.h:3466:33: note: previous declaration as ‘typedef struct _GdkDrawable GdkWindow’
     typedef struct _GdkDrawable GdkWindow;
                                 ^~~~~~~~~
Process terminated with status 1 (3 minute(s), 29 second(s))
1 error(s), 4 warning(s) (3 minute(s), 29 second(s))
 

There's an include "-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0" that I think should be "...gtk3..." instead. But I cannot figure out where it's coming from.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: sodev on September 30, 2019, 05:35:47 pm
I don't think i've ever build CodeBlocks with CodeBlocks on Linux but i guess the project files contain plain calls to wx-config and your wx-config defaults to the gtk2 variant. In autotools builds i just specifiy the wx-config script of the variant i want to use, a hotfix for your case might be to change the wx-config script, which is only a symlink to the real script, to point the the script of the gtk3 variant.
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: Pecan on September 30, 2019, 06:33:30 pm
... a hotfix for your case might be to change the wx-config script, which is only a symlink to the real script, to point the the script of the gtk3 variant.

Where is location of the wx-config script?
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: oBFusCATed on September 30, 2019, 06:39:41 pm
1. Go to Project -> Build options -> select the root in the tree -> Custom variables
2. WX_CONFIG to "wx-config --version=3.0 --toolkit=gtk3"

I thought you've already passed this step, that's why I've not mentioned it. This is going to work only if wx-config --list returns an output which has a gtk3 version. If not you'll have to change the whole wx-config to point to the correct version of this script.

p.s. You'll have to do this for every plugin project you need to build. :(
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: sodev on September 30, 2019, 06:52:13 pm
Where is location of the wx-config script?

Depends on your system, for me it is:
Code
$ which wx-config
/usr/local/bin/wx-config

$ ls -l /usr/local/bin
wx-config -> /usr/local/lib64/wx/config/gtk3-unicode-3.1

The other scripts will be in a similar location. This is faster than editing every CodeBlocks project file :)
Title: Re: MouseSap fails to compile with wxgtk + gtk3
Post by: Pecan on October 02, 2019, 12:39:09 am
Fixed in head r11871 (maybe).

I removed all direct GTK calls. Hopefully this fixes the problem on wxGTK with GTK 3.
But I cannot test that since I cannot get CodeBlocks to compile on Mint 19 using GTK3.

I'd appreciate it if someone running GTK3 would try to compile MouseSap and report the actual errors.