I did get ngpsice to compile to the point where it would run and print some
ngspice text to the console.  I had my best success when I switched to OS X
and complied from there--could never get certain issues resolved on my
Ubuntu.  Also, I wrote a list of all the steps I had to do to compile and
run ngpsice on OS X.  Note this list is a bit old and may be incomplete:

Building ngspice with emscripten on OSX:

Download emscripten SDK and ngspice.

Mkdir release

Cd release

Hack configure to fail sigsetjmp tests, see
https://groups.google.com/forum/#!topic/emscripten-discuss/nvq18u4lj6E

Run emconfigure ../configure --(some shared library option?) possibly with
--disable-debug?

Emmake make

Overwrite the ngmakeidx file that cannot be run.

Rename the ngspice binary to ngspice.o

Cd src

Emcc ngspice

Memory limit is wrong, fix it in the code TOTAL_MEMORY

Now we are missing sigsetjmp, which the config said we do not have.

We are also missing siglongjmp

We are also missing logb


Not sure what to do next, let me know if you make any progress with ngspice
to JS though!  Thanks!


On Sun, Mar 16, 2014 at 7:51 AM, Florian Ludwig <[email protected]>wrote:

> Hi Sam,
>
> I am looking into the same matter and I get pass make but using emcc to
> generate js fails on me, did you get the last step working?
>
> Full Output:
> $ emcc ngspice.bc
> warning: Casting a function pointer type to a potentially incompatible one
> (use -s VERBOSE=1 to see more)
> warning: See
> https://github.com/kripken/emscripten/wiki/CodeGuidelinesAndLimitations#function-pointer-issuesfor
>  more information on dangerous function pointer casts
> warning: Casting a function pointer type to a potentially incompatible one
> (use -s VERBOSE=1 to see more)
> warning: See
> https://github.com/kripken/emscripten/wiki/CodeGuidelinesAndLimitations#function-pointer-issuesfor
>  more information on dangerous function pointer casts
> Stack: Error
>     at assertTrue (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8), <anonymous>:59:26)
>     at makeComparison (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:2057:5)
>     at eval (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:1162:18)
>     at Array.map (native)
>     at eval (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:1161:43)
>     at Array.forEach (native)
>     at switchHandler (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:1153:31)
>     at eval (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:522:34)
>     at Array.forEach (native)
>     at functionSplitter (eval at globalEval
> (/home/f.ludwig/emtest/emscripten/src/compiler.js:105:8),
> <anonymous>:511:16)
> aborting from js compiler due to exception: Assertion failed: undefined |
> undefined
> aborting from js compiler due to exception: unhandleable illegal icmp: slt
> | undefined
> Traceback (most recent call last):
>   File "/home/f.ludwig/emtest/emscripten/emscripten.py", line 1405, in
> <module>
>     _main(environ=os.environ)
>   File "/home/f.ludwig/emtest/emscripten/emscripten.py", line 1393, in
> _main
>     temp_files.run_and_clean(lambda: main(
>   File "/home/f.ludwig/emtest/emscripten/tools/tempfiles.py", line 39, in
> run_and_clean
>     return func()
>   File "/home/f.ludwig/emtest/emscripten/emscripten.py", line 1401, in
> <lambda>
>     DEBUG_CACHE=DEBUG_CACHE,
>   File "/home/f.ludwig/emtest/emscripten/emscripten.py", line 1288, in main
>     jcache=jcache, temp_files=temp_files, DEBUG=DEBUG,
> DEBUG_CACHE=DEBUG_CACHE)
>   File "/home/f.ludwig/emtest/emscripten/emscripten.py", line 292, in
> emscript
>     assert len(output) == 2, 'Did not receive forwarded data in an output
> - process failed? We only got: ' + output[0][-3000:]
> AssertionError: Did not receive forwarded data in an output - process
> failed? We only got: EAPF64[(($311)>>3)]=$313;
>  var $314=($12)+($21);
>  var $315=($314)+($25);
>  var $316=($_lobit|0);
>  var $317=($19)+($23);
>  var $318=($316)*($317);
>  var $319=($315)+($318);
>  var $320=($319)*($79);
>  var $321=HEAP32[(($112)>>2)];
>  var $322=HEAPF64[(($321)>>3)];
>  var $323=($320)+($322);
>  HEAPF64[(($321)>>3)]=$323;
>  var $324=($14)+($21);
>  var $325=($324)+($27);
>  var $326=($_lobit17_not|0);
>  var $327=($326)*($317);
>  var $328=($327)+($325);
>  var $329=($328)*($79);
>  var $330=HEAP32[(($125)>>2)];
>  var $331=HEAPF64[(($330)>>3)];
>  var $332=($329)+($331);
>  HEAPF64[(($330)>>3)]=$332;
>  var $333=(($here_019+420)|0);
>  var $334=HEAP32[(($333)>>2)];
>  var $335=HEAPF64[(($334)>>3)];
>  var $336=($335)-($299);
>  HEAPF64[(($334)>>3)]=$336;
>  var $337=(($here_019+436)|0);
>  var $338=HEAP32[(($337)>>2)];
>  var $339=HEAPF64[(($338)>>3)];
>  var $340=($339)-($304);
>  HEAPF64[(($338)>>3)]=$340;
>  var $341=($25)*($79);
>  var $342=HEAP32[(($193)>>2)];
>  var $343=HEAPF64[(($342)>>3)];
>  var $344=($343)-($341);
>  HEAPF64[(($342)>>3)]=$344;
>  var $345=($27)*($79);
>  var $346=HEAP32[(($206)>>2)];
>  var $347=HEAPF64[(($346)>>3)];
>  var $348=($347)-($345);
>  HEAPF64[(($346)>>3)]=$348;
>  var $349=(($here_019+452)|0);
>  var $350=HEAP32[(($349)>>2)];
>  var $351=HEAPF64[(($350)>>3)];
>  var $352=($351)-($299);
>  HEAPF64[(($350)>>3)]=$352;
>  var $353=((($_lobit17_not)-($_lobit))|0);
>  var $354=($353|0);
>  var $355=($354)*($19);
>  var $356=($355)*($79);
>  var $357=HEAP32[(($219)>>2)];
>  var $358=HEAPF64[(($357)>>3)];
>  var $359=($356)+($358);
>  HEAPF64[(($357)>>3)]=$359;
>  var $360=($354)*($23);
>  var $361=($360)-($25);
>  var $362=($361)*($79);
>  var $363=HEAP32[(($235)>>2)];
>  var $364=HEAPF64[(($363)>>3)];
>  var $365=($362)+($364);
>  HEAPF64[(($363)>>3)]=$365;
>  var $366=((-.0))-($21);
>  var $367=($366)-($327);
>  var $368=($367)*($79);
>  var $369=HEAP32[(($248)>>2)];
>  var $370=HEAPF64[(($369)>>3)];
>  var $371=($368)+($370);
>  HEAPF64[(($369)>>3)]=$371;
>  var $372=(((-$353))|0);
>  var $373=($372|0);
>  var $374=($373)*($19);
>  var $375=($374)*($79);
>  var $376=HEAP32[(($261)>>2)];
>  var $377=HEAPF64[(($376)>>3)];
>  var $378=($375)+($377);
>  HEAPF64[(($376)>>3)]=$378;
>  var $379=(($here_019+468)|0);
>  var $380=HEAP32[(($379)>>2)];
>  var $381=HEAPF64[(($380)>>3)];
>  var $382=($381)-($304);
>  HEAPF64[(($380)>>3)]=$382;
>  var $383=((-.0))-($27);
>  var $384=($383)-($360);
>  var $385=($384)*($79);
>  var $386=HEAP32[(($276)>>2)];
>  var $387=HEAPF64[(($386)>>3)];
>  var $388=($385)+($387);
>  HEAPF64[(($386)>>3)]=$388;
>  var $389=($366)-($318);
>  var $390=($389)*($79);
>  var $391=HEAP32[(($289)>>2)];
>  var $392=HEAPF64[(($391)>>3)];
>  var $393=($390)+($392);
>  HEAPF64[(($391)>>3)]=$393;
>  var $394=(($here_019+4)|0);
>  var $here_0=HEAP32[(($394)>>2)];
>  var $395=($here_0|0)==0;
>  if($395){label=5;break;}else{var $here_019=$here_0;label=4;break;}
>  case 5:
>  var $396=(($model_020+4)|0);
>  var $397=HEAP32[(($396)>>2)];
>  var $398=($397|0)==0;
>  if($398){label=6;break;}else{var $model_020=$397;label=3;break;}
>  case 6:
>  return 0;
>   default: assert(0, "bad label: " + label);
>  }
>
> }
>
>
> Traceback (most recent call last):
>   File "../emscripten/emcc", line 1525, in <module>
>     final = shared.Building.emscripten(final, append_ext=False,
> extra_args=extra_args)
>   File "/home/f.ludwig/emtest/emscripten/tools/shared.py", line 1276, in
> emscripten
>     assert os.path.exists(filename + '.o.js') and len(open(filename +
> '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' +
> str(compiler_output)
> AssertionError: Emscripten failed to generate .js:
>
>
> On Thursday, January 2, 2014 6:44:11 PM UTC+1, Sam Reid wrote:
>>
>> Thanks for the pointer Alon, the "Building Projects" link was very
>> helpful.  Following those instructions, I was able to get the build working
>> on OS X.  Running those instructions on Ubuntu produced the same linker
>> problem, but when I supplied "--disable-debug" to the emconfig configure
>> call, that problem went away.
>>
>> Sam
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "emscripten-discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/emscripten-discuss/MUjETZKxBgs/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to