I want to install several versions on my Linux system, but KiCad seems to use hard coded paths and these are the same for all versions, so parallel use of various main versions is not possible. I noticed that there are build options for the paths, so I decided to try building KiCad for myself. I started with KiCad 7.
...
-- Checking for module 'ngspice'
-- No package 'ngspice' found
*** 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 ./tools/build
chmod +x get_libngspice_so.sh
./get_libngspice_so.sh
sudo ./get_libngspice_so.sh install
CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find ngspice (missing: NGSPICE_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/Findngspice.cmake:162 (find_package_handle_standard_args)
CMakeLists.txt:803 (find_package)
I thought ngspice is installed, but installing libngspice0 and libngspice0-dev with apt solved it. Now the error is:
...
-- Checking for module 'ngspice'
-- Found ngspice, version 36
-- Found ngspice: /usr/include
-- Found OCC: /usr/include/opencascade (found version "7.5.2")
*** OpenCascade library missing ***
Could not find a library for TKBinXCAF at /usr/lib/x86_64-linux-gnu
Verify your OpenCascade installation or pass CMake
the library directory as '-DOCC_LIBRARY_DIR=<path>'
CMake Error at cmake/FindOCC.cmake:192 (message):
Call Stack (most recent call first):
CMakeLists.txt:807 (find_package)
Before I install any further package ⌠Whatâs the problem? Missing packages or incorrect paths? Is there any advice? Thanks!
Changing the path to /opt/kicad/6.0 worked (for 7.0.9). With âmake installâ all created files are in /opt/kicad/6.0 and I can copy them all together. I made a deb package with these files and I put the âDependsâ list of the original kicad 6.0.11 deb package into the control file of my deb package.
When I want to execute the kicad binary, I got the message that there is libwx_gtk3u⌠is missing. After manual installation of the WX libs the kicad binary starts and also eeschema, but pcbnew doesnât work, like you wrote in your tutorial. I got this error message:
Failed to load shared library â/opt/kivad/6.0/bin/_psbnew.kifaceâ:
libkicad.3dsg.so.2.0.0: cannot open shared object file: No such file or directory
On a system with the official kicad 6 installed, this file is located at /usr/lib/x86_64-linux-gnu/, but here it is located at /opt/kicad/6.0/lib/. After adding this path to /etc/ld.so.conf.d/libc.conf, it worked.
And now my question:
Is there a (easy) way that kicad knows this path, but not the whole system? Or is there any path kicad looks into by default, where I can put the files into?
When there is more than one version installed, I get a conflict if I put the file to the global path in /usr/lib or if the file is located at /opt/kicad/x.0/, but for every kicad version there is an entry in /etc/ld.so.conf.d/.
I want to create a (single) deb file, which allows to start kicad without using the shell or adding any repositories.
Thank you for your answer. What do I have to do with LD_LIBRARY_PATH? I donât really understand this.
All explanations I found say, that I have to execute âexport LD_LIBRARY_PATH= /path/to/additional/lib-folderâ and then it hase the same effect as adding /path/to/additional/lib-folder to a file in /path/to/additional/lib-folder. It affects all binaries. KiCad 7.0 would search at the same path.
I canât find documentation for adding a path to a binary for the library and it doesnât work:
vboxuser@VBox-KiCad-Test:/opt/kicad/6.0/bin$ export LD_LIBRARY_PATH=/opt/kicad/6.0/lib /opt/kicad/6.0/bin/pcbnew
bash: export: `/opt/kicad/6.0/bin/pcbnewâ: not a valid identifier
Now I got it. Itâs easier than I thought ⌠I donât know why all descriptions I found for this environment variable are only describing the allocation of this variable without the path to the binary. I didnât know that itâs possible to execute a binary with a privious allocation.
For the other people, here a description what I did and what I understand.
Setting LD_LIBRARY_PATH to the library path and then open the binary with the next command has no effect:
If I execute kicad instead of pcbnew and then open pcbnew via kicad then it also works, so there seems to be a chain, the environment variables apply for all binaries that were open from the first binary.
Instead of a symbolic link I created a shell script /usr/bin/kicad6.0 with this content:
Sure. Thatâs the way environment variables work in Linux shells in general. If a setting is not exported, then its scope ends at the end of statement and is just an ordinary shell variable, not an environment variable. However exporting it will cause the setting to be used by all future commands, interfering with other commands that donât want the setting. Thatâs why the command has to follow the setting on the same line. Environment variables are inherited by child processes.
Environment variables work but may be clumsy in some cases. In my instruction page linked to above I describe how to set the library path for the system. It depends on the system but should be easy. Whether somebody wants it that way or not is a system administration decision.
If I use the library path for the system, then itâs not posible to use two different KiCad versions on one system, as there will be collisions. Or am I wrong?