msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.25k stars 1.21k forks source link

Kicad does not find ngspice shared library #19629

Closed Kreijstal closed 8 months ago

Kreijstal commented 8 months ago

Description / Steps to reproduce the issue

install ngspice and kicad with pacman or pacboy. Open kicad, create new project. Put some spice elements in schematic view. 3-2024-01-05_145924.zip Try to use simulation, kicad will not find the ngspice shared library

image

Expected behavior

Simulation should work, or it should find ngspice shared library

Actual behavior

Simulation library is not found

Verification

Windows Version

MINGW64_NT-6.3-9600

MINGW environments affected

Are you willing to submit a PR?

I don't know what the problem is

Biswa96 commented 8 months ago

Open kicad, create new project. Put some spice elements in schematic view.

Please explain those steps and how the attached file is used after those steps.

Kreijstal commented 8 months ago

Open kicad, create new project. Put some spice elements in schematic view.

Please explain those steps and how the attached file is used after those steps.

it is an example file of me creating some components

Biswa96 commented 8 months ago

Do you mean to open the project/directory in kicad after extracting the zip file?

Kreijstal commented 8 months ago

I think the zip file is a misunderstanding, it is just an example in case tester was too lazy to create anything in schematics interface, it is unrelated to the bug, just click on image

and you receive an error, when kicad is installed through pacman, steps are

tried with a recent installation of msys2 on another computer running windows 10, I can reproduce this on 2 machines now

Kreijstal commented 8 months ago

I installed kicad through scoop, to see what is wrong..

image

scoop's kicad provides ngspice.dll which msys does not seem to provide.

The kicad installed from scoop does not suffer from this problem, it can open the simulator without problems

Kreijstal commented 8 months ago

okay, so I did something weird, I copy this ngspice.dll into /mingw64/bin directory, and it did not error anymore, but it crashed with a segfault, so... there is something going on. :)

Kreijstal commented 8 months ago

There is ngspice documentation about ngspice.dll

Okay, I copied libngspice0.dll into ngspice.dll, and it worked!

Biswa96 commented 8 months ago

Thanks for the info. I can reproduce the issue in my setup. kicad is probably loading ngspice shared library with LoadLibrary and can not find it.

eeschema/sim/ngspice.cpp:        m_dll.Load( wxDynamicLibrary::CanonicalizeName( "ngspice" ) );
Kreijstal commented 8 months ago

I guess I would see what is the most common naming notation, and either make a copy of ngspice.dll for kicad or patch kicad so it looks for either libngspice0.dll or ngspice.dll or upstream?

MehdiChinoune commented 8 months ago

https://gitlab.com/kicad/code/kicad/-/blob/7.0.10/cmake/Findngspice.cmake?ref_type=tags#L105 Is valid only when using MSYS Makefiles, probably should changed to if (MINGW). https://gitlab.com/kicad/code/kicad/-/blob/7.0.10/eeschema/CMakeLists.txt#L19

Kreijstal commented 8 months ago

I guess it is a problem wit wxWidgets name resolution?

Biswa96 commented 8 months ago

I guess it is a problem wit wxWidgets name resolution?

Yeah, something like that. The DLL name is set by the CMake file. MehdiChinoune's suggestion may solve the issue.

MehdiChinoune commented 8 months ago

@Kreijstal I have pushed an update for kicad to 7.0.10, It includes a fix for your issue. Could update it from staging repo https://packages.msys2.org/queue and confirm.

Biswa96 commented 8 months ago

I have downloaded the kicad 7.0.10 package from staging and verified that 02cf7e7dc77ca15758ec83e6e7ea3fc4672995a8 commit fixes the kicad issue. Thank you.

Biswa96 commented 8 months ago

The new kicad package has been added in pacman repository. Please update the packages with pacman -Syu command.

Kreijstal commented 8 months ago

@Kreijstal I have pushed an update for kicad to 7.0.10, It includes a fix for your issue. Could update it from staging repo https://packages.msys2.org/queue and confirm.

Yeah it fixed it thank you