How can I get kicad to use a newly build ngspice library

Hi folks,

I have the simulator crashing the ngspice library when including ltspices lt3042.sub file.
A user on the diyaudio forum suggested upgrading ngspice so I build ngspice 39 today from source. But the simulator still shows ngspice-36. How can I replace the obviously included ngspice library in kicad?

Operating system is linux mint 21.1

Application: KiCad

Version: 6.0.10-86aedd382b~118~ubuntu22.04.1, release build

Libraries:
wxWidgets 3.0.5
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13

Platform: Linux 6.0.19-t5-ll x86_64, 64 bit, Little endian, wxGTK, mate, x11

Build Info:
Date: Dec 18 2022 19:39:39
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.2
Curl: 7.86.0
ngspice: 36
Compiler: GCC 11.3.0 with C++ ABI 1016

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

Firstly we may check if ngspice-39 will be able to read and use LT3042. Could you publish LT3042.sub here? I will then have a look.

Upgrading ngspice will be a manual procedure. You will have to replace the simulator and some associated files.

KiCad uses the ngspice shared library libngspice.so, not the standard ngspice executable. So compile shared ngspice, e.g. by using ./compile_linux_shared.sh, resulting in a libngspice.so

Locate libngspice.so in your system. It probably will be found at two places: Where KiCad has installed ngspice, and where your compiled ngspice has landed. You will have to figure out which is which.

Next located the files lib/ngspice/analog.cm, together with some other *.cm files. Again they may occur at two places, the KiCad place and your compiled version.

Now you need to copy libngspice.so and the complete lib/ngspice folder with all *.cm files from your compiled installation place to the KiCad place. Before copying, you may rename the lingspice.so and lib/ngspice folder, so that you can revert the copying in case of malfunctioning.

But let’s test first if lt3042.sub is compatible with ngspice. ADI has some tricks to make the usage impossible.

OK, then we will take it one step at a time, here is the sub file. Unfortunately “new users cannot upload files” so here’s a link to my nextcloud: T5! Cloud

Btw. I tried to search for libngspice:
/usr/lib/x86_64-linux-gnu/libngspice.so.0
/usr/lib/x86_64-linux-gnu/libngspice.so.0.0.2

these are the only occurrences, and they are built today.

maybe it is statically linked into builds so it cannot be replaced?

This is a binary, encoded file. ngspice cannot make use of that file.

one more thing, analog.cm can only be found in one location on my system:
-rwxr-xr-x 1 root root 131K Jan 1 2022 /usr/lib/x86_64-linux-gnu/ngspice/analog.cm

as you can see it was built today and is certainly not the “stock” 36 version

ok, that will explain it. f**k that proprietary stuff. /me being sad once again but thanks for your valuable help and keep up the good stuff! I built numerous projects with kicad now and several more are to come, all open source and open hardware…

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