Unable to build in Linux Ubuntu 14.04

Bug #1804771 reported by Gabriel Staples
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Invalid
Undecided
Unassigned

Bug Description

I'd really like to be able to build from source so I can do a `git bisect` to figure out which commit fixed this issue (https://bugs.launchpad.net/kicad/+bug/1804691), and why. Unfortunately, after ~6 hrs of trying, I am still unable to build.

Hopefully I can get some guidance that will get me to where I can build.

Here is the current error (Cannot find wxPython.h):

    kicad/build/release $ cmake -DCMAKE_BUILD_TYPE=Release ../../
    -- KiCad install dir: </usr/local>
    -- Check for installed GLEW -- found
    -- Boost version: 1.54.0
    -- Check for installed Python Interpreter -- found
    -- Python module install path: lib/python2.7/dist-packages
    -- Found wxPython 3.0.1.1/gtk2 (wxWidgets 3.0.1.1)
    -- Searching for wx/wxPython/wxPython.h in /usr/local/lib/wx/include/gtk2-unicode-3.1
    -- Searching for wx/wxPython/wxPython.h in /usr/local/include/wx-3.1
    CMake Error at CMakeLists.txt:796 (message):
      Cannot find wxPython.h

    -- Configuring incomplete, errors occurred!
    See also "/home/gabriels/GS/dev/KiCad/source/kicad/build/release/CMakeFiles/CMakeOutput.log".
    See also "/home/gabriels/GS/dev/KiCad/source/kicad/build/release/CMakeFiles/CMakeError.log".

--------------------

As developers, this also may be worth looking into to fix, but meanwhile I found a work-around I think: https://forum.kicad.info/t/building-from-source-in-ubuntu-it-thinks-i-have-swig2-0-when-i-have-swig-4-0/13804/3

====================================================================

---------------------------------------------------
Here are my steps so far:
UPDATE: SEE MY FULL STEPS THAT FINALLY WORKED FARTHER DOWN BELOW.
Look for the asterisks ***** to see where they start.
---------------------------------------------------

Gabriel Staples

22 Nov. 2018

References:
- http://kicad-pcb.org/download/source/
- http://docs.kicad-pcb.org/doxygen/md_Documentation_development_compiling.html

===============

To build KiCad:

Details:
    cd <your kicad source mirror>
    mkdir -p build/release
    mkdir build/debug # Optional for debug build.
    cd build/release
    cmake -DCMAKE_BUILD_TYPE=Release \
          ../../
    make
    sudo make install

Step I'm currently stuck on trying to work out dependencies:
    cd /home/gabriels/GS/dev/KiCad/source/kicad/build/release
    cmake -DCMAKE_BUILD_TYPE=Release ../../

===============

INSTALL DEPENDENCIES:

TRY THIS FIRST!
- attempts to download all build dependencies for kicad-nightly, all at once.
    sudo apt-get build-dep kicad-nightly
Source: https://forum.kicad.info/t/source-install-on-ubuntu/8750

GLEW
    sudo apt install libglew-dev
Source: https://www.reddit.com/r/learnprogramming/comments/51u1bg/how_to_install_glew_on_ubuntu/

GLM:
    sudo apt install libglm-dev
https://launchpad.net/ubuntu/+source/glm

ngspice
Info provided by KiCad during the attempted build:
-------
*** NGSPICE library missing ***
Most of ngspice packages do not provide the required libngspice library.
You can either compile ngspice configured with --with-ngshared parameter
or run a script that does the job for you:
  cd ./scripts
  chmod +x get_libngspice_so.sh
  ./get_libngspice_so.sh
  sudo ./get_libngspice_so.sh install
-------
So, run:
    cd /home/gabriels/GS/dev/KiCad/source/kicad/scripts
    chmod +x get_libngspice_so.sh
    ./get_libngspice_so.sh
    sudo ./get_libngspice_so.sh install

OCE (Open Cascade Community Edition Library)
1. Download latest release here: https://github.com/tpaviot/oce; ex: OCE 0.18.3 (OCCT version 6.9.1)
2. Follow instructions here: https://github.com/tpaviot/oce/blob/master/BUILD.Unix.md.
  1. Extract zip.
  2. cd (into its extracted folder)
  3. mkdir build
  4. cd build
  5. cmake ..
  6. Run make with multithreading (1 job per core that you have). Ex: for an 8-core machine, run 8 jobs simultaneously (1 per core) with:
        make -j8
  7. sudo make install/strip
  8. Ensure all tests pass (note: the instructions on the github site above say that the "BRepMeshTestSuite.testMeshTorus" test will fail, but for me 100% of the tests passed):
        make test
  9. Done!

SWIG
https://github.com/swig/swig
Install instructions: https://askubuntu.com/a/961551/327339
    git clone https://github.com/swig/swig.git
    cd swig
    ./autogen.sh
    ./configure
    make
    sudo make install
Do my ugly hack, as described by me here: https://forum.kicad.info/t/building-from-source-in-ubuntu-it-thinks-i-have-swig2-0-when-i-have-swig-4-0/13804/3

WxWidgets/WxPython
[STUCK HERE]
We will need some dependencies to install wxpython though:
1. First, GTK+ >= 3.0:
    sudo apt install libgtk-3-dev
Source: https://askubuntu.com/a/243636/327339
2. Gstreamer:
    sudo apt install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools
Source: https://gstreamer.freedesktop.org/documentation/installing/on-linux.html
Then:
    sudo apt install libgstreamer-plugins-base1.0-dev
Source: https://github.com/wxWidgets/Phoenix/issues/412#issuecomment-346273560
#. Finally: wxpython
(Note: the `-v` option below is so you can see its progress. Otherwise you'll wonder if it's doing anything at all since it takes a long time!)
    sudo pip install wxpython -v <------FAILED

    sudo pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
https://stackoverflow.com/a/49379889/4561887

    sudo apt install python-wxgtk3.0*
https://forum.kicad.info/t/solved-wxpython-error-while-building-from-source/2292/4?u=gabriel_staples

===================================================================

***************************************************
---------------------------------------------------
UPDATE 20181124:2126HRS:
Here are my steps that finally worked.
---------------------------------------------------
***************************************************

Gabriel Staples

Started: 22 Nov. 2018
Updated: 24 Nov. 2018

References:
- http://kicad-pcb.org/download/source/
- http://docs.kicad-pcb.org/doxygen/md_Documentation_development_compiling.html

- This file will be appended to this "bug report": "Unable to build in Linux Ubuntu 14.04" - https://bugs.launchpad.net/kicad/+bug/1804771

===============

To build KiCad:

Details:
    cd <your kicad source mirror>
    mkdir -p build/release
    mkdir build/debug # Optional for debug build.
    cd build/release
    cmake -DCMAKE_BUILD_TYPE=Release \
          ../../
    make <----NOPE! Run one 'j'ob per cpu core instead! Ex: `make -j8` Ah....MUCH BETTER! Using `make` gave my 8-core machine an avg. load of *maybe* 20%. `make -j8` give it an average load of nearly 100%. This will compile 5~8 times faster now. Awesome.
    sudo make install <----WATCH OUT! DON'T DO THIS, RIGHT? WON'T THIS INTERFERE WITH MY CURRENT NIGHTLY AND STABLE INSTALLS? JUST RUN THE EXECUTABLE IN THE RELEASE FOLDER DIRECTLY INSTEAD I THINK.

Step I'm currently stuck on trying to work out dependencies:
    cd /home/gabriels/GS/dev/KiCad/source/kicad/build/release
    cmake -DCMAKE_BUILD_TYPE=Release ../../

UPDATE 20181124-0041HRS: USE THIS COMMAND INSTEAD TO DISABLE SCRIPTING (borrowed from the mac instructions here: http://docs.kicad-pcb.org/doxygen/md_Documentation_development_compiling.html#build_osx):
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF ../../

==========> FINAL cmake command ANSWER <===========: UPDATE 20181124-2059HRS: USE THIS cmake COMMAND INSTEAD (as copied from way down below):
A. (See "Sample output A:" of this cmake command at the end of this file, below.)
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_SCRIPTING_ACTION_MENU=OFF -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../
B. Then (to build with 8-threads: one per cpu core):
    make -j8

===============

INSTALL DEPENDENCIES:

TRY THIS FIRST!
- attempts to download all build dependencies for kicad-nightly, all at once.
    sudo apt-get build-dep kicad-nightly
Source: https://forum.kicad.info/t/source-install-on-ubuntu/8750

GLEW
    sudo apt install libglew-dev
Source: https://www.reddit.com/r/learnprogramming/comments/51u1bg/how_to_install_glew_on_ubuntu/

GLM:
    sudo apt install libglm-dev
https://launchpad.net/ubuntu/+source/glm

ngspice
Info provided by KiCad during the attempted build:
-------
*** NGSPICE library missing ***
Most of ngspice packages do not provide the required libngspice library.
You can either compile ngspice configured with --with-ngshared parameter
or run a script that does the job for you:
  cd ./scripts
  chmod +x get_libngspice_so.sh
  ./get_libngspice_so.sh
  sudo ./get_libngspice_so.sh install
-------
So, run:
    cd /home/gabriels/GS/dev/KiCad/source/kicad/scripts
    chmod +x get_libngspice_so.sh
    ./get_libngspice_so.sh
    sudo ./get_libngspice_so.sh install

OCE (Open Cascade Community Edition Library)
1. Download latest release here: https://github.com/tpaviot/oce; ex: OCE 0.18.3 (OCCT version 6.9.1)
2. Follow instructions here: https://github.com/tpaviot/oce/blob/master/BUILD.Unix.md.
  1. Extract zip.
  2. cd (into its extracted folder)
  3. mkdir build
  4. cd build
  5. cmake ..
  6. Run make with multithreading (1 job per core that you have). Ex: for an 8-core machine, run 8 jobs simultaneously (1 per core) with:
        make -j8
  7. sudo make install/strip
  8. Ensure all tests pass (note: the instructions on the github site above say that the "BRepMeshTestSuite.testMeshTorus" test will fail, but for me 100% of the tests passed):
        make test
  9. Done!

SWIG
UPDATE 20181124-0203HRS: SEE A WAYS DOWN BELOW. DO *NOT* INSTALL swig 4.0 or later! It won't work. Stick with 3.0+ instead, but < 4.0. I install swig 3.0.12 below and it works!
https://github.com/swig/swig
Install instructions: https://askubuntu.com/a/961551/327339
    git clone https://github.com/swig/swig.git
    cd swig
    ./autogen.sh
    ./configure
    make
    sudo make install
Do my ugly hack, as described by me here: https://forum.kicad.info/t/building-from-source-in-ubuntu-it-thinks-i-have-swig2-0-when-i-have-swig-4-0/13804/3
UPDATE 20181124-0026HRS: I think simply ***restarting your computer*** after doing the swig build, rather than doing the "ugly hack" above, also fixes this issue and lets cmake continue past this point! *Perhaps* something like this (adding the "-DSWIG_EXECUTABLE=" setting to set the variable otherwise located in "/home/gabriels/GS/dev/KiCad/source/kicad/CMakeModules/FindSWIG.cmake") also works, fyi! (I don't really understand how to use cmake so I'm guessing here): `cmake -DCMAKE_BUILD_TYPE=Release -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../`.

WxWidgets/WxPython
----------------------------
ATTEMPT #1:
[STUCK HERE]
We will need some dependencies to install wxpython though:
1. First, GTK+ >= 3.0:
    sudo apt install libgtk-3-dev
Source: https://askubuntu.com/a/243636/327339
2. Gstreamer:
    sudo apt install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools
Source: https://gstreamer.freedesktop.org/documentation/installing/on-linux.html
Then:
    sudo apt install libgstreamer-plugins-base1.0-dev
Source: https://github.com/wxWidgets/Phoenix/issues/412#issuecomment-346273560
#. Finally: wxpython
(Note: the `-v` option below is so you can see its progress. Otherwise you'll wonder if it's doing anything at all since it takes a long time!)
    sudo pip install wxpython -v <------FAILED

    sudo pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
https://stackoverflow.com/a/49379889/4561887

    sudo apt install python-wxgtk3.0*
https://forum.kicad.info/t/solved-wxpython-error-while-building-from-source/2292/4?u=gabriel_staples
----------------------------
ATTEMPT #2:
Download "wxPython-src-3.0.2.0.tar.bz2" here: https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/
NEVERMIND.
SOLUTION: DISABLE SCRIPTING! SEE THE "UPDATE 20181124-0041HRS" above. Disable scripting by using this cmake command instead:
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF ../../
Solved! cmake completed! Now I can run `make`!

Running `make -j8`
I have this build error now: "/home/gabriels/GS/dev/KiCad/source/Build failure--20181124-0109hrs.txt". Seems to be related to swig maybe? So, let's try *downgrading* from swig 4 to 3.
    cd /home/gabriels/GS/dev/KiCad/source/dependencies/swig
    sudo make uninstall
    sudo reboot <---this is required! It allows the old v2.0.11 of swig to be properly re-associated with the swig command apparently. Check with `swig -version` after reboot to ensure it works.

Ok, install swig 3.0.12 now. Let's give it a shot.
Download here: https://github.com/swig/swig/releases/tag/rel-3.0.12.
Extract it.
    cd swig-rel-3.0.12
    ./autogen.sh
    ./configure
    make -j8
    sudo make install
    sudo reboot
After reboot, check `swig -version`. I now get: "SWIG Version 3.0.12". Good!
`which swig` shows: "/usr/local/bin/swig". Running `cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF ../../` fails with:
    "Could NOT find SWIG: Found unsuitable version "2.0.11", but required is at
      least "3.0" (found /usr/bin/swig)".
So, foce it to find it with the -DSWIG_EXECUTABLE= define as follows:
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../
Good, now go back to building:
    make -j8
Failed. Same error.
So, delete the entire /build/release folder and start again.
Run the cmake command a few lines above. Done. Good.
Now run `make -j8` again. Let's see if it's any different this time.

(15 minute wait while it builds)
If this fails [UPDATE: IT WORKED!]: WHAT TO TRY NEXT:
1. Make this an Eclipse project, and get Eclipse to index it.
2. Search through these errors and see if you can actually fix them in the source code itself!
3. Consider searching through the wxwidgets kicad mac os github repo (and the kicad-mac-builder [https://github.com/KiCad/kicad-mac-builder]) to see if it has special modifications for this that somehow fix it. I mean: why's it failing for me in the first place!?

The build worked! So, no need to try my 3 things above.

Per Jean-Pierre Charras in Comment #8 here (https://bugs.launchpad.net/kicad/+bug/1804771), however, let's also turn scripting off next time by adding `-DKICAD_SCRIPTING_ACTION_MENU=OFF` to my cmake command. Here's my new, full cmake command:
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_SCRIPTING_ACTION_MENU=OFF -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../

Also note that Seth Hillbrand's suggestion is spot-on: when changing the cmake command options, it's best to remove all files in the build directory and start over again from scratch. That, in addition to the downgrade from swig 4.0 to swig 3.0.12 above, was critical to getting the build to finally complete!

========================

Extra cmake notes for newcomers like me to cmake:

1. For more info on `cmake`, see the man pages with `man cmake`.
2. "kicad/CMakeLists.txt" seems to be the primary cmake build file that tells cmake what to do for this build
3. While running the cmake command, it generates a CMakeCache.txt file (ex: in "kicad/build/release/CMakeCache.txt") which apparently contains *every single cmake variable* in the entire build! Read the top of the CMakeCache.txt file for a few details on how to use & modify it. All of these variables can be overridden when running the cmake command, via "define" (D) directives. For example: `-DKICAD_SCRIPTING_WXPYTHON=OFF`. This means that the 'D'efined variable "KICAD_SCRIPTING_WXPYTHON" *must* exist in the CMakeCache.txt file. And, sure enough, it does, and cmake even gives you a comment about it and tells you the datatype for this variable. For instance, for this one, it says:
    //Build wxPython implementation for wx interface building in Python
    // and py.shell (default ON).
    KICAD_SCRIPTING_WXPYTHON:BOOL=OFF
That's how I'm also able to edit the SWIG_EXECUTABLE path via `-DSWIG_EXECUTABLE="/usr/local/bin/swig"`, for instance, too (even though that was originally a guess on my part that editing it in this way might be possible). The CMakeCache.txt file, for this variable, contains:
    //Path to a program.
    SWIG_EXECUTABLE:FILEPATH=/usr/local/bin/swig
(I imagine it wrote that value down when I passed it in as an input define to cmake). Regardless though, it works.

=================================================

Sample output A:
7510-gabriels ~/GS/dev/KiCad/source/kicad/build/release $ cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_SCRIPTING_ACTION_MENU=OFF -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- KiCad install dir: </usr/local>
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for iso646.h
-- Looking for iso646.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for malloc
-- Looking for malloc - found
-- Looking for math.h
-- Looking for math.h - found
-- Looking for C++ include cmath
-- Looking for C++ include cmath - found
-- Looking for asinh
-- Looking for asinh - found
-- Looking for acosh
-- Looking for acosh - found
-- Looking for atanh
-- Looking for atanh - found
-- Performing Test HAVE_CMATH_ISINF
-- Performing Test HAVE_CMATH_ISINF - Success
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for getc_unlocked
-- Looking for getc_unlocked - found
-- Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE
-- Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE - Failed
-- Performing Test COMPILER_SUPPORTS_WVLA
-- Performing Test COMPILER_SUPPORTS_WVLA - Success
-- Performing Test COMPILER_SUPPORTS_WSHADOW
-- Performing Test COMPILER_SUPPORTS_WSHADOW - Success
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found GLEW: /usr/include
-- Check for installed GLEW -- found
-- Found GLM: /usr/include (found suitable version "0.9.5.1", minimum required is "0.9.5.1")
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.35.0")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for module 'cairo'
-- found cairo, version 1.13.1
-- Found Cairo: /usr/lib/x86_64-linux-gnu/libcairo.so (found suitable version "1.13.1", minimum required is "1.8.8")
-- checking for module 'pixman-1'
-- found pixman-1, version 0.30.2
-- Found Pixman: /usr/lib/x86_64-linux-gnu/libpixman-1.so (found suitable version "0.30.2", minimum required is "0.30")
-- Boost version: 1.54.0
-- Found ngspice: /usr/local/share/ngspice/include
-- Found wxWidgets: -L/usr/local/lib;-pthread;;;-lwx_gtk2u_gl-3.1;-lwx_gtk2u_aui-3.1;-lwx_gtk2u_adv-3.1;-lwx_gtk2u_html-3.1;-lwx_gtk2u_core-3.1;-lwx_baseu_net-3.1;-lwx_baseu-3.1;-lwx_baseu_xml-3.1;-lwx_gtk2u_stc-3.1 (found suitable version "3.1.0", minimum required is "3.0.0")
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.6")
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.1f")
-- S3DSG version: 2.0.0
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    SWIG_EXECUTABLE

-- Build files have been written to: /home/gabriels/GS/dev/KiCad/source/kicad/build/release

=================================================

END

Revision history for this message
Gabriel Staples (ercaguy) wrote :

Additional question: when I build, will it cross-compile for all operating systems that KiCad supports, or does it just build for the system I'm on? How does your internal build system work such that it produces binaries for so many operating systems?

description: updated
Revision history for this message
eelik (eelik) wrote :

(I'm not a KiCad developer.)

It doesn't cross-compile. Usually you can cross-compile for other machine architectures (processors), not for other operating systems. You can't even cross-compile for other Linuxen in one Linux distribution. Embedded and mobile OS's are an exception, usually you cross-compile for them using a desktop OS, but it's not relevant for KiCad.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Hi Gabriel,

The error message says it all: Cannot find wxPython.h. Given that the search paths start with /usr/local, I assume you have previously compiled and installed wxWidgets manually and now it takes precedence.

If you have wxPython installed from your distribution package, then you may add -DwxWidgets_CONFIG_EXECUTABLE=/path/to/wx-config parameter to the cmake command. The path is likely /usr/bin/wx-config.

Revision history for this message
Nick Østergaard (nickoe) wrote :

If you are just going to figure out a change in pcbnew about the zero lenght tracks. I suggest you disable all the scripting options and spice. Ccmake is your friend. It makes the builds faster and have less dependencies, which is good as it looks like you are on a quite old ubunut release.

The ubuntu builds are from a PPA, look at the build scripts if you would like to understand it.

https://git.launchpad.net/~js-reynaud/+git/kicad-daily-pkg/tree/debian?h=dailybuild

Revision history for this message
Seth Hillbrand (sethh) wrote :

I'm marking this as invalid (as it is a support request) just to keep the bug tracker clear. We'll still see all of your responses in this thread and be able to respond, so feel free to keep posting if you still have issues compiling after trying Nick and Orson's suggestions. The status flag simply helps our search function remain low-noise.

Changed in kicad:
status: New → Invalid
Revision history for this message
Gabriel Staples (ercaguy) wrote :
Download full text (5.9 KiB)

@Seth, thanks for letting me know.

Update to all:

I switched my cmake command to this (`cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF ../../`) and got it to complete. Now, my build fails. Says there's errors in the source code. Why would I be seeing this when this is supposed to be a valid build?

I'm building on commit ed6c68a1e35f68c1d0b1f46715cf7a5ac5032b65 from 22 Nov.

------------------

7510-gabriels ~/GS/dev/KiCad/source/kicad/build/release $ make -j8
[ 0%] [ 0%] Built target netlist_lexer_source_files
Built target page_layout_lexer_source_files
[ 0%] Built target lib_table_lexer_source_files
[ 0%] Generating version string header
[ 0%] [ 0%] Built target legacy_gal
Built target pcb_lexer_source_files
[ 0%] Built target pcb_plot_lexer_source_files
-- Using Git to determine build version string.
-- Found Git: /usr/bin/git (found version "1.9.1")
[ 1%] Built target legacy_wx
[ 1%] [ 2%] Built target cmp_library_lexer_source_files
Built target dialog_bom_cfg_lexer_source_files
[ 3%] Built target kicad_3dsg
[ 3%] Built target polygon
[ 3%] -- Not updating /home/gabriels/GS/dev/KiCad/source/kicad/build/release/kicad_build_version.h
Built target field_template_lexer_source_files
[ 3%] Built target version_header
[ 3%] Built target lib_dxf
[ 3%] Built target specctra_lexer_source_files
[ 4%] Built target potrace
[ 4%] Built target idf3
[ 4%] Built target pcb_calculator_lexer_source_files
[ 4%] Built target idfcyl
[ 4%] Built target connectivity
[ 4%] [ 6%] Built target idfrect
Built target gal
[ 6%] Built target unit_test_utils
[ 6%] Built target dxf2idf
[ 6%] Built target s3d_plugin_oce
[ 7%] Built target kicad2step
[ 9%] Built target s3d_plugin_vrml
[ 13%] Built target pcbcommon
[ 43%] Built target bitmaps
[ 44%] Built target pcad2kicadpcb
[ 48%] Built target 3d-viewer
[ 59%] Built target common
[ 59%] [ 59%] Built target github_plugin
[ 60%] Built target bitmap2component
Built target s3d_plugin_idf
[ 60%] Built target qa_utils
[ 62%] Built target pcb_calculator_kiface
[ 62%] Built target idf2vrml
[ 63%] Built target pl_editor_kiface
[ 63%] Built target kicad-ogltest
[ 64%] Built target qa_common
[ 65%] [ 65%] Built target kicad
Built target pl_editor
[ 65%] Built target pcb_calculator
[ 65%] Built target io_benchmark
[ 69%] Built target gerbview_kiface
[ 71%] Built target pnsrouter
[ 71%] Built target gerbview
[ 72%] Built target cvpcb_kiface
[ 72%] Built target qa_pcb_parse_input
[ 84%] Built target eeschema_kiface
[ 84%] Built target qa_eagle_plugin
[ 84%] [ 84%] Built target eeschema
Building CXX object pcbnew/CMakeFiles/pcbnew_kiface_objects.dir/pcbnew_wrap.cxx.o
/home/gabriels/GS/dev/KiCad/source/kicad/build/release/pcbnew/pcbnew_wrap.cxx: In function ‘PyObject* _wrap_new_LSET(PyObject*, PyObject*)’:
/home/gabriels/GS/dev/KiCad/source/kicad/build/release/pcbnew/pcbnew_wrap.cxx:141375:45: error: invalid conversion from ‘PyObject* {aka _object*}’ to ‘Py_ssize_t {aka long int}’ [-fpermissive]
     return _wrap_new_LSET__SWIG_0(self, args);
                                             ^
/home/gabriels/GS/dev/KiCad/source/kicad/build/re...

Read more...

Revision history for this message
Gabriel Staples (ercaguy) wrote :

Maybe I need to downgrade from swig 4 to swig 3?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

You also need to add:
-DKICAD_SCRIPTING_ACTION_MENU=OFF.

It is also possible pcbnew_wrap.cxx is a old and incorrect file. must be removed.
But if the option -DKICAD_SCRIPTING_ACTION_MENU=OFF is added to others options, it should be no longer used.

Revision history for this message
Seth Hillbrand (sethh) wrote :

In addition to JP's suggestion, I sometimes find that if I change build options, I need to remove all files in the build directory and start again.

For this reason, I maintain separate build directories for different configuration combinations.

description: updated
description: updated
description: updated
Revision history for this message
Gabriel Staples (ercaguy) wrote :

Thanks @Seth and @Jean-pierre. I have finally got it to compile! After this I feel like I have just accomplished some great feat. It was quite the challenge. >12 hrs effort. I think I could duplicate the effort in far less time now though, and I have taken careful notes to help the next person. I have posted my full notes in my first post above. Hopefully they help the next poor soul who decides to try compiling from source.

The final fix that I needed to do to make it work is detailed in my notes above, but ultimately it was so simply downgrade swig from swig 4 to swig 3 (I used 3.0.12 to be exact), and then to reboot, clean out the entire build directory like @Seth suggested, and build again. Then, it worked! I ended up implementing @Jean-Pierre's suggestion too, but it built at that point even without that in place.

My final build commands ended up being:
    cd <your kicad source mirror>
    mkdir -p build/release
    mkdir build/debug # Optional for debug build.
    cd build/release
    cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING=OFF -DKICAD_SCRIPTING_MODULES=OFF -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_SCRIPTING_ACTION_MENU=OFF -DSWIG_EXECUTABLE="/usr/local/bin/swig" ../../
    make -j8

Note my full cmake command with all of the defines.

------------------------------
NOW MY FINAL QUESTION I THINK:
------------------------------
I did *not* run `sudo make install` for fear of it interfering with my official KiCad nightly and KiCad stable installs, both of which are already present. But, this means KiCad doesn't work quite right, as I have to manually run pcbnew, eeschema, etc, from my build/release folder, rather than letting the main kicad app open them up (it won't). Am I correct in my fear against running `sudo make install`, or can I safely run it somehow?

Revision history for this message
Seth Hillbrand (sethh) wrote :

You can definitely install KiCad locally alongside the PPAs (I run this way). The local version will install /usr/local/* and the PPAs will be in /usr/*

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.