Force GTK3 build

How can I force a build that uses GTK3?

I just asked in the developers mailing list. I’ll inform you if I get an answer.

1 Like

Given you have the appropriate packages installed, you need to add -DwxWidgets_CONFIG_OPTIONS="–toolkit=gtk3" to the CMake command.

2 Likes

Thanks, but it didn’t work, I got a build that still uses gtk2.

Then it is a sign that you have either wxWidgets or wxPython in gtk2 only flavor. You can try disabling wxPython support by adding -DKICAD_SCRIPTING=OFF. If it works, then you may either build KiCad without wxPython or get one build against gtk3.

Try running the CMake command in an empty directory. Among the output lines you will find something similar to:
-- Found wxWidgets: -pthread;;;-lwx_gtk3u_gl-3.0;-lwx_gtk3u_aui-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_stc-3.0 (found suitable version "3.0.4", minimum required is "3.0.2.0")

If you see wx_gtk3 libraries there, then you got it right.

That largely depends on your Distribution.

For Debian and Ubuntu, it depends on which wx development package is installed. libwxgtk3.0-dev uses gtk 2, libwxgtk3.0-gtk3-dev uses gtk 3.

1 Like

This is the cmake command I’m running:
cmake -DKICAD_SPICE=OFF -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_ACTION_MENU=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DCMAKE_INSTALL_PREFIX=/opt/kicad_gtk3 -DwxWidgets_CONFIG_OPTIONS="-toolkit=gtk3" -DCMAKE_BUILD_TYPE="Release" ..

and this is the output of cmake in an empty directory:
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk2u_gl-3.0;-lwx_gtk2u_aui-3.0;-lwx_gtk2u_adv-3.0;-lwx_gtk2u_html-3.0;-lwx_gtk2u_core-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0;-lwx_baseu_xml-3.0;-lwx_gtk2u_stc-3.0 (found suitable version "3.0.4", minimum required is "3.0.0")

So I guess it isn’t working.

@GyrosGeier, I have the both gtk2 and gtk3 dev version of wxWidgets libraries. I’m running debian testing and I have pinned the python-wxgtk3.0, python-wxversion, python-wxgtk3.0-dev, python-wxtools to the versions that use GTK2 (3.0.2.0+dfsg-6). If I upgrade those packages to the ones that use GTK3 and enable python scripting then the build uses GTK3.

I want to keep a build that uses GTK2 and python scripting to do work and a GTK3 build without python scripting to help test the GTK3 builds.

I have (just updated to) Kubuntu 18.10. I added the needed line to CMakeLists.txt:

#
# Find wxWidgets library, required
#

# Turn on wxWidgets compatibility mode for some classes
add_definitions( -DWX_COMPATIBILITY )
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} "--toolkit=gtk3" ) #THIS IS ADDED FOR GTK3

Then cmake complained about missing headers for wxwidgets. I had to install libwxgtk3.0-gtk3-dev. Now I’m compiling and it seems to use gtk3.

-- Found wxPython 3.0.2.0/gtk3 (wxWidgets 3.0.2.0)
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_gl-3.0;-lwx_gtk3u_aui-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_stc-3.0 (found suitable version "3.0.4", minimum required is "3.0.2.0")

I found what was my mistake, I was using only one dash character in the --toolkit parameter.
Many thanks.

Maybe you copied it from here:

This forum does nasty automatic things if you don’t use features like -- this. The quote from Orson above has really only one dash, but it has probably been written with two, like this: –

Reversed quotes created by the forum once took half a day of my life.

1 Like

Yes, I copied the option from the post and I realized that the symbol I got on the terminal was not a dash and replaced it with a dash (minus symbol) but I never tough originally it was two dashes.

More info about building with gtk3 and also python3 by Wayne Stambaugh:

https://lists.launchpad.net/kicad-developers/msg38660.html

2 Likes

Thanks, I was able to build using GTK3, python3 and phoenix. The cmake command I used was:
cmake -DKICAD_SPICE=OFF -DKICAD_SCRIPTING_PYTHON3=ON -DKICAD_SCRIPTING_ACTION_MENU=ON -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON -DCMAKE_INSTALL_PREFIX=/opt/kicad_gtk3 -DwxWidgets_CONFIG_OPTIONS="--toolkit=gtk3" -DCMAKE_BUILD_TYPE="Release" ..

And also I can continue to build using GTK2, python2 with scripting plugins enabled.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.