kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #25553
Testing Tom’s integrated ngspice simulator on Mac OSX
Hi,
today, I was trying to get Tom’s ngspice branch to compile on OSX, but unfortunately without success.
Here is what I did so far:
diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp
index 0c365c1..62679d5 100644
--- a/eeschema/sim/ngspice.cpp
+++ b/eeschema/sim/ngspice.cpp
@@ -37,6 +37,8 @@ NGSPICE::NGSPICE()
{
#ifdef __WINDOWS__
m_dll = new wxDynamicLibrary( "libngspice-0.dll" );
+#elif __APPLE__
+ m_dll = new wxDynamicLibrary( "libngspice.dylib" );
#else
m_dll = new wxDynamicLibrary( "libngspice.so" );
#endif
diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp
index 7dda993..1226da8 100644
--- a/eeschema/sim/sim_plot_panel.cpp
+++ b/eeschema/sim/sim_plot_panel.cpp
@@ -332,8 +332,8 @@ bool CURSOR::Inside( wxPoint& aPoint )
if( !m_window )
return false;
- return ( std::abs( aPoint.x - m_window->x2p( m_trace->x2s( m_coords.x ) ) ) <= DRAG_MARGIN )
- || ( std::abs( aPoint.y - m_window->y2p( m_trace->y2s( m_coords.y ) ) ) <= DRAG_MARGIN );
+ return ( std::abs((double) aPoint.x - m_window->x2p( m_trace->x2s( m_coords.x ) ) ) <= DRAG_MARGIN )
+ || ( std::abs((double) aPoint.y - m_window->y2p( m_trace->y2s( m_coords.y ) ) ) <= DRAG_MARGIN );
}
The change in eeschema/sim/ngspice.cpp was done in order to reflect the .dylib extension for dynamic libraries on OSX.
The change in eeschema/sim/sim_plot_panel.cpp was done as clang++ was complaining about ambiguous calls to `std::abs` in those two lines. Casting aPoint.{x,y} to double resolved the ambiguity.
But now, linking _eeschema.kiface fails with the following error:
[…]
[ 53%] Linking CXX shared module ../kicad/kicad.app/Contents/PlugIns/_eeschema.kiface
Undefined symbols for architecture x86_64:
"SCH_EDIT_FRAME::CURSOR_TUNE", referenced from:
SCH_EDIT_FRAME::OnSelectTool(wxCommandEvent&) in schedit.cpp.o
"SCH_EDIT_FRAME::CURSOR_PROBE", referenced from:
SCH_EDIT_FRAME::OnSelectTool(wxCommandEvent&) in schedit.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [kicad/kicad.app/Contents/PlugIns/_eeschema.kiface] Error 1
make[1]: *** [eeschema/CMakeFiles/eeschema_kiface.dir/all] Error 2
make: *** [all] Error 2
My cmake command line looked like this:
cmake -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
-DwxWidgets_CONFIG_EXECUTABLE=../../../wx-bin/bin/wx-config \
-DKICAD_SPICE=ON \
-DCMAKE_INSTALL_PREFIX=../bin \
-DCMAKE_BUILD_TYPE=Release \
../../
I.e. just the standard switches, plus the KICAD_SPICE option.
This is where I got stuck for now. Any ideas how to resolve this?
Johannes
Follow ups