Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates ngspice 35 to 37 #11001

Closed
wants to merge 1 commit into from
Closed

Conversation

harieamjari
Copy link
Contributor

By default, when called by ngspice, gnuplot uses an unknown terminal type. This has been solved in this patch by setting the term type to "dumb" which prints an ASCII of the plot.

For some reason, when ngspice is installed with the deb generated from actions with dpkg -i and then ran with ngspice, ngspice reports:

.../lib/ngspice $ ngspice
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/spice2poly.cm": dlopen failed: cannot locate symbol "spice2poly_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/spice2poly.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/spice2poly.cm couldn't be loaded!
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/analog.cm": dlopen failed: cannot locate symbol "cm_climit_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/analog.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/analog.cm couldn't be loaded!
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/digital.cm": dlopen failed: cannot locate symbol "cm_adc_bridge_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/digital.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/digital.cm couldn't be loaded!
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/xtradev.cm": dlopen failed: cannot locate symbol "cm_aswitch_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/xtradev.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/xtradev.cm couldn't be loaded!
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/xtraevt.cm": dlopen failed: cannot locate symbol "ucm_d_to_real_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/xtraevt.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/xtraevt.cm couldn't be loaded!
Error opening code model "/data/data/com.termux/files/usr/lib/ngspice/table.cm": dlopen failed: cannot locate symbol "cm_table2D_info" referenced by "/data/data/com.termux/files/usr/lib/ngspice/table.cm"...
Error: Library /data/data/com.termux/files/usr/lib/ngspice/table.cm couldn't be loaded!
******
** ngspice-37 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2022, The ngspice team.
** 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 Jun 16 15:52:08 UTC 2022
******

even though this files *.cm exists in this directories. I suspect something went wrong with the compilation of the *.cm.

I have manage to build it on my Android phone and this error did not appear.

@harieamjari
Copy link
Contributor Author

harieamjari commented Jun 17, 2022

These are those working *.cm I compiled on termux https://transfer.sh/UxLoM6/working.zip (aarch)

@harieamjari
Copy link
Contributor Author

harieamjari commented Jun 17, 2022

Ok, I think I got a lead. Those symbols are actually undefined as reported by nm;

$ nm -D spice2poly.cm
U memcpy@LIBC
0000000000003c44 T realloc_pj
                 U spice2poly_info
                 U strlen@LIBC
0000000000003c6c T tmalloc
...

ngspice loads this library and immediately resolves all symbols (with RTLD_NOW https://sourceforge.net/p/ngspice/ngspice/ci/ngspice-37/tree/src/spicelib/devices/dev.c#l427) but there's other symbols which cannot be resolve (like spice2poly_info, cm_climit_info and others). This symbols does not exist in the .cm I've compiled and so dlopen doesn't complain.

@Grimler91
Copy link
Member

Cannot locate symbol errors sounds like the infamous android/ndk#201. Most likely you can solve it by explicitly linking against your .cm libraries against the library(ies) that provide spice2poly_info, cm_climit_info and so on

@harieamjari
Copy link
Contributor Author

harieamjari commented Jun 18, 2022

I think, I found the culprit. The actions in build tries to execute cmpp but it's actually compiled for aarch64 so we get an Exec format error:

https://github.com/termux/termux-packages/runs/6931402733?check_suite_focus=true#step:6:2678

I'll try adding --build=$(config.guess) --host=aarch64-linux-android to extra configure args.

@harieamjari harieamjari force-pushed the master branch 4 times, most recently from 0715b8f to c2dddfa Compare June 18, 2022 18:18
@harieamjari
Copy link
Contributor Author

Ughh... now config.guess cannot be found. Does the machine allow using it's own native compiler @Grimler91?

@Grimler91
Copy link
Member

You might have to patch the makefile and change the compiler used to compile the cmpp that is used during the build, or maybe it is easier to build it in a hostbuild step, similar to what for example nethack does: https://github.com/termux/termux-packages/blob/master/packages/nethack/build.sh#L11-L41

@harieamjari
Copy link
Contributor Author

harieamjari commented Jun 18, 2022

There exist an example for cross compiling to windows from ngspice, https://sourceforge.net/p/ngspice/ngspice/ci/ngspice-37/tree/cross-compile.sh#l41 and I use this as a template for cross compiling. I'll try these examples if ngspice configure for cross compiling ultimately fails.

@harieamjari
Copy link
Contributor Author

I'll close this up for now to test on my own actions a dozen times, until I made a working patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants