XSpice model crash in EEschema

Hi,
I have developed some custom XSpice models running as expected with NGSpice-30. I have made symbols to use them in Kicad, associated the models embedded in subcircuits, but when I run the simulation Kicad crash.
What works :

  • The same circuit running in ngspice-30
  • The original xspice code models (like gain) copied under a new name in the new code model library in Kicad

What does not work :

  • The new xspice code model in kicad, using the int user-defined node

Possible problems :

  • The shared library has not been compiled properly
  • The new code model are not read correctly by Kicad
  • The shared library is not the correct one
  • The use of the int user-defined node is a problem somewhere

The output of gdb

Starting program: /usr/local/bin/eeschema
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”.
[New Thread 0x7fffeba62700 (LWP 11091)]
[New Thread 0x7fffeb261700 (LWP 11092)]
[New Thread 0x7fffd9f3a700 (LWP 11110)]
[New Thread 0x7fffd96b9700 (LWP 11111)]
[Thread 0x7fffd96b9700 (LWP 11111) exited]
[New Thread 0x7fffd96b9700 (LWP 11112)]
[New Thread 0x7fffca456700 (LWP 11113)]
[Thread 0x7fffd96b9700 (LWP 11112) exited]
[New Thread 0x7fffc9c55700 (LWP 11114)]
[Thread 0x7fffca456700 (LWP 11113) exited]
[Thread 0x7fffc9c55700 (LWP 11114) exited]
warning: Could not load shared library symbols for …/lib/ngspice/spice2poly.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/digital.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/xtraevt.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/table.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/xtradev.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/ternary.cm.
Do you need “set solib-search-path” or “set sysroot”?
warning: Could not load shared library symbols for …/lib/ngspice/analog.cm.
Do you need “set solib-search-path” or “set sysroot”?
[New Thread 0x7fffc9c55700 (LWP 11115)]
[New Thread 0x7fffca456700 (LWP 11116)]
[Thread 0x7fffc9c55700 (LWP 11115) exited]
[New Thread 0x7fffd96b9700 (LWP 11117)]
[Thread 0x7fffca456700 (LWP 11116) exited]
[Thread 0x7fffd96b9700 (LWP 11117) exited]
[New Thread 0x7fffd96b9700 (LWP 11118)]
[Thread 0x7fffd96b9700 (LWP 11118) exited]
[New Thread 0x7fffd96b9700 (LWP 11120)]
[New Thread 0x7fffca456700 (LWP 11121)]
[Thread 0x7fffd96b9700 (LWP 11120) exited]
[New Thread 0x7fffc9c55700 (LWP 11122)]
[Thread 0x7fffca456700 (LWP 11121) exited]
[Thread 0x7fffc9c55700 (LWP 11122) exited]
[New Thread 0x7fffc9c55700 (LWP 11123)]

Thread 16 “eeschema” received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffc9c55700 (LWP 11123)]
__GI___libc_free (mem=0x4) at malloc.c:3103
3103 malloc.c: Aucun fichier ou dossier de ce type.
(gdb) bt
#0 0x00007ffff5cde98d in __GI___libc_free (mem=0x4) at malloc.c:3103
#1 0x00007fffc90a94b5 in txfree () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#2 0x00007fffc7e45a0e in udn_int_create (evt_struct_ptr=0x7fffcc0042a0)
at xtraevt/int/udnfunc.c:59
#3 0x00007fffc902ef4a in EVTsetup () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#4 0x00007fffc9019208 in CKTdoJob () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#5 0x00007fffc8bea059 in if_run () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#6 0x00007fffc8be3f65 in () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#7 0x00007fffc8bb0032 in () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#8 0x00007fffc8bb0b23 in cp_evloop () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#9 0x00007fffc8ba3685 in () at /usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
#10 0x00007ffff603f6db in start_thread (arg=0x7fffc9c55700) at pthread_create.c:463
#11 0x00007ffff5d6888f in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:95

Info version
Application: KiCad
Version: (5.1.0-1516-g0328f3e33-dirty), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-58-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
Boost: 1.65.1
OpenCASCADE Community Edition: 6.9.1
Curl: 7.58.0
Compiler: GCC 7.4.0 with C++ ABI 1011

Build settings:
KICAD_SCRIPTING=OFF
KICAD_SCRIPTING_MODULES=OFF
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=OFF
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=OFF
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

And for compiling the ngspice shared library I did

./configure --with-ngshared --enable-xspice --enable-cider
–enable-openmp --disable-debug
make clean
make
sudo make install

Codemodels not found: There may be an installation problem. Check for the path of the code models (the *.cm files).

What about standard circuits using a code model, e.g. using an OpAmp with the poly source in XSPICE (so not using the int user defined node)? Are they o.k.?

I have all the .cm libraries in /usr/local/lib/ngspice
However, in /usr/lib/ngspice, ternary.cm is missing (that is the one I created)
The standard ones are working, I tried the gain model and it is ok, I also copied the same file in the ternary code model library, named it differently (but without other modification) and it also works.
Is there a way to test the shared library ? I have no idea if it is the problem or something else in Kicad.