Open FabriceSalvaire opened 4 years ago
Regarding lib location: Sorry about that. I am not a windows user, so I probably guessed incorrectly. I intended to mimic the structure of the windows zip file provided by the ngspice developers, but maybe I screwed it up. Suggestions welcome.
For doc, ngspice-31_dll_64.zip contents
# Archive: resources/ngspice-31_dll_64.zip
# Spice64_dll/dll-mingw/
# Spice64_dll/dll-mingw/libgcc_s_seh-1.dll
# Spice64_dll/dll-mingw/libgomp-1.dll
# Spice64_dll/dll-mingw/libwinpthread-1.dll
# Spice64_dll/dll-mingw/msys-ngspice-0.dll
# Spice64_dll/dll-vs/
# Spice64_dll/dll-vs/ngspice.dll
# Spice64_dll/dll-vs/vcomp140.dll
# Spice64_dll/include/
# Spice64_dll/include/ngspice/
# Spice64_dll/include/ngspice/sharedspice.h
# Spice64_dll/lib/
# Spice64_dll/lib/about-libs.txt
# Spice64_dll/lib/lib-mingw/
# Spice64_dll/lib/lib-mingw/libngspice.dll.a
# Spice64_dll/lib/lib-mingw/libngspice.la
# Spice64_dll/lib/lib-vs/
# Spice64_dll/lib/lib-vs/ngspice.exp
# Spice64_dll/lib/lib-vs/ngspice.lib
# Spice64_dll/lib/ngspice/
# Spice64_dll/lib/ngspice/analog.cm
# Spice64_dll/lib/ngspice/digital.cm
# Spice64_dll/lib/ngspice/spice2poly.cm
# Spice64_dll/lib/ngspice/table.cm
# Spice64_dll/lib/ngspice/xtradev.cm
# Spice64_dll/lib/ngspice/xtraevt.cm
# Spice64_dll/share/
# Spice64_dll/share/ngspice/
# Spice64_dll/share/ngspice/scripts/
# Spice64_dll/share/ngspice/scripts/spinit
For doc, where files are installed in Anaconda
REM C:\Users\...\miniconda3\Scripts aka bin
REM C:\Users\...\miniconda3\pkgs\ngspice-lib-32-h8c06526_6
REM bin
REM info
REM lib
REM share
REM C:\Users\...\miniconda3\bin\ngspice.dll
REM C:\Users\...\miniconda3\share\ngspice\scripts\spinit
REM codemodel ../lib/ngspice/spice2poly.cm
REM C:\Users\...\miniconda3\Lib\ngspice\spice2poly.cm
REM C:\Users\...\miniconda3\conda-bld\pyspice_1592343686090\_test_env\lib\site-packages\PySpice
for doc, Actual PySpice code
if ConfigInstall.OS.on_windows:
# https://sourceforge.net/p/ngspice/discussion/133842/thread/1cece652/#4e32/5ab8/9027
# When environment variable SPICE_LIB_DIR is empty, ngspice looks in C:\Spice64\share\ngspice\scripts
# Else it tries %SPICE_LIB_DIR%\scripts\spinit
if 'SPICE_LIB_DIR' not in os.environ:
_ = str(Path(self.NGSPICE_PATH).joinpath('share', 'ngspice'))
os.environ['SPICE_LIB_DIR'] = _
# self._logger.warning('Set SPICE_LIB_DIR = %s', _)
# Fixme: not compatible with supra
# if 'CONDA_PREFIX' in os.environ:
# _ = str(Path(os.environ['CONDA_PREFIX']).joinpath('share', 'ngspice'))
# os.environ['SPICE_LIB_DIR'] = _
# self._logger.warning('Set SPICE_LIB_DIR = %s', _)
CONDA_PREFIX
and don't copy files to PySpicengspice.exe
. How it founds files ???../lib/ngspice/spice2poly.cm
seems relative to SPICE_LIB_DIR
that must be set to "..."\scripts\spinit
thus C:\Users\...\miniconda3\share\ngspice\
that means this relative path is wrong, it should be ..\..\lib\...
Another solution is to rewrite spinit and place useful files somewhere in the same directory. But it could break ngspice.exe
Can we use Python in the bat for that purpose ???
OK, I don't have time to fix the windows build, but I'll take a look at any PR you make. The current recipe uses ngspice's make-install-vngspice.bat
(slightly patched). If you want to simply write a better install script, that's fine.
Can we use Python in the bat for that purpose ???
Yes. First you will need to add python
to the list of build
dependencies:
For reference: this is how Yggdrasil bundles ngspice: https://github.com/JuliaPackaging/Yggdrasil/tree/master/N/ngspice They seem to be cross-compiling with the automake build system, can we do that or we always use MSVC?
Maybe I'm mistaken, but it looks like that build script does not copy these files, which if I understand correctly is how you link to a shared library on windows?
# Spice64_dll/lib/lib-vs/ngspice.exp
# Spice64_dll/lib/lib-vs/ngspice.lib
Looking at some other windows libraries the layout is as follows:
lib/foo.lib
include/foo.h
bin/foo.exe
bin/foo.dll
share/whatever
I'd be happy to try and update the install script if I could get it to work at all as-is :sob:
Looks like the download URL is broken, newer versions don't build, and updating the URL to 32 just gives me MORE COMPILE ERRORS oh god I'm THIS close to just giving up
The dll version of ngspice, ngspice.dll, is made as a standalone dll (no codemodels, no installation) by double click on sharedspice.sln. However ngspice.dll may use the directory tree and code models as created above.
Uh, so maybe it doesn't need all that stuff?
I found issues on Windows, see https://github.com/conda-forge/pyspice-feedstock/pull/17/files#diff-9281e96d80111563776ada67648cc668 for the tricks
conda build .
is very very very slow (take several minutes), so it is painful to debug on a true machine, and CI is also painful