WxPython 3.1 Error - Building Kicad from Source - Ubuntu 18.04

Hello everyone,

I’m trying to build kicad from source on my notebook with ubuntu 18.04.

I have allready installed everything what is needed for the installation from the list in Install.txt in the kicad direction.

But when i want to cmake the files this error is detected:

martin@MC-EZ:~/Downloads/Kicad/kicad-source-mirror-master/build$ cmake DCMAKE_BUILD_Type=Release …/
cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
– Kicad install dir: </usr/local>
– Check for installed GLEW – found
– Boost version: 1.65.1
– Check for installed Python Interpreter – found
– Python module install path: lib/python2.7/dist-packages
CMake Error at CMakeLists.txt:749 (message):
wxPython version 3.1 does not appear to be installed on the system.

– Configuring incomplete, errors occurred!
See also “/home/martin/Downloads/Kicad/kicad-source-mirror-master/build/CMakeFiles/CMakeOutput.log”.
See also “/home/martin/Downloads/Kicad/kicad-source-mirror-master/build/CMakeFiles/CMakeError.log”.

I have allready installed wxpython … but the version 3.0. and 4.0. … i dont find any version 3.1…

Does anyone know what the problem is and how i can fix it?

Best regards,
Martin

cmake is complaining about curl not being found. you’ll need to install the curl dev package.

hm… i have allready installed curl from this direction:
https://curl.haxx.se/download.html

There is something wrong with my wxwidgets… i have read, that you should have the wxpython and wxwidgets version the same…

First i have installed wxwidgets 3.1 and wxpython 3.0 … than the problems started. The wxpython installation was not recognized… than i removed wxwidgets and tried to install the wxwidgets 3.0.4 version… but know kicad gives me an error with wxwidgets…

i realy dont know what else to do… i think about reinstall the complete ubuntu…

There is one simple way to have all the development dependencies installed so that configuring and compiling the latest git code should just work.

  1. Add the ubuntu nightly builds ppa to ubuntu sources list.
  2. run “sudo apt-get build-dep kicad”.

Now you can remove the ppa if you want to.

2 Likes

i have tried it with this:

sudo add-apt-repository ppa:js-reynaud/kicad-dev-nightly
sudo apt-get update
sudo apt-get build-dep kicad

and it installed something.

But the error doesnt disapear:… I think i have installed to many different versions of wxwidgets…

martin@MC-EZ:~/Downloads/Kicad/kicad-source-mirror-master/build$ cmake DCMAKE_BUILD_Type=Release …/
cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
– Kicad install dir: </usr/local>
CMake Error at CMakeModules/FindwxWidgets.cmake:914 (file):
file failed to open for reading (No such file or directory):

/usr/include/wx-3.1-unofficial/wx/version.h

Call Stack (most recent call first):
CMakeLists.txt:561 (find_package)

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find wxWidgets: Found unsuitable version “…”, but required is at
least “3.0.0” (found
-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)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
CMakeModules/FindwxWidgets.cmake:944 (find_package_handle_standard_args)
CMakeLists.txt:561 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/martin/Downloads/Kicad/kicad-source-mirror-master/build/CMakeFiles/CMakeOutput.log”.
See also “/home/martin/Downloads/Kicad/kicad-source-mirror-master/build/CMakeFiles/CMakeError.log”.

Same here; I tried for hours, and simply can’t get to a working state including wxwidgets on Ubuntu.

I also tried on 18.04 and 16.04, and same problem. I’m using a docker environment, to ensure I’m working on a clean install, but still can’t compile 5.0. I may try with Arch Linux next week, but wondering what am I missing. I’m sure core devs must have a standard recipe to compile releases…

For the time being, the solution was to compile with -DKICAD_SCRIPTING_WXPYTHON=OFF

2 Likes

Sadly this might be the solution until kicad is updated for the new wxpython. (This is the reason why there probably will be a kicad 5.1 release hopefully shortly after 5.0.0)
This will be necessary on a lot of distros. (I think one of the last supporting wxpython compiled against gtk2 is debian. But even this distro might not offer it two or three years down the line. So waiting to implement that for v6 is not really an option.)

3 Likes

This is slightly OT, but I’d like to get a volunteer who built KiCad from source, or uses a binary which has support for python scripting (KICAD_SCRIPTING=ON) but does not have support for wxpython (KICAD_SCRIPTING_WXPYTHON=OFF). This is most likely some linux distribution.

As I develop action plugins which use wxpython and I am considering porting the plugins to tkinter, so that they could run also on these builds. But I would like to have an option to detect if KiCad supports wxpython, and then switch to tkinter as a fallback.

So I would like to ask you if can run pcbnew, open a scriptng console and type in:
“import wx” and send me back any response that you get (either copy+paste the text or attach screenshot)

Unfortunately, if WXPYTHON is off, you don’t get a scripting console.

Edit: As an aside, the reason wxpython is disabled for certain platforms is that importing it will import gtk3 libraries that overload the gtk2 ones, crashing KiCad. This also happens if you have import wx in any of your user scripts. As far as I know, there is no way to prevent this for systems that do not supply wxpython for gtk2.

2 Likes

Can you be more specific ,since I come from win platform and I am totally cluless regarding linux distributions and library handling.

What will happen if I have import wx in an action script and KICAD_SCRIPTING_WXPYTHON=OFF and the action script is run?

My running hypothesis was that I would get an exception and my previous appeal was to find out the exact exception so that I could handle it properly.

But if I understand you correctly even with KICAD_SCRIPTING_WXPYTHON=OFF, once import wx is executed python will import whatever wxpython available on the system (if it is on the path)? If so, is there another way to find out from within action plugin whether wxpython is available?

Additionally, even with KICAD_SCRIPTING_WXPYTHON=OFF should I experience any issues with the rest of python interface which seems like it uses wx (classes such as wxpoint, wxstring, …)

And for future, would it be better to post questions like this on KiCad developer mailing list?

It depends on the system. But for Ubuntu 18.04, for example, KiCad will crash (segfault). It doesn’t crash because KICAD_SCRIPTING_WXPYTHON=OFF. Rather, KICAD_SCRIPTING_WXPYTHON=OFF because it crashes KiCad. Ubuntu made a decision to remove wxpython with gtk2 support, leaving only wxpython with gtk3. But they still include all of the other wx-gtk2 libraries. So KiCad (which needs GTK2 right now) will compile and run as long as it doesn’t try to load wxpython. If a script loads wxpython, this will also cause KiCad to crash because the script will load the dependent libraries.

There may be a way to find out whether wxpython-gtk2 is available. It probably involves scanning paths. I don’t know of anyway to influence the dynamic loader from within python. But it’s a good question. I’ll see if it gets any traction over on stackoverflow.

Can’t hurt! This is a good dev question. But it also can’t hurt asking here either as I bet there’s more than a few users of your plugins here (myself included) who are curious to follow the development.

2 Likes

Does anyone know how to reliably compile Kicad nightly with KICAD_SCRIPTING_WXPYTHON=ON and wxPython with GTK2 on a Debian-based system? (preferably Ubuntu, but Debian would also work; any version)

I was able to compile on 18.04 with scriptings enabled, but it is still using wxPython with GTK3 (which is default on 18.04), and its’known to cause problems. CMake clearly gives the warning that:

CMake Warning at CMakeLists.txt:574 (message): wxWidgets library has been built against GTK3, it causes a lot of problems in KiCad.

I’m building a series of Docker containers to be able to deterministically compile Kicad nightly and have them side-by-side with v4 and v5. I’m fine in using any distro version (even old ones), and whatever combination of libraries or packages are necessary. I’d prefer to keep Debian/Ubuntu (so I can re-use what I’ve done already), but Fedora or Arch is not out of question.

If you you are compiling the nightly version with scripting ON, can you tell me which combination of distro and packages you’re using?

I haven’t followed all the ins and outs of this one, but my understanding is that no one can build reliably, which is why KiCad is now packaged with wxPython off.

Just as I was updating my plugins for v5 with wx gui :frowning:

The reason for that is that wxpython is no longer available compiled against gtk2. So if @guiambros has an operating system that still supplies that, then it should be possible. (My guess however is that his wxpython is compiled against gtk3 even if there is gtk2 on his system for other libs.)

I’m using Docker, so I can easily use any distro. I know for sure that 18.04 doesn’t work (it has wxPython uses GTK3 by default), so I’m wondering how far back do I need to go to find a wxPython with GTK2. 16.04? 14.04?

17.10 has worked. The problem is pretty new and came recently with new distro versions (beginning with other than Ubuntu).

I would not call that a new problem. It just so happens that now also quite slow linux distros show the problem that distros like fedora and arch showed for years. (There is a reason this has been under known problems on the website for years now.)

Update: I was able to compile with Ubuntu 16.04, and create a deterministic environment that is able to compile using wxWidgets 3.0.4 compiled against GTK2 libraries, and scripting and all options enabled.

I’ll do some more testing and publish on the weekend, in the case anyone is interested in replicating this.

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