simulating laser_driver on macos nightly causes segfault

Bug #1835296 reported by Christian Conkle on 2019-07-03
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Critical
Unassigned

Bug Description

Running the 20190703 nightly MacOS build (which I believe has the new ngspice-30 library, although I don't know how to check), simulating the laser_driver or sallen_key demo project causes a hard crash of the entire KiCad application. In particular, pressing "Run/Stop Simulation" causes a segmentation fault in libngspice.0.dylib. Stack trace and version information below.

The other two demo simulation projects (rectifier, pspice) do not crash, and seem to give sensible simulation results.

The most obvious difference between the crashing (laser_driver, sallen_key) and working (rectifier, pspice) projects is that the crashing projects include external spice model libraries (e.g. ad8009.lib in laser_driver) and the working projects use only internal models. My own projects seem to crash if they include external models, but I haven't systematically tested.

Please let me know if I can provide any additional information.

Stack trace:

Crashed Thread: 13

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000001d0
Exception Note: EXC_CORPSE_NOTIFY

...

Thread 13 Crashed:
0 libngspice.0.dylib 0x000000011a962c5d MIFsetup + 109
1 libngspice.0.dylib 0x000000012623f3d6 CKTsetup + 214
2 libngspice.0.dylib 0x00000001262391b1 CKTdoJob + 961
3 libngspice.0.dylib 0x0000000125e48050 if_run + 1296
4 libngspice.0.dylib 0x0000000125e4513e dosim + 894
5 libngspice.0.dylib 0x0000000125e148cb docommand + 299
6 libngspice.0.dylib 0x0000000125e13ece doblock + 126
7 libngspice.0.dylib 0x0000000125e13ca3 cp_evloop + 2547
8 libngspice.0.dylib 0x0000000125e0a531 _thread_run + 65
9 libsystem_pthread.dylib 0x00007fff71c342eb _pthread_body + 126
10 libsystem_pthread.dylib 0x00007fff71c37249 _pthread_start + 66
11 libsystem_pthread.dylib 0x00007fff71c3340d thread_start + 13

Version information:

Application: Eeschema
Version: (5.1.0-1195-g72308fe16), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

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

description: updated
tags: added: macos
Changed in kicad:
importance: Undecided → Critical
milestone: none → 6.0.0-rc1
Download full text (3.4 KiB)

Did this happen on previously nightlies?

On Thu, Jul 4, 2019, 2:42 AM Launchpad Bug Tracker <
<email address hidden>> wrote:

> You have been subscribed to a public bug by Nick Østergaard (nickoe):
>
> Running the 20190703 nightly MacOS build (which I believe has the new
> ngspice-30 library, although I don't know how to check), simulating the
> laser_driver or sallen_key demo project causes a hard crash of the
> entire KiCad application. In particular, pressing "Run/Stop Simulation"
> causes a segmentation fault in libngspice.0.dylib. Stack trace and
> version information below.
>
> The other two demo simulation projects (rectifier, pspice) do not crash,
> and seem to give sensible simulation results.
>
> The most obvious difference between the crashing (laser_driver,
> sallen_key) and working (rectifier, pspice) projects is that the
> crashing projects include external spice model libraries (e.g.
> ad8009.lib in laser_driver) and the working projects use only internal
> models. My own projects seem to crash if they include external models,
> but I haven't systematically tested.
>
> Please let me know if I can provide any additional information.
>
> Stack trace:
>
> Crashed Thread: 13
>
> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000001d0
> Exception Note: EXC_CORPSE_NOTIFY
>
> ...
>
> Thread 13 Crashed:
> 0 libngspice.0.dylib 0x000000011a962c5d MIFsetup + 109
> 1 libngspice.0.dylib 0x000000012623f3d6 CKTsetup + 214
> 2 libngspice.0.dylib 0x00000001262391b1 CKTdoJob + 961
> 3 libngspice.0.dylib 0x0000000125e48050 if_run + 1296
> 4 libngspice.0.dylib 0x0000000125e4513e dosim + 894
> 5 libngspice.0.dylib 0x0000000125e148cb docommand + 299
> 6 libngspice.0.dylib 0x0000000125e13ece doblock + 126
> 7 libngspice.0.dylib 0x0000000125e13ca3 cp_evloop + 2547
> 8 libngspice.0.dylib 0x0000000125e0a531 _thread_run + 65
> 9 libsystem_pthread.dylib 0x00007fff71c342eb _pthread_body +
> 126
> 10 libsystem_pthread.dylib 0x00007fff71c37249 _pthread_start
> + 66
> 11 libsystem_pthread.dylib 0x00007fff71c3340d thread_start +
> 13
>
> Version information:
>
> Application: Eeschema
> Version: (5.1.0-1195-g72308fe16), debug build
> Libraries:
> wxWidgets 3.0.4
> libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
> Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
> Build Info:
> wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
> Boost: 1.69.0
> OpenCASCADE Community Edition: 6.9.1
> Curl: 7.54.0
> Compiler: Clang 9.0.0 with C++ ABI 1002
>
> Build settings:
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_PYTHON3=OFF
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
> KICAD_SCRIPTING_ACTION_MENU=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
>
> ** Affects: kicad
> Importance: Critical
> ...

Read more...

tags: added: eeschema ngspice
ocb-hd-ccb (ocb-hd-ccb) wrote :

I had sallen_key demo crash on 7-01 and 7-02 and 7-03 nightly builds. I did not try the other demos on previous builds but I am having the same results as chri7tian on 7-03.

Nick Østergaard (nickoe) wrote :

It is unclear to me if this is an issue with kicad, ngspice or the packaging. How can we narrow this down?

Changed in kicad:
status: New → Confirmed

Do these issues happen with 5.2 or other nightlies from before the
ngspice-30 change?

On Thu, Jul 4, 2019, 1:25 PM Nick Østergaard <email address hidden>
wrote:

> It is unclear to me if this is an issue with kicad, ngspice or the
> packaging. How can we narrow this down?
>
> ** Changed in: kicad
> Status: New => Confirmed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Christian Conkle (conklech) wrote :
Download full text (4.2 KiB)

The current stable release did not have this crash. I can test other builds
if you point me at them. Is there a way to get ngspice to produce debug
output?

On Thu, Jul 4, 2019, 14:20 Adam Wolf <email address hidden> wrote:

> Do these issues happen with 5.2 or other nightlies from before the
> ngspice-30 change?
>
> On Thu, Jul 4, 2019, 1:25 PM Nick Østergaard <email address hidden>
> wrote:
>
> > It is unclear to me if this is an issue with kicad, ngspice or the
> > packaging. How can we narrow this down?
> >
> > ** Changed in: kicad
> > Status: New => Confirmed
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1835296
> >
> > Title:
> > simulating laser_driver on macos nightly causes segfault
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
> >
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> Status in KiCad:
> Confirmed
>
> Bug description:
> Running the 20190703 nightly MacOS build (which I believe has the new
> ngspice-30 library, although I don't know how to check), simulating
> the laser_driver or sallen_key demo project causes a hard crash of the
> entire KiCad application. In particular, pressing "Run/Stop
> Simulation" causes a segmentation fault in libngspice.0.dylib. Stack
> trace and version information below.
>
> The other two demo simulation projects (rectifier, pspice) do not
> crash, and seem to give sensible simulation results.
>
> The most obvious difference between the crashing (laser_driver,
> sallen_key) and working (rectifier, pspice) projects is that the
> crashing projects include external spice model libraries (e.g.
> ad8009.lib in laser_driver) and the working projects use only internal
> models. My own projects seem to crash if they include external models,
> but I haven't systematically tested.
>
> Please let me know if I can provide any additional information.
>
> Stack trace:
>
> Crashed Thread: 13
>
> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000001d0
> Exception Note: EXC_CORPSE_NOTIFY
>
> ...
>
> Thread 13 Crashed:
> 0 libngspice.0.dylib 0x000000011a962c5d MIFsetup + 109
> 1 libngspice.0.dylib 0x000000012623f3d6 CKTsetup + 214
> 2 libngspice.0.dylib 0x00000001262391b1 CKTdoJob + 961
> 3 libngspice.0.dylib 0x0000000125e48050 if_run + 1296
> 4 libngspice.0.dylib 0x0000000125e4513e dosim + 894
> 5 libngspice.0.dylib 0x0000000125e148cb docommand + 299
> 6 libngspice.0.dylib 0x0000000125e13ece doblock + 126
> 7 libngspice.0.dylib 0x0000000125e13ca3 cp_evloop + 2547
> 8 libngspice.0.dylib 0x0000000125e0a531 _thread_run + 65
> 9 libsystem_pthread.dylib 0x00007fff71c342eb _pthread...

Read more...

Adam Wolf (adamwolf) wrote :
Download full text (5.6 KiB)

Thanks! I don't know if there is a way to get ngspice to produce debug
output. I am considering pulling the ngspice-28 to ngspice-30 "upgrade"
into it's own build again rather than putting this broken thing into
nightlies for all macos users. Nick, other folks, what do you think?

On the packaging side, all I did is change an include path and which tag to
pull from. I need to review the build logs.

If someone could double check that this isn't an issue introduced by the
latest macOS OS update, and check on the latest stable KiCad, that would be
great. It could possibly be related to notarization/sandbox changes, and
not actually related to ngspice! (Doubtful, but possible!)

Adam

On Thu, Jul 4, 2019, 8:20 PM Christian Conkle <email address hidden> wrote:

> The current stable release did not have this crash. I can test other builds
> if you point me at them. Is there a way to get ngspice to produce debug
> output?
>
> On Thu, Jul 4, 2019, 14:20 Adam Wolf <email address hidden> wrote:
>
> > Do these issues happen with 5.2 or other nightlies from before the
> > ngspice-30 change?
> >
> > On Thu, Jul 4, 2019, 1:25 PM Nick Østergaard <<email address hidden>
> >
> > wrote:
> >
> > > It is unclear to me if this is an issue with kicad, ngspice or the
> > > packaging. How can we narrow this down?
> > >
> > > ** Changed in: kicad
> > > Status: New => Confirmed
> > >
> > > --
> > > You received this bug notification because you are subscribed to the
> bug
> > > report.
> > > https://bugs.launchpad.net/bugs/1835296
> > >
> > > Title:
> > > simulating laser_driver on macos nightly causes segfault
> > >
> > > To manage notifications about this bug go to:
> > > https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
> > >
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1835296
> >
> > Title:
> > simulating laser_driver on macos nightly causes segfault
> >
> > Status in KiCad:
> > Confirmed
> >
> > Bug description:
> > Running the 20190703 nightly MacOS build (which I believe has the new
> > ngspice-30 library, although I don't know how to check), simulating
> > the laser_driver or sallen_key demo project causes a hard crash of the
> > entire KiCad application. In particular, pressing "Run/Stop
> > Simulation" causes a segmentation fault in libngspice.0.dylib. Stack
> > trace and version information below.
> >
> > The other two demo simulation projects (rectifier, pspice) do not
> > crash, and seem to give sensible simulation results.
> >
> > The most obvious difference between the crashing (laser_driver,
> > sallen_key) and working (rectifier, pspice) projects is that the
> > crashing projects include external spice model libraries (e.g.
> > ad8009.lib in laser_driver) and the working projects use only internal
> > models. My own projects seem to crash if they include external models,
> > but I haven't systematically tested.
> >
> > Please let me know if I can provide any additional information.
> >
> > Stack trace:
> >
> > Crashed Thread: 13
> >
> > Exception Type: EXC_BAD_ACCESS (SIGS...

Read more...

Nick Østergaard (nickoe) wrote :

Hi Adam

Don't you have the pull request builds running? I would rather have you keep ngspice 30 on master and do the revert to ngspice 28 on a separate branch and build-job and make sure it does not upload to the normal nightly location. Make it upload to osx/testing/patched/.

I don't think a lot of people have even tested these edge cases earlier on macos and it seems to only for the specific ngspice cases described in this bug.

Adam Wolf (adamwolf) wrote :

This seems backwards to me but I will defer to you. We have a
confirmation that this didn't happen before, and now it does since we
upgraded to ngspice 30. Folks can just use an older nightly or stable
if they need the working behavior, I guess?

On Fri, Jul 5, 2019 at 7:50 AM Nick Østergaard
<email address hidden> wrote:
>
> Hi Adam
>
> Don't you have the pull request builds running? I would rather have you
> keep ngspice 30 on master and do the revert to ngspice 28 on a separate
> branch and build-job and make sure it does not upload to the normal
> nightly location. Make it upload to osx/testing/patched/.
>
> I don't think a lot of people have even tested these edge cases earlier
> on macos and it seems to only for the specific ngspice cases described
> in this bug.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Christian Conkle (conklech) wrote :

Running either 5.1.2 release or 20190624 nightly, the laser_driver simulation runs fine. But on both builds I get a different error running sallen_key. The sallen_key error is apparently an unrelated issue, so I hesitate to derail this bug by posting details here, except to note that the error message indicates that it's running ngspice-26:

Error: ngspice.dll cannot recover and awaits to be detached
Note: can't find init file.
******
** ngspice-26 shared library
** Creation Date: Mon Jun 24 10:38:22 PDT 2019
******

Version information (same results for both):

Application: Eeschema
Version: (5.1.0-1094-g8a22963e9), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

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

Application: kicad
Version: (5.1.2-1)-1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

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

Adam Wolf (adamwolf) wrote :

Thanks! Wanna open a new bug for the sallen_key one?

On Fri, Jul 5, 2019 at 3:40 PM Christian Conkle <email address hidden> wrote:
>
> Running either 5.1.2 release or 20190624 nightly, the laser_driver
> simulation runs fine. But on both builds I get a different error running
> sallen_key. The sallen_key error is apparently an unrelated issue, so I
> hesitate to derail this bug by posting details here, except to note that
> the error message indicates that it's running ngspice-26:
>
> Error: ngspice.dll cannot recover and awaits to be detached
> Note: can't find init file.
> ******
> ** ngspice-26 shared library
> ** Creation Date: Mon Jun 24 10:38:22 PDT 2019
> ******
>
> Version information (same results for both):
>
> Application: Eeschema
> Version: (5.1.0-1094-g8a22963e9), debug build
> Libraries:
> wxWidgets 3.0.4
> libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
> Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
> Build Info:
> wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
> Boost: 1.69.0
> OpenCASCADE Community Edition: 6.9.1
> Curl: 7.54.0
> Compiler: Clang 9.0.0 with C++ ABI 1002
>
> Build settings:
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_PYTHON3=OFF
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
> KICAD_SCRIPTING_ACTION_MENU=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
>
> Application: kicad
> Version: (5.1.2-1)-1, release build
> Libraries:
> wxWidgets 3.0.4
> libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
> Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
> Build Info:
> wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
> Boost: 1.69.0
> OpenCASCADE Community Edition: 6.9.1
> Curl: 7.54.0
> Compiler: Clang 9.0.0 with C++ ABI 1002
>
> Build settings:
> USE_WX_GRAPHICS_CONTEXT=ON
> USE_WX_OVERLAY=ON
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_PYTHON3=OFF
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
> KICAD_SCRIPTING_ACTION_MENU=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Holger Vogt (h+vogt) wrote :

Testing for the ngspice version:

Add a text box to the eeschema circuit diagram containing

.control
version
.endc

Run the simulation.

Holger Vogt (h+vogt) wrote :

Where to find the build logs for ngspice dlll on macOS?

Adam Wolf (adamwolf) wrote :

Hi Holger,

They are in here:

https://builder.wayneandlayne.com/job/kicad-mac-builder-10.14-upload/261/consoleText

On Sat, Jul 6, 2019 at 3:25 AM Holger Vogt <email address hidden> wrote:
>
> Where to find the build logs for ngspice dlll on macOS?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Christian Conkle (conklech) wrote :

Adam,

I don't think there's a separate sallen_key problem; both laser_driver and sallen_key crash in the same way. (I hadn't noticed that yet when I initially wrote the bug report.)

Adam Wolf (adamwolf) wrote :

One bug is better than two :) Just so I make sure I'm understanding
right, the July 5th message is not correct?

On Mon, Jul 8, 2019 at 1:51 PM Christian Conkle <email address hidden> wrote:
>
> Adam,
>
> I don't think there's a separate sallen_key problem; both laser_driver
> and sallen_key crash in the same way. (I hadn't noticed that yet when I
> initially wrote the bug report.)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Christian Conkle (conklech) wrote :

Oh! THAT sallen_key crash. I had completely forgotten about my own July 5 message. Sorry for the confusion. I will open a second bug next time I'm at my Mac.

Holger Vogt (h+vogt) wrote :

The original post says that a seg fault ocurred in ngspice function MIFsetup.

0 libngspice.0.dylib 0x000000011a962c5d MIFsetup + 109

This function is responsible for setting up XSPICE models. These are used for example in polynomial voltage sources (the ones applying the POLY statement), often used by OpAmp models. OpAmps are used in the sallen-key and laser driver examples, but not with rectifier.

Unfortunately the crash info does not tell me where exactly the crash happened. There have been some changes to MIFsetup between ngspice-26 and ngspice-30, but they seem to be syntax changes, not functional changes. For example a macro has been used to hide some list processing.

Might it be possible to obtain a debugger output telling me which line in the mifsetup.c file is causing the crash? Obviously this does not happen with the Windows builds, and I haven't heard about complaints from the Linux community.

Holger Vogt (h+vogt) wrote :

However, posting #9 tells me that even with ngspice-26 there is a crash in sallen_key?!

Seth Hillbrand (sethh) wrote :

@devs- What do folks think about spinning an RPC program off while simulating? It would take the netlist in, run the simulation and return the results over a local port. Crashes in libngspice would prevent simulation but not take down KiCad and we could handle errors gracefully.

Wayne Stambaugh (stambaughw) wrote :

@Seth, I'm not opposed to this. Once you make the simulator a stand alone application, the expectation will be that you can open any spice netlist file not just one passed from Eeschema. It's one of those cases where I would question if the effort is worth it. In order to get stack traces, you would have to run the simulator from the debugger rather than KiCad. It may also complicated Tom's debug reporter work.

Seth Hillbrand (sethh) wrote :

@Wayne-

True. I suppose the alternative would be to just use the ngspice application as a server or in pipe mode.

Christian Conkle (conklech) wrote :

Separate bug opened for the ngspice-26 sallen_key crash: https://bugs.launchpad.net/kicad/+bug/1836104

I'd be more than happy to capture debugger output. If anybody happens to know how to do that on MacOS, let me know; otherwise it'll take me a little while for me to figure out how. (I'm not primarily a Mac user.)

Wayne Stambaugh (stambaughw) wrote :

@Seth, I would think getting debug information form ngspice running as a separate application or server would be even more problematic. @Tom, do you have any thoughts on this since the simulator is you code. You might want to check with Holger as well to determine the implications of doing this.

Adam Wolf (adamwolf) wrote :

When I get debugger output, I typically do it with CLion for macOS. I do
not know how to make the packaged applications make debugger output.

I unfortunately cannot devote any time this week to digging into this.
Does someone else with a debugger on macOS want to get Holger the
information he needs? I still kinda suspect it's macOS not actually
opening the file due to some sort of sandboxing, but that is a wild guess.

On Wed, Jul 10, 2019, 2:55 PM Wayne Stambaugh <email address hidden>
wrote:

> @Seth, I would think getting debug information form ngspice running as a
> separate application or server would be even more problematic. @Tom, do
> you have any thoughts on this since the simulator is you code. You
> might want to check with Holger as well to determine the implications of
> doing this.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Jeff Young (jeyjey) wrote :
Download full text (3.4 KiB)

I get the following when running the sallen_key demo (note that this is a development build, so it may be some packaging that's missing):

Circuit: KiCad schematic
Original line no.: 5, new internal line no.: 113:
Mismatch: 0 formal but 1 actual params.
Copies=121 Evals=120 Placeholders=0 Symbols=7 Errors=1
Numparam expansion errors: Problem with input file.
Error: ngspice.dll cannot recover and awaits to be detached
******
** ngspice-26 shared library
** Creation Date: Mon Jan 22 15:04:02 GMT 2018
******
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/ciderinit, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/ciderinit: file too short
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/ciderinit: file too short
Error: Library /Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/ciderinit couldn't be loaded!
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spinit, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spinit: file too short
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spinit: file too short
Error: Library /Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spinit couldn't be loaded!
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devaxis, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devaxis: file too short
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devaxis: file too short
Error: Library /Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devaxis couldn't be loaded!
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devload, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devload: file too short
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devload: file too short
Error: Library /Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/devload couldn't be loaded!
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spectrum, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spectrum: unknown file type, first eight bytes: 0x2A 0x20 0x46 0x6F 0x75 0x72 0x69 0x65
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spectrum: unknown file type, first eight bytes: 0x2A 0x20 0x46 0x6F 0x75 0x72 0x69 0x65
Error: Library /Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/spectrum couldn't be loaded!
dlopen(/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/setplot, 2): no suitable image found. Did find:
/Users/jeff/kicad_dev/kicad/bin/kicad.app/Contents/PlugIns/sim/ngspice/scripts/setplot: file too short
/U...

Read more...

Jeff Young (jeyjey) wrote :

The laser_driver demo runs fine for me.

Application: Eeschema
Version: (5.1.0-1246-g67573128a-dirty), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Platform: Mac OS X (Darwin 17.7.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.65.1
    Curl: 7.57.0
    Compiler: Clang 10.0.0 with C++ ABI 1002

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

Nick Østergaard (nickoe) wrote :

@Jeff, unfortunately our version info does not print the ngspice version info. What version do you use?

Adam Wolf (adamwolf) wrote :

Nick, it looks like version 26 from the output.

On Wed, Jul 10, 2019 at 6:11 PM Nick Østergaard
<email address hidden> wrote:
>
> @Jeff, unfortunately our version info does not print the ngspice version
> info. What version do you use?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Wayne Stambaugh (stambaughw) wrote :

@Holger, I am going to add the ngspice version to the KiCad build info so users wont have to look it up. The only place I can find the version string for ngspice is in the <ngspice/config.h> header file under the PACKAGE_VERSION definition. Is this correct for all versions of ngspice and is there any plan to change this in the future? I want to be sure I don't break builds with different versions of ngspice. Thanks in advance for the help.

Holger Vogt (h+vogt) wrote :

@Wyne,

yes, that's the source of the version info (if you are not compiling with MSVC). You may read it at compile time.

But what about users who upgrade their ngspice by just changing the dll?

If you send the command 'version' to ngspice, you will get back

******
** ngspice-30 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please get your ngspice manual from http://ngspice.sourceforge.net/docs.html
** Please file your bug-reports at http://ngspice.sourceforge.net/bugrep.html
** Creation Date: Thu Feb 21 08:59:50 UTC 2019
******

Well, you have to figure out the ngspice-XX string, but this may be a better way.

Holger Vogt (h+vogt) wrote :

@Wayne, excuse me for having misspelled your name

Wayne Stambaugh (stambaughw) wrote :

@Holger, no problem. Typos happen. I will take your advice and send a "version" command to get the version information for ngspice. Thanks for the tip.

Wayne Stambaugh (stambaughw) wrote :

@Holger, it doesn't look like I will be able to use the "version" command because ngspice is only build as part of the schematic editor and the about dialog is built in common so ngspice may not be available so I will have to use the static version defined in <ngspice/config.h>. My guess is that in most cases this will be the correct runtime version but obviously this may not always be the case.

Holger Vogt (h+vogt) wrote :

Before moving on here, please for whatever simulation run, add an additional textbox to the eeschema circuit diagram window, as described in https://bugs.launchpad.net/kicad/+bug/1835296/comments/11

Without the information on what ngspice you are running, thinking about debugging is difficult.

Holger Vogt (h+vogt) wrote :

This bug does not occur on OS Windows. Linux is to be tested (over the weekend).

The bug probably results from intruducing a call back function into the spice2poly code model for XSPICE (used in the OpAmp model with its POLY voltage source), done after ngspice-29, made to reduce a memory leak. I will have to dig a little more into details.

I would appreciate if someone with macOS and ngspice (plus code models) compiled in debug mode would give me some support.

Holger Vogt (h+vogt) wrote :

To be a little bit more precise:

I can provoke a crash bug similar to the one mentioned by Christian (at least somewhere around setting up XSPICE) on Windows OS (as described in my previous post) by running ngspice-26 with XSPICE code models made from ngspice-30 sources. If ngspice-30 is called with the ngspice-30 code models, it is o.k. under Windows OS. If ngspice-26 is called with modified code models by commenting out the Callback line ( ngspice\src\xspice\icm\spice2poly\icm_spice2poly\cfunc.mod, line 115), it is o.k. again.

I will check this on Linux as well, but I don't have access to a macOS machine.

Nick Østergaard (nickoe) wrote :

If you have something specific you tjink we should do for the mac packaging, could you raise an issue on https://github.com/KiCad/kicad-mac-builder/issues

This discussion is getting complicated for me to follow wit all those platform, kicad and ngspice versions.

Holger Vogt (h+vogt) wrote :

For me the same!

What I would like to suggest:

Revert commit
https://git.launchpad.net/kicad/commit/?h=5.1&id=216573bf4827e8ca98635e1b95efa0c02c94b53f
for KiCad 5.1.3

Package macOS with ngspice-26 for 5.1.3

Investigate why there is a seg fault on macOS when using 5.1.3 and ngspice-30 (help needed!)

Adam Wolf (adamwolf) wrote :

Alright. Can we get that commit reverted in kicad itself on the 5.1
branch, and then I'll set the mac package to build with 26 for the
upcoming release?

On Fri, Jul 19, 2019 at 3:15 AM Holger Vogt <email address hidden> wrote:
>
> For me the same!
>
> What I would like to suggest:
>
> Revert commit
> https://git.launchpad.net/kicad/commit/?h=5.1&id=216573bf4827e8ca98635e1b95efa0c02c94b53f
> for KiCad 5.1.3
>
> Package macOS with ngspice-26 for 5.1.3
>
> Investigate why there is a seg fault on macOS when using 5.1.3 and
> ngspice-30 (help needed!)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

I reverted this commit in 5.1 branch.

Changed in kicad:
status: Confirmed → Incomplete
Changed in kicad:
milestone: 6.0.0-rc1 → 5.1.5
status: Incomplete → Confirmed
31 comments hidden view all 111 comments
Adam Wolf (adamwolf) wrote :

Thanks Holger, I'll keep digging into this. I am still trying to
rally up folks and get the 10.15 "can't create new projects" problem
fixed :(

On Sun, Sep 29, 2019 at 9:10 AM Holger Vogt <email address hidden> wrote:
>
> I am using
>
> Application: Eeschema
> Version: (5.1.4-0-10_14), release build
> Libraries:
> wxWidgets 3.0.4
> libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
> Platform: Mac OS X (Darwin 18.7.0 x86_64), 64 bit, Little endian, wxMac
> Build Info:
> wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
> Boost: 1.69.0
> OpenCASCADE Community Edition: 6.9.1
> Curl: 7.54.0
> Compiler: Clang 9.0.0 with C++ ABI 1002
>
> Build settings:
> USE_WX_GRAPHICS_CONTEXT=ON
> USE_WX_OVERLAY=ON
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_PYTHON3=OFF
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
> KICAD_SCRIPTING_ACTION_MENU=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
>
> or recent testing nightly. Both libngspice-0.dylib of this distribution
> removed.
>
> Compiled my own ngspice shared lib libngspice.0.dylib from actual
> ngspice-31 distribution into /usr/local/lib
>
> Testing: Open new eeschema window, add text window with
>
> .op
> .control
> version
> .endc
>
> Run simulation with the result that ngspice-31 version info is shown.
>
> No crash with the release build, no crash with the nightly from testing,
> when simulating laser_driver or sallen_key.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Wayne Stambaugh (stambaughw) wrote :

So is this issue officially fixed in ngspice 31-2? If so, we should close this bug report so we are one bug report closer to getting 5.1.5 released.

Adam Wolf (adamwolf) wrote :

I don't think we can say that yet. Holger is compiling and packaging
ngspice differently, and when he does that, ngspice-30-2 works as well.

If it is entirely a packaging problem, I do not understand why the same
packaging works fine for ngspice-28 but not 30-2.

I can build and package KiCad with 31-2 today. Fingers crossed.

On Mon, Sep 30, 2019, 7:20 AM Wayne Stambaugh <email address hidden>
wrote:

> So is this issue officially fixed in ngspice 31-2? If so, we should
> close this bug report so we are one bug report closer to getting 5.1.5
> released.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Jonatan Liljedahl (kymatica) wrote :

Holger, have you tried running it without a system-wide ngspice installed?

I just tried installing the ngspice-30.pkg, which installs to /Applications/ngspice/ and now I get no crash! Running it inside lldb shows that it's using the code models from the system-wide ngspice instead of the bundled ones:

[355] 254C4F6B-F42A-3CD1-99D5-9AF1A61FEF0E 0x00000001226c2000 /Applications/KiCad/kicad.app/Contents/Frameworks/libngspice.0.dylib
[365] E7997DE7-F937-360E-B3C9-0F57E4DCFA0F 0x0000000119eed000 /Applications/ngspice/lib/ngspice/table.cm
[366] 4EEEFD30-725D-3B3F-91A8-D6E8BF12684D 0x00000001199f9000 /Applications/ngspice/lib/ngspice/spice2poly.cm
[367] 75C17E83-BBDA-3FE7-BDA4-353C984BCC17 0x00000001209ba000 /Applications/ngspice/lib/ngspice/digital.cm
[368] 94632E46-0EEF-3B23-BCA0-2EB35A65D09E 0x0000000119ef8000 /Applications/ngspice/lib/ngspice/xtraevt.cm
[369] 7F629F05-FBAF-396E-A268-31FE1D560A74 0x000000011a58c000 /Applications/ngspice/lib/ngspice/xtradev.cm
[370] 4CB2DA9D-4D59-3C85-B321-3955D0265959 0x00000001209d6000 /Applications/ngspice/lib/ngspice/analog.cm

If I rename /Applications/ngspice to /Applications/ngspice_old, it crashes. And looking at which images is loaded I get:

[355] 254C4F6B-F42A-3CD1-99D5-9AF1A61FEF0E 0x0000000122ede000 /Applications/KiCad/kicad.app/Contents/Frameworks/libngspice.0.dylib
[365] DDA71EBB-A729-3156-9362-147E658F217B 0x00000001216ef000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/table.cm
[366] 13913E9A-0D12-35A6-BFF5-C8E25824AEFA 0x00000001216fb000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/spice2poly.cm
[367] A98F2D9F-ADB3-330D-906D-C3A65D66C038 0x0000000121701000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/digital.cm
[368] BE45BBAA-4248-3F08-AFBC-47D343251D6E 0x0000000121dc0000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/xtraevt.cm
[369] 2DCF5524-0E84-3DC3-B50D-19A5279488F5 0x0000000121dc9000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/xtradev.cm
[370] 02193AF1-757E-374D-955B-1532737C34C7 0x0000000121dd9000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/analog.cm

And here comes the important part: If I manually replace the code models in /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/ with the ones that was installed from the ngspice-30.pkg, it works without crashes!

So my conclusion is that the MacOS packaging is breaking those files.

Adam Wolf (adamwolf) wrote :

Thanks folks. The packaging for those files looks like its just
./configure, make and make install but I'll keep looking.

On Mon, Sep 30, 2019 at 8:51 AM Jonatan Liljedahl
<email address hidden> wrote:
>
> Holger, have you tried running it without a system-wide ngspice
> installed?
>
> I just tried installing the ngspice-30.pkg, which installs to
> /Applications/ngspice/ and now I get no crash! Running it inside lldb
> shows that it's using the code models from the system-wide ngspice
> instead of the bundled ones:
>
> [355] 254C4F6B-F42A-3CD1-99D5-9AF1A61FEF0E 0x00000001226c2000 /Applications/KiCad/kicad.app/Contents/Frameworks/libngspice.0.dylib
> [365] E7997DE7-F937-360E-B3C9-0F57E4DCFA0F 0x0000000119eed000 /Applications/ngspice/lib/ngspice/table.cm
> [366] 4EEEFD30-725D-3B3F-91A8-D6E8BF12684D 0x00000001199f9000 /Applications/ngspice/lib/ngspice/spice2poly.cm
> [367] 75C17E83-BBDA-3FE7-BDA4-353C984BCC17 0x00000001209ba000 /Applications/ngspice/lib/ngspice/digital.cm
> [368] 94632E46-0EEF-3B23-BCA0-2EB35A65D09E 0x0000000119ef8000 /Applications/ngspice/lib/ngspice/xtraevt.cm
> [369] 7F629F05-FBAF-396E-A268-31FE1D560A74 0x000000011a58c000 /Applications/ngspice/lib/ngspice/xtradev.cm
> [370] 4CB2DA9D-4D59-3C85-B321-3955D0265959 0x00000001209d6000 /Applications/ngspice/lib/ngspice/analog.cm
>
> If I rename /Applications/ngspice to /Applications/ngspice_old, it
> crashes. And looking at which images is loaded I get:
>
> [355] 254C4F6B-F42A-3CD1-99D5-9AF1A61FEF0E 0x0000000122ede000 /Applications/KiCad/kicad.app/Contents/Frameworks/libngspice.0.dylib
> [365] DDA71EBB-A729-3156-9362-147E658F217B 0x00000001216ef000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/table.cm
> [366] 13913E9A-0D12-35A6-BFF5-C8E25824AEFA 0x00000001216fb000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/spice2poly.cm
> [367] A98F2D9F-ADB3-330D-906D-C3A65D66C038 0x0000000121701000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/digital.cm
> [368] BE45BBAA-4248-3F08-AFBC-47D343251D6E 0x0000000121dc0000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/xtraevt.cm
> [369] 2DCF5524-0E84-3DC3-B50D-19A5279488F5 0x0000000121dc9000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/xtradev.cm
> [370] 02193AF1-757E-374D-955B-1532737C34C7 0x0000000121dd9000 /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/analog.cm
>
> And here comes the important part: If I manually replace the code models
> in /Applications/KiCad/kicad.app/Contents/PlugIns/sim/ngspice/ with the
> ones that was installed from the ngspice-30.pkg, it works without
> crashes!
>
> So my conclusion is that the MacOS packaging is breaking those files.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Adam Wolf (adamwolf) wrote :

Holger, is there any description of how the .pkg files are built for release?

Adam Wolf (adamwolf) wrote :

It still happens with ngspice-31, Wayne, so I've got more debugging to do.

All kicad-mac-builder does is:

include(ExternalProject)

ExternalProject_Add(
        ngspice
        PREFIX ngspice
        GIT_REPOSITORY git://git.code.sf.net/p/ngspice/ngspice
        GIT_TAG ngspice-31-2
        UPDATE_COMMAND ""
        PATCH_COMMAND ""
        CONFIGURE_COMMAND ./autogen.sh
        COMMAND ./configure --with-ngshared --enable-xspice --enable-cider --prefix=${ngspice_INSTALL_DIR} --enable-debug=yes
        BUILD_COMMAND ${MAKE}
        BUILD_IN_SOURCE 1
        INSTALL_COMMAND make install
)

and then we fixup the libngspice library like we do every other library (and like we did on ngspice-28 which worked fine). We do nothing special to the code models.

We had debug disabled, but only recently turned it on per requests in this ticket.

I will try Holger's CFLAGS and LDFLAGs next.

Adam Wolf (adamwolf) wrote :

Holger's build script says you *have* to make clean to properly build the codemodels. Let me try that.

Holger Vogt (h+vogt) wrote :

In between ngspice-26 and ngspice-27 there has been a change in the codemodel interface that retains the ngspice-26 code models incompatible. Could it have happened that the code models of the new KiCad builds were not remade and still were version 26 (therefore the 'make clean' for the code models)?

Holger Vogt (h+vogt) wrote :

Concerning the pkg files for ngspice: Francesco Lannutti is making these for me (My MAC is just two weeks old). I have to ask him.

Adam Wolf (adamwolf) wrote :

All mac releases, nightly or full, are created in a new VM. It then
installs all the dependencies, downloads all the source code, and
builds everything. Then it copies the release artifacts and build log
out, and then deletes itself. (This is a long way of saying there's
no chance that ngspice-26 code models are being reused :) )

On Mon, Sep 30, 2019 at 11:15 AM Holger Vogt <email address hidden> wrote:
>
> In between ngspice-26 and ngspice-27 there has been a change in the
> codemodel interface that retains the ngspice-26 code models
> incompatible. Could it have happened that the code models of the new
> KiCad builds were not remade and still were version 26 (therefore the
> 'make clean' for the code models)?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Adam Wolf (adamwolf) wrote :

Thanks! It would be good to find out how they're made. I have a
variety of experimental builds running right now. I think we'll get
this soon.

On Mon, Sep 30, 2019 at 11:15 AM Holger Vogt <email address hidden> wrote:
>
> Concerning the pkg files for ngspice: Francesco Lannutti is making these
> for me (My MAC is just two weeks old). I have to ask him.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Adam Wolf (adamwolf) wrote :

I have a big matrix of builds running, with a variety of parameters
and source versions. I have found some work fine, so now to let the
rest of them build and see if we can come to a conclusion.

On Mon, Sep 30, 2019 at 12:26 PM Adam Wolf
<email address hidden> wrote:
>
> Thanks! It would be good to find out how they're made. I have a
> variety of experimental builds running right now. I think we'll get
> this soon.
>
>
> On Mon, Sep 30, 2019 at 11:15 AM Holger Vogt <email address hidden> wrote:
> >
> > Concerning the pkg files for ngspice: Francesco Lannutti is making these
> > for me (My MAC is just two weeks old). I have to ask him.
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1835296
> >
> > Title:
> > simulating laser_driver on macos nightly causes segfault
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Changed in kicad:
status: Confirmed → Fix Committed
status: Fix Committed → Confirmed
Adam Wolf (adamwolf) wrote :

Hi folks!

Can people try builds from 2019-10-01 or 2019-10-02 from https://kicad-downloads.s3.cern.ch/index.html?prefix=osx/nightly/? With these, I can simulate both laser driver and sallen key. Please note that if you have ngspice installed on your Mac, you probably won't reproduce the bug reported here regardless of which build you test with.

Please report back.

Holger Vogt (h+vogt) wrote :

Finally I have got a test setup:
Delete all occurrences of libngspice dylib and code models (analog.cm etc) in /usr and elsewhere except in KiCad installations. Delete installed Ngspice.
Restart the computer (seems to be important, there is some "memory effect").

Now I have KiCad 5.1.4 (most recent release build) and recent KiCad 5.9.9 (your suggestion from above) installed in parallel.

Starting 5.1.4 from eeschema: simulation of Sallen_Key o.k..
Staring 5.1.4 via KiCad app: crash as reported in this thread

Starting 5.9.9 via eeschema: simulation not o.k., code models (spice2poly.cm) are not found
Starting 5.9.9 via KiCad: simulation o.k. for Laser Driver and Sallen_Key!!

Jonatan Liljedahl (kymatica) wrote :

I tried 2019-10-02 from https://kicad-downloads.s3.cern.ch/index.html?prefix=osx/nightly/ and it works fine for me! Will this be fixed also for the 5.1 branch?

Jonatan Liljedahl (kymatica) wrote :

BTW, it only works if KiCad is installed in /Applications/KiCad/, otherwise it can't find the code model files. Is this search path a compile time constant, or could it instead look in the actual running app bundle? A user might install it in ~/Applications/KiCad/ instead, or /Applications/KiCad_testing etc..

Adam Wolf (adamwolf) wrote :

Hi Jonatan,

That search path is not complied into ngspice at all. It works for me both
inside and outside of Applications, and renamed. I do not have ngspice
installed anywhere on my computer, and those downloaded installs work for
me where ever I place them. I did not test as standalone or not, but I
will test that as well.

Adam

On Thu, Oct 3, 2019, 5:01 AM Jonatan Liljedahl <email address hidden>
wrote:

> BTW, it only works if KiCad is installed in /Applications/KiCad/,
> otherwise it can't find the code model files. Is this search path a
> compile time constant, or could it instead look in the actual running
> app bundle? A user might install it in ~/Applications/KiCad/ instead, or
> /Applications/KiCad_testing etc..
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Holger Vogt (h+vogt) wrote :

Eeschema is sending commands 'code model ...' to Ngspice one by one to load all code models. One has to look into the eeschema sources to find out what path is used.

Ian McInerney (imcinerney) wrote :

There are some hardcoded code model paths in the ngspice.cpp file (see NGSPICE::findCmPath on line 438) that it will search through. These seem to be the paths it will look at to find spice2poly.cm (if that file exists, it says it found the code model paths).
    const vector<string> cmPaths =
    {
#ifdef __WXMAC__
        "/Applications/ngspice/lib/ngspice",
        "Contents/Frameworks",
        wxStandardPaths::Get().GetPluginsDir() + "/sim/ngspice",
        wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice"
#endif /* __WXMAC__ */
        "../lib/ngspice",
        "../../lib/ngspice"
        "lib/ngspice",
        "ngspice"
    };

From my reading of the code, you can override these paths by specifying a spiceinit file that lives on one of the (relative) searched paths:
    const vector<string> spiceinitPaths =
    {
        ".",
#ifdef __WXMAC__
        stdPaths.GetPluginsDir() + "/sim/ngspice/scripts",
        wxFileName( stdPaths.GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice/scripts"
#endif /* __WXMAC__ */
        "../share/kicad",
        "../share",
        "../../share/kicad",
        "../../share"
    };

Eeschema will send the code model commands if it didn't find a spiceinit file and if it was able to find the code model path.

1 comments hidden view all 111 comments
Adam Wolf (adamwolf) wrote :

Hi folks,

It works for me on those october builds in both standalone eeschema
and in regular kicad, in Applications and outside of Applications.
Please confirm that you are not starting eeschema before opening kicad
one time. It is required that kicad be opened one time before
starting eeschema, due to some macOS technicalities.

I am no longer seeing this issue.

If I build ngspice31-2 with --enable-debug=yes, then the issue comes
back. ngspice 28 works with both debug enabled and disabled, but 31-2
does not. I have switched nightlies to use 31-2 to --disable-debug,
and that's what is in the October nightly builds. Holger--when you
hear from the mac package for ngspice, that would be awesome. I would
love to compile with the same flags as they do for increased
compatibility reasons.

I appreciate everyone's patience around this issue. I have other very
pressing issues with macOS packaging that also need my attention, but
I'm giving most of my attention to this ticket since it is the loudest
:)

Holger Vogt (h+vogt) wrote :

Small correction: The commands sent by eeschema, to be executed by Ngspice are:

codemodel <path>/analog.cm
codemodel <path>/spice2poly.cm
...

<path> may be absolute or relative. If relative, the question might be: Relative to what reference?

1 comments hidden view all 111 comments
Adam Wolf (adamwolf) wrote :

It is possible that we need to investigate NGSPICE::findCmPath() in
https://github.com/KiCad/kicad-source-mirror/blob/e5463b545514ddfc849c6985e8884d1dec5edd3b/eeschema/sim/ngspice.cpp.

On Thu, Oct 3, 2019 at 10:05 AM Adam Wolf <email address hidden> wrote:
>
> Hi folks,
>
> It works for me on those october builds in both standalone eeschema
> and in regular kicad, in Applications and outside of Applications.
> Please confirm that you are not starting eeschema before opening kicad
> one time. It is required that kicad be opened one time before
> starting eeschema, due to some macOS technicalities.
>
> I am no longer seeing this issue.
>
> If I build ngspice31-2 with --enable-debug=yes, then the issue comes
> back. ngspice 28 works with both debug enabled and disabled, but 31-2
> does not. I have switched nightlies to use 31-2 to --disable-debug,
> and that's what is in the October nightly builds. Holger--when you
> hear from the mac package for ngspice, that would be awesome. I would
> love to compile with the same flags as they do for increased
> compatibility reasons.
>
> I appreciate everyone's patience around this issue. I have other very
> pressing issues with macOS packaging that also need my attention, but
> I'm giving most of my attention to this ticket since it is the loudest
> :)

Jonatan Liljedahl (kymatica) wrote :

> That search path is not complied into ngspice at all. It works for me both
> inside and outside of Applications, and renamed. I do not have ngspice
> installed anywhere on my computer, and those downloaded installs work for
> me where ever I place them. I did not test as standalone or not, but I
> will test that as well.

This is weird. I tried again running kicad.app from
"/Applications/KiCad 5.99/" and now it worked as expected. I'm 99%
sure I did exactly as before. Maybe some other random bug, or some OS
caching mystery?

--
/Jonatan
http://kymatica.com

Jonatan Liljedahl (kymatica) wrote :

> > That search path is not complied into ngspice at all. It works for me both
> > inside and outside of Applications, and renamed. I do not have ngspice
> > installed anywhere on my computer, and those downloaded installs work for
> > me where ever I place them. I did not test as standalone or not, but I
> > will test that as well.
>
> This is weird. I tried again running kicad.app from
> "/Applications/KiCad 5.99/" and now it worked as expected. I'm 99%
> sure I did exactly as before. Maybe some other random bug, or some OS
> caching mystery?

Update: now I see the difference. When running via lldb:

lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
lijon-mbp:KiCad 5.99 lijon$ lldb kicad.app
(lldb) target create "kicad.app"
Current executable set to 'kicad.app' (x86_64).
(lldb) run

It does not find the cm files:

Error on line 0 :
a$poly$e.xu1.x1.egnd %vd [ +12v 0 -12v 0 ] %vd ( xu1.x1.99 0 )
a$poly$e.xu1.x1.egnd
MIF-ERROR - unable to find definition of model a$poly$e.xu1.x1.egnd
Warning: Model issue on line 0 :
.model a$poly$e.xu1.x1.egnd spice2poly coef = [ 0 .5 .5 ] ...
Unknown model type spice2poly - ignored
...

Running it like this from the commandline works though:

lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
lijon-mbp:KiCad 5.99 lijon$ open kicad.app

But not like this (can't find cm files):

lijon-mbp:KiCad 5.99 lijon$ cd kicad.app
lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad

Unless I rename the folder to "KiCad" only, then it works:

lijon-mbp:Applications lijon$ cd KiCad
lijon-mbp:KiCad lijon$ cd kicad.app/
lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad

So, there's definitely some room for improvement here.

--
/Jonatan
http://kymatica.com

Adam Wolf (adamwolf) wrote :

Can you try running kicad and eeschema by clicking on the icon? :D I
have tried the October nightlies on multiple computers and do not have
issues with ngspice and sallen_key or laser_driver on any of those.
If that works fine for you, I'm going to close this ticket.

If you want to reopen a new one for opening kicad from the command
line from different locations on macos, that's a new ticket. It is
unclear to me from your transcript what you're doing or what's going
on, so maybe add a little more explanation.

On Thu, Oct 3, 2019 at 1:06 PM Jonatan Liljedahl
<email address hidden> wrote:
>
> > > That search path is not complied into ngspice at all. It works for me both
> > > inside and outside of Applications, and renamed. I do not have ngspice
> > > installed anywhere on my computer, and those downloaded installs work for
> > > me where ever I place them. I did not test as standalone or not, but I
> > > will test that as well.
> >
> > This is weird. I tried again running kicad.app from
> > "/Applications/KiCad 5.99/" and now it worked as expected. I'm 99%
> > sure I did exactly as before. Maybe some other random bug, or some OS
> > caching mystery?
>
> Update: now I see the difference. When running via lldb:
>
> lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
> lijon-mbp:KiCad 5.99 lijon$ lldb kicad.app
> (lldb) target create "kicad.app"
> Current executable set to 'kicad.app' (x86_64).
> (lldb) run
>
> It does not find the cm files:
>
> Error on line 0 :
> a$poly$e.xu1.x1.egnd %vd [ +12v 0 -12v 0 ] %vd ( xu1.x1.99 0 )
> a$poly$e.xu1.x1.egnd
> MIF-ERROR - unable to find definition of model a$poly$e.xu1.x1.egnd
> Warning: Model issue on line 0 :
> .model a$poly$e.xu1.x1.egnd spice2poly coef = [ 0 .5 .5 ] ...
> Unknown model type spice2poly - ignored
> ...
>
> Running it like this from the commandline works though:
>
> lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
> lijon-mbp:KiCad 5.99 lijon$ open kicad.app
>
> But not like this (can't find cm files):
>
> lijon-mbp:KiCad 5.99 lijon$ cd kicad.app
> lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad
>
> Unless I rename the folder to "KiCad" only, then it works:
>
> lijon-mbp:Applications lijon$ cd KiCad
> lijon-mbp:KiCad lijon$ cd kicad.app/
> lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad
>
> So, there's definitely some room for improvement here.
>
> --
> /Jonatan
> http://kymatica.com
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Holger Vogt (h+vogt) wrote :

When run from KiCad in my setup (double click onto KiCad/kicad.app alias), code model spice2poly.cm is found, simulation is o.k..

When run from Eeschema in my setup (double click onto KiCad/eeschema.app alias), code model spice2poly.cm is not found.

May I suggest that we add another search path "../Plugins/sim/ngspice" to eeschema/sim/ngspice.cpp, line 447:

#ifdef __WXMAC__
        "/Applications/ngspice/lib/ngspice",
        "Contents/Frameworks",
        wxStandardPaths::Get().GetPluginsDir() + "/sim/ngspice",
        wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice"
        "../Plugins/sim/ngspice"
#endif /* __WXMAC__ */

This will search for the code model relative to KiCad/kicad.app/contents/Applications/eeschema.app

Btw: I can do this from within Ngspice by adding a text window with

.control
pre_codemodel ../Plugins/sim/ngspice/spice2poly.cm
.endc

to the eeschema circuit diagram. A ngspice command may be preceded by pre_ . Then it is run before the circuit is parsed. The code model is loaded, then the circuit is loaded into the matrix and the simulation runs successfully.

Application: Eeschema
Version: (5.99.0-192-g5933ac3b9), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.7.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    Build date: Oct 2 2019 10:19:28
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

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

Adam Wolf (adamwolf) wrote :

Yeah, I can submit the patch to KiCad tonight!

Thanks Holger!

On Thu, Oct 3, 2019, 4:41 PM Holger Vogt <email address hidden> wrote:

> When run from KiCad in my setup (double click onto KiCad/kicad.app
> alias), code model spice2poly.cm is found, simulation is o.k..
>
> When run from Eeschema in my setup (double click onto KiCad/eeschema.app
> alias), code model spice2poly.cm is not found.
>
> May I suggest that we add another search path "../Plugins/sim/ngspice"
> to eeschema/sim/ngspice.cpp, line 447:
>
> #ifdef __WXMAC__
> "/Applications/ngspice/lib/ngspice",
> "Contents/Frameworks",
> wxStandardPaths::Get().GetPluginsDir() + "/sim/ngspice",
> wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath()
> + "/../../../../../Contents/PlugIns/sim/ngspice"
> "../Plugins/sim/ngspice"
> #endif /* __WXMAC__ */
>
> This will search for the code model relative to
> KiCad/kicad.app/contents/Applications/eeschema.app
>
> Btw: I can do this from within Ngspice by adding a text window with
>
> .control
> pre_codemodel ../Plugins/sim/ngspice/spice2poly.cm
> .endc
>
> to the eeschema circuit diagram. A ngspice command may be preceded by
> pre_ . Then it is run before the circuit is parsed. The code model is
> loaded, then the circuit is loaded into the matrix and the simulation
> runs successfully.
>
> Application: Eeschema
> Version: (5.99.0-192-g5933ac3b9), debug build
> Libraries:
> wxWidgets 3.0.4
> libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
> Platform: Mac OS X (Darwin 18.7.0 x86_64), 64 bit, Little endian, wxMac
> Build Info:
> Build date: Oct 2 2019 10:19:28
> wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
> Boost: 1.69.0
> OpenCASCADE Community Edition: 6.9.1
> Curl: 7.54.0
> Compiler: Clang 9.0.0 with C++ ABI 1002
>
> Build settings:
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_PYTHON3=OFF
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
> KICAD_SCRIPTING_ACTION_MENU=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
> KICAD_STDLIB_DEBUG=OFF
> KICAD_STDLIB_LIGHT_DEBUG=OFF
> KICAD_SANITIZE=OFF
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Adam Wolf (adamwolf) wrote :

Is anyone else having email troubles on this ticket? I just got one of
Jonatan's messages a few minutes ago, this evening, even though I see
it was quoted in later responses that I got hours ago!

On Thu, Oct 3, 2019 at 1:46 PM Adam Wolf <email address hidden> wrote:
>
> Can you try running kicad and eeschema by clicking on the icon? :D I
> have tried the October nightlies on multiple computers and do not have
> issues with ngspice and sallen_key or laser_driver on any of those.
> If that works fine for you, I'm going to close this ticket.
>
> If you want to reopen a new one for opening kicad from the command
> line from different locations on macos, that's a new ticket. It is
> unclear to me from your transcript what you're doing or what's going
> on, so maybe add a little more explanation.
>
> On Thu, Oct 3, 2019 at 1:06 PM Jonatan Liljedahl
> <email address hidden> wrote:
> >
> > > > That search path is not complied into ngspice at all. It works for me both
> > > > inside and outside of Applications, and renamed. I do not have ngspice
> > > > installed anywhere on my computer, and those downloaded installs work for
> > > > me where ever I place them. I did not test as standalone or not, but I
> > > > will test that as well.
> > >
> > > This is weird. I tried again running kicad.app from
> > > "/Applications/KiCad 5.99/" and now it worked as expected. I'm 99%
> > > sure I did exactly as before. Maybe some other random bug, or some OS
> > > caching mystery?
> >
> > Update: now I see the difference. When running via lldb:
> >
> > lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
> > lijon-mbp:KiCad 5.99 lijon$ lldb kicad.app
> > (lldb) target create "kicad.app"
> > Current executable set to 'kicad.app' (x86_64).
> > (lldb) run
> >
> > It does not find the cm files:
> >
> > Error on line 0 :
> > a$poly$e.xu1.x1.egnd %vd [ +12v 0 -12v 0 ] %vd ( xu1.x1.99 0 )
> > a$poly$e.xu1.x1.egnd
> > MIF-ERROR - unable to find definition of model a$poly$e.xu1.x1.egnd
> > Warning: Model issue on line 0 :
> > .model a$poly$e.xu1.x1.egnd spice2poly coef = [ 0 .5 .5 ] ...
> > Unknown model type spice2poly - ignored
> > ...
> >
> > Running it like this from the commandline works though:
> >
> > lijon-mbp:Applications lijon$ cd KiCad\ 5.99/
> > lijon-mbp:KiCad 5.99 lijon$ open kicad.app
> >
> > But not like this (can't find cm files):
> >
> > lijon-mbp:KiCad 5.99 lijon$ cd kicad.app
> > lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad
> >
> > Unless I rename the folder to "KiCad" only, then it works:
> >
> > lijon-mbp:Applications lijon$ cd KiCad
> > lijon-mbp:KiCad lijon$ cd kicad.app/
> > lijon-mbp:kicad.app lijon$ Contents/MacOS/kicad
> >
> > So, there's definitely some room for improvement here.
> >
> > --
> > /Jonatan
> > http://kymatica.com
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1835296
> >
> > Title:
> > simulating laser_driver on macos nightly causes segfault
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Wayne Stambaugh (stambaughw) wrote :

@Adam, I occasionally see this. It's just one of the quirks of Launchpad I've learned to accept.

Adam Wolf (adamwolf) wrote :

No problem! I was worried I was just getting old!

On Fri, Oct 4, 2019, 12:51 PM Wayne Stambaugh <email address hidden>
wrote:

> @Adam, I occasionally see this. It's just one of the quirks of
> Launchpad I've learned to accept.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Holger Vogt (h+vogt) wrote :

I have the fear that we are curing symptoms, but not yet have found the root cause.

Yesterday I have got a new crash with similar cause, after compiling with debug symbols. All we have seen here is always about the initialization of the device count number that ngspice uses, and only when we add the XSPICE devices like spice2poly.

This device count number gets inconsistent, and thus may create a buffer overflow, when trying to read the device parameters. Yesterday's crash occured occured early in the ngspice initialization routine because the device number had already been set (that typically is done later during the initialization).

What may be the reason?
- Calling ngspice initialization twice (currently ngspice does not safeguard against this request)
- Loading the codemodels before initialization
- ... ?

And there has been a change in the ngspice code for creating this number (in between ngspice-26 and ngspice-27 releases). It used to be hard-wired before, now it is evaluated dynamically (ngspice/src/spicelib/devices/dev.c), thus taking into account various (seldom used) compile options concerning device selections. And therefore it has become sensitive to double initialization ...

Unfortunately the crashes are not easily to reproduce because of some macOS internal states. When I manage to achive that, I will look into this (I am not a fan of command line debuggers like lldb). It the should be easily possible to safeguard against double initialization in ngspice. There is code in eeschma ngspice.cpp to prevent double initialization, but what if this is called from a different thread? And why do we need libngspice-0.dylib twice in the distribution?

Holger Vogt (h+vogt) wrote :

There is a patch on ngspice master branch that prevents false initialization.

All my tests on macOS seem to be o.k. (see my careful wording!).

Could you make the next nightly with this ngspice version?

Adam Wolf (adamwolf) wrote :

I hear what you are saying, Holger.

I propose I switch the nightlies to this new patch, and then I am going to
pause working on this for a few days so I can work on some other macOS
bundling changes, at least one of which will probably affect this issue.

I think we are in a better state than before.

Many of the weirdnesses of the KiCad Mac bundle are because of the symlinks
in the bundle. I am going to be removing them very soon, and it is
possible that it will change some of the underlying behavior (for the
better, is my guess).

On Sat, Oct 5, 2019, 6:35 AM Holger Vogt <email address hidden> wrote:

> There is a patch on ngspice master branch that prevents false
> initialization.
>
> All my tests on macOS seem to be o.k. (see my careful wording!).
>
> Could you make the next nightly with this ngspice version?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Holger Vogt (h+vogt) wrote :

I have made a new bug-fix release tagged ngspice-31.3, based on current mngspice master branch, including the fixes mentioned above.

Changed in kicad:
milestone: 5.1.5 → 5.1.6
Ian McInerney (imcinerney) wrote :

What is the status of this?

Adam Wolf (adamwolf) wrote :

We haven't had any reports of this happening since I updated to the
master branch of ngspice. I'm going to tie it to tag ngspice-31.3
right now.

I think this can be closed, AFAICT.

On Sun, Nov 10, 2019 at 7:15 PM Ian McInerney <email address hidden> wrote:
>
> What is the status of this?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions

Nick Østergaard (nickoe) wrote :

@Adam, does this apply for the script you use you build 5.1.5? Maybe we should re-target the milestone if so.

Adam Wolf (adamwolf) wrote :

I think we should apply this to 5.1.5.

On Thu, Nov 14, 2019, 3:31 PM Nick Østergaard <email address hidden>
wrote:

> @Adam, does this apply for the script you use you build 5.1.5? Maybe we
> should re-target the milestone if so.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1835296
>
> Title:
> simulating laser_driver on macos nightly causes segfault
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1835296/+subscriptions
>

Nick Østergaard (nickoe) wrote :

Ok, it seems I can't select the milestone as it is closed. Lets jut call it fix comitted then.

Changed in kicad:
status: Confirmed → Fix Committed
Displaying first 40 and last 40 comments. View all 111 comments or add a comment.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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