kicad/build/release $ cmake -DCMAKE_BUILD_TYPE=Release ../../
-- KiCad install dir: </usr/local>
-- Check for installed GLEW -- found
-- Boost version: 1.54.0
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find SWIG: Found unsuitable version "2.0.11", but required is at
least "3.0" (found /usr/bin/swig2.0)
Call Stack (most recent call first):
/usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:372 (_FPHSA_FAILURE_MESSAGE)
CMakeModules/FindSWIG.cmake:93 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:676 (find_package)
-- 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".
The find_program routine in kicad/CMakeModules/FindSWIG.cmake obviously thinks I have swig 2.0 installed, but I just built swig 4.0 from source, and when I run swig -version I get SWIG Version 4.0.0.
How can I make cmake continue the kicad build?
Note that which swig shows my swig 4.0 is here: “/usr/local/bin/swig”. swig -swiglib shows: /usr/local/share/swig/4.0.0
This made no difference. So I did a crude hack which works fine instead: I just forced it to be set to where I know the 4.0 binary is (via set(SWIG_EXECUTABLE /usr/local/bin/swig) below). We need a better solution but for now this works I guess. The commented out lines are other things I tried that didn’t work.
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
# find_program(SWIG_EXECUTABLE NAMES swig4.0 swig3.0 swig2.0 swig)
# find_program(SWIG_EXECUTABLE NAMES swig swig3.0 swig2.0 PATHS usr/local/share NO_CMAKE_FIND_ROOT_PATH)
# find_program(SWIG_EXECUTABLE NAMES swig PATHS /usr/local/bin NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
# message("hey " ${SWIG_EXECUTABLE})
set(SWIG_EXECUTABLE /usr/local/bin/swig)
# message("hey " ${SWIG_EXECUTABLE})
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
I’m using Ubuntu 14.04. This machine has unique build dependencies and cannot be upgraded to a later version of Ubuntu at this time.
Is /usr/local/bin earlier on $PATH than /usr/bin?
It’s a longshot, but maybe you are just trying to run cmake from a shell that still has old path to swig cached in it. Try hash -r to dump the cache and force shell to find binaries from $PATH again, that may help.
I should mention that swig2.0 really is installed on my machine in /usr/bin/swig2.0, but I renamed it to /usr/bin/deprecated_swig2.0 to try to make it not found. No luck with that either. I’m not sure how to uninstall swig2.0 either.
UPDATE: I take that back: sudo apt remove swig2.0 looks like it may work, but I think it’ll break other dependencies, so I think I’m going to avoid that for now.
New solution. It turns out you can set the value of SWIG_EXECUTABLE directly when calling cmake, by simply adding -DSWIG_EXECUTABLE="/usr/local/bin/swig", for example, to the end of your cmake command.
I had the same problem on my Ubuntu 14.04, even after a ./configure;make;make install of SWIG 4.0. I removed everything in my build directory and did a cmake ../ again and it worked well.