Question

I am trying to compile ngspice with emscripten under Ubuntu. I am running Ubuntu 13.10 64-bit on a hyper-v VM from a Windows 8 host. I downloaded the latest stable version of ngpsice (ngspice-25) from: http://ngspice.sourceforge.net/download.html and tested that it builds and runs properly following the installation instructions in INSTALL (omitting configure arguments for simplicity):

$ mkdir release
$ cd release
$ ../configure
$ make
$ sudo make install

This all works perfectly with gcc 4.8.1 and I can run the compiled ngspice from the command line. Next, I installed emscripten using apt-get and it reports this version:

$ ~/Documents/srr/emscripten/emcc --version

emcc (Emscripten GCC-like replacement) 1.7.8 (commit 1a007b1631509b9d72499a8f4402294017ee04dc)
Copyright (C) 2013 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here is my clang version: Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2) Target: x86_64-pc-linux-gnu Thread model: posix

And my LLVM version (reported by llvm-link): LLVM (http://llvm.org/): LLVM version 3.2 Optimized build. Built Jun 7 2013 (18:44:38). Default target: x86_64-pc-linux-gnu Host CPU: corei7

Compiling hello-world.cpp with emscripten and running in nodeJS works properly.

Then I substitute the emscripten compiler for the configure step like so:

$ CC=~/Documents/srr/emscripten/emcc ../configure

Here is the output from the configure step:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... /home/samreid/Documents/srr/emscripten/emcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/samreid/Documents/srr/emscripten/emcc accepts -g... yes
checking for /home/samreid/Documents/srr/emscripten/emcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of /home/samreid/Documents/srr/emscripten/emcc... gcc3
checking how to run the C preprocessor... /home/samreid/Documents/srr/emscripten/emcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for strings.h... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether /home/samreid/Documents/srr/emscripten/emcc and cc understand -c and -o together... yes
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by /home/samreid/Documents/srr/emscripten/emcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from /home/samreid/Documents/srr/emscripten/emcc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/samreid/Documents/srr/emscripten/emcc supports -fno-rtti -fno-exceptions... yes
checking for /home/samreid/Documents/srr/emscripten/emcc option to produce PIC... -fPIC -DPIC
checking if /home/samreid/Documents/srr/emscripten/emcc PIC flag -fPIC -DPIC works... yes
checking if /home/samreid/Documents/srr/emscripten/emcc static flag -static works... yes
checking if /home/samreid/Documents/srr/emscripten/emcc supports -c -o file.o... yes
checking if /home/samreid/Documents/srr/emscripten/emcc supports -c -o file.o... (cached) yes
checking whether the /home/samreid/Documents/srr/emscripten/emcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... ERROR    root: [31mno input files
note that input files without a known suffix are ignored, make sure your input files end with one of: ('.c', '.C', '.cpp', '.cxx', '.cc', '.CPP', '.CXX', '.CC', '.m', '.mm', '.bc', '.o', '.obj', '.dylib', '.so', '.dll', '.a', '.ll')[0m
GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether windows code is enabled... no
checking /proc/meminfo usability... yes
checking /proc/meminfo presence... yes
checking for /proc/meminfo... yes
checking for X... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking whether closedir returns void... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking for vprintf... yes
checking for _doprnt... no
checking if hardcoding of the X11 runtime library path is desired... no
No X display!
checking for pid_t... yes
checking return type of signal handlers... void
checking for sighandler_t... no
checking for sig_t... yes
checking for __sighandler_t... no
checking for dirent.h that defines DIR... (cached) yes
checking for library containing opendir... (cached) none required
checking for unistd.h... (cached) yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking stropts.h usability... yes
checking stropts.h presence... yes
checking for stropts.h... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether stat file-mode macros are broken... no
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for sys/socket.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/timeb.h usability... yes
checking sys/timeb.h presence... yes
checking for sys/timeb.h... yes
checking sys/io.h usability... yes
checking sys/io.h presence... yes
checking for sys/io.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for localtime... yes
checking for ftime... yes
checking for gettimeofday... yes
checking for time... yes
checking for getrusage... yes
checking for utimes... yes
checking for getrlimit... yes
checking for endpwent... yes
checking for gethostbyname... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strstr... yes
checking for strtol... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for isatty... yes
checking for tcgetattr... yes
checking for tcsetattr... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for access... yes
checking for bcopy... yes
checking for bzero... yes
checking for qsort... yes
checking for dup2... yes
checking for popen... yes
checking for strchr... yes
checking for strrchr... yes
checking for getcwd... yes
Checking mathematical features of the system:
checking for sqrt in -lm... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking values.h usability... yes
checking values.h presence... yes
checking for values.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking for erfc... yes
checking for logb... yes
checking for scalb... yes
checking for scalbn... yes
checking for asinh... yes
checking for acosh... yes
checking for atanh... yes
checking for finite... yes
checking whether isinf is declared... yes
checking whether isnan is declared... yes
checking for sigsetjmp... no
checking libiberty.h usability... no
checking libiberty.h presence... no
checking for libiberty.h... no
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking for asprintf... yes
checking for dirname... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for getopt_long... yes
Settings which were chosen:
checking for bison... no
checking for byacc... no
checking for yacc... no
configure: WARNING: No bison, byacc, yacc found: Uses prebuilt default parsers
GNU readline disabled.
BSD editline disabled.
checking ncurses/termcap.h usability... no
checking ncurses/termcap.h presence... no
checking for ncurses/termcap.h... no
checking termcap.h usability... no
checking termcap.h presence... no
checking for termcap.h... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating man/Makefile
config.status: creating man/man1/Makefile
config.status: creating src/Makefile
config.status: creating src/spicelib/Makefile
config.status: creating src/spicelib/analysis/Makefile
config.status: creating src/spicelib/devices/Makefile
config.status: creating src/spicelib/devices/asrc/Makefile
config.status: creating src/spicelib/devices/bjt/Makefile
config.status: creating src/spicelib/devices/bsim1/Makefile
config.status: creating src/spicelib/devices/bsim2/Makefile
config.status: creating src/spicelib/devices/bsim3/Makefile
config.status: creating src/spicelib/devices/bsim3v0/Makefile
config.status: creating src/spicelib/devices/bsim3v1/Makefile
config.status: creating src/spicelib/devices/bsim3v32/Makefile
config.status: creating src/spicelib/devices/bsim4/Makefile
config.status: creating src/spicelib/devices/bsim4v4/Makefile
config.status: creating src/spicelib/devices/bsim4v5/Makefile
config.status: creating src/spicelib/devices/bsim4v6/Makefile
config.status: creating src/spicelib/devices/bsim3soi_pd/Makefile
config.status: creating src/spicelib/devices/bsim3soi_fd/Makefile
config.status: creating src/spicelib/devices/bsim3soi_dd/Makefile
config.status: creating src/spicelib/devices/bsimsoi/Makefile
config.status: creating src/spicelib/devices/cap/Makefile
config.status: creating src/spicelib/devices/cccs/Makefile
config.status: creating src/spicelib/devices/ccvs/Makefile
config.status: creating src/spicelib/devices/csw/Makefile
config.status: creating src/spicelib/devices/cpl/Makefile
config.status: creating src/spicelib/devices/dio/Makefile
config.status: creating src/spicelib/devices/ind/Makefile
config.status: creating src/spicelib/devices/isrc/Makefile
config.status: creating src/spicelib/devices/hfet1/Makefile
config.status: creating src/spicelib/devices/hfet2/Makefile
config.status: creating src/spicelib/devices/hisim2/Makefile
config.status: creating src/spicelib/devices/hisimhv1/Makefile
config.status: creating src/spicelib/devices/jfet/Makefile
config.status: creating src/spicelib/devices/jfet2/Makefile
config.status: creating src/spicelib/devices/ltra/Makefile
config.status: creating src/spicelib/devices/mes/Makefile
config.status: creating src/spicelib/devices/mesa/Makefile
config.status: creating src/spicelib/devices/mos1/Makefile
config.status: creating src/spicelib/devices/mos2/Makefile
config.status: creating src/spicelib/devices/mos3/Makefile
config.status: creating src/spicelib/devices/mos6/Makefile
config.status: creating src/spicelib/devices/mos9/Makefile
config.status: creating src/spicelib/devices/ndev/Makefile
config.status: creating src/spicelib/devices/res/Makefile
config.status: creating src/spicelib/devices/soi3/Makefile
config.status: creating src/spicelib/devices/sw/Makefile
config.status: creating src/spicelib/devices/tra/Makefile
config.status: creating src/spicelib/devices/txl/Makefile
config.status: creating src/spicelib/devices/urc/Makefile
config.status: creating src/spicelib/devices/vbic/Makefile
config.status: creating src/spicelib/devices/vccs/Makefile
config.status: creating src/spicelib/devices/vcvs/Makefile
config.status: creating src/spicelib/devices/vsrc/Makefile
config.status: creating src/spicelib/devices/nbjt/Makefile
config.status: creating src/spicelib/devices/nbjt2/Makefile
config.status: creating src/spicelib/devices/numd/Makefile
config.status: creating src/spicelib/devices/numd2/Makefile
config.status: creating src/spicelib/devices/numos/Makefile
config.status: creating src/spicelib/parser/Makefile
config.status: creating src/ciderlib/Makefile
config.status: creating src/ciderlib/input/Makefile
config.status: creating src/ciderlib/support/Makefile
config.status: creating src/ciderlib/oned/Makefile
config.status: creating src/ciderlib/twod/Makefile
config.status: creating src/frontend/Makefile
config.status: creating src/frontend/numparam/Makefile
config.status: creating src/frontend/help/Makefile
config.status: creating src/frontend/parser/Makefile
config.status: creating src/frontend/plotting/Makefile
config.status: creating src/frontend/trannoise/Makefile
config.status: creating src/frontend/wdisp/Makefile
config.status: creating src/include/ngspice/Makefile
config.status: creating src/maths/Makefile
config.status: creating src/maths/cmaths/Makefile
config.status: creating src/maths/fft/Makefile
config.status: creating src/maths/misc/Makefile
config.status: creating src/maths/ni/Makefile
config.status: creating src/maths/deriv/Makefile
config.status: creating src/maths/poly/Makefile
config.status: creating src/maths/sparse/Makefile
config.status: creating src/misc/Makefile
config.status: creating src/xspice/Makefile
config.status: creating src/xspice/cm/Makefile
config.status: creating src/xspice/cmpp/Makefile
config.status: creating src/xspice/icm/makedefs
config.status: creating src/xspice/icm/GNUmakefile
config.status: creating src/xspice/mif/Makefile
config.status: creating src/xspice/evt/Makefile
config.status: creating src/xspice/enh/Makefile
config.status: creating src/xspice/ipc/Makefile
config.status: creating src/xspice/idn/Makefile
config.status: creating tests/Makefile
config.status: creating tests/bsim1/Makefile
config.status: creating tests/bsim2/Makefile
config.status: creating tests/bsim3/Makefile
config.status: creating tests/bsim3/ac_sim/Makefile
config.status: creating tests/bsim3/dc_sim/Makefile
config.status: creating tests/bsim3/tran_sim/Makefile
config.status: creating tests/bsim3soidd/Makefile
config.status: creating tests/bsim3soifd/Makefile
config.status: creating tests/bsim3soipd/Makefile
config.status: creating tests/bsim4/Makefile
config.status: creating tests/bsimsoi/Makefile
config.status: creating tests/filters/Makefile
config.status: creating tests/general/Makefile
config.status: creating tests/hfet/Makefile
config.status: creating tests/hisim/Makefile
config.status: creating tests/hisimhv1/Makefile
config.status: creating tests/jfet/Makefile
config.status: creating tests/mes/Makefile
config.status: creating tests/mesa/Makefile
config.status: creating tests/mos6/Makefile
config.status: creating tests/polezero/Makefile
config.status: creating tests/sensitivity/Makefile
config.status: creating tests/transient/Makefile
config.status: creating tests/transmission/Makefile
config.status: creating tests/xspice/Makefile
config.status: creating tests/xspice/digital/Makefile
config.status: creating tests/xspice/digital/spinit
config.status: creating tests/resistance/Makefile
config.status: creating tests/vbic/Makefile
config.status: creating src/include/ngspice/config.h
config.status: executing depfiles commands
config.status: executing libtool commands

After configuring, make produces:

Making all in src
make[1]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src'
Making all in misc
make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/misc'
  CC     getopt_long_bsd.lo
  CC     alloc.lo
  CC     dup2.lo
  CC     dstring.lo
  CC     hash.lo
  CC     ivars.lo
  CC     mktemp.lo
  CC     printnum.lo
  CC     string.lo
../../../src/misc/string.c:540:10: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
    for(i=i; str[i]!='\0'; i++) 
        ~^~
1 warning generated.
  CC     tilde.lo
  CC     misc_time.lo
  CC     wlist.lo
  CC     util.lo
  CCLD   libmisc.la
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/misc'
Making all in maths
make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths'
Making all in cmaths
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/cmaths'
  CC     cmath1.lo
  CC     cmath2.lo
  CC     cmath3.lo
  CC     cmath4.lo
  CCLD   libcmaths.la
  CC     test_cx_mag.o
  CCLD   test_cx_mag
  CC     test_cx_j.o
  CCLD   test_cx_j
  CC     test_cx_ph.o
  CCLD   test_cx_ph
  CC     test_cx_cph.o
  CCLD   test_cx_cph
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/cmaths'
Making all in ni
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/ni'
  CC     niaciter.lo
  CC     nicomcof.lo
  CC     niconv.lo
  CC     nidest.lo
  CC     niditer.lo
  CC     niinit.lo
  CC     niinteg.lo
  CC     niiter.lo
  CC     niniter.lo
  CC     nipred.lo
  CC     nipzmeth.lo
  CC     nireinit.lo
  CC     nisenre.lo
  CCLD   libni.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/ni'
Making all in sparse
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/sparse'
  CC     spalloc.lo
  CC     spbuild.lo
  CC     spextra.lo
  CC     spfactor.lo
  CC     spoutput.lo
  CC     spsmp.lo
  CC     spsolve.lo
  CC     sputils.lo
  CCLD   libsparse.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/sparse'
Making all in poly
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/poly'
  CC     interpolate.lo
  CC     polyfit.lo
  CC     polyderiv.lo
  CC     polyeval.lo
  CCLD   libpoly.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/poly'
Making all in deriv
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/deriv'
  CC     atander.lo
  CC     cosderiv.lo
  CC     cubeder.lo
  CC     divderiv.lo
  CC     equalder.lo
  CC     expderiv.lo
  CC     invderiv.lo
  CC     multder.lo
  CC     plusder.lo
  CC     powderiv.lo
  CC     sqrtder.lo
  CC     tanderiv.lo
  CC     timesder.lo
  CCLD   libderiv.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/deriv'
Making all in misc
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/misc'
  CC     accuracy.lo
  CC     bernoull.lo
  CC     erfc.lo
  CC     equality.lo
  CC     isinf.lo
  CC     isnan.lo
  CC     logb.lo
  CC     scalb.lo
  CC     norm.lo
  CC     randnumb.lo
  CCLD   libmathmisc.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/misc'
Making all in fft
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths/fft'
  CC     fftext.lo
  CC     fftlib.lo
  CC     matlib.lo
  CCLD   libmathfft.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths/fft'
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/maths'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths'
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/maths'
Making all in frontend
make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/frontend'
Making all in plotting
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/plotting'
  CC     plotting.lo
  CC     agraf.lo
  CC     clip.lo
  CC     gnuplot.lo
  CC     graf.lo
  CC     graphdb.lo
  CC     grid.lo
  CC     pvec.lo
  CC     plot5.lo
  CC     plotcurv.lo
  CC     plotit.lo
  CCLD   libplotting.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/plotting'
Making all in help
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/help'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/help'
Making all in parser
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/parser'
  CC     backq.lo
  CC     complete.lo
../../../../src/frontend/parser/complete.c:113:48: warning: implicit conversion changes signedness: 'int' to 'long' [-Wsign-conversion]
            if (cc && (cc->cc_kwords[arg] & (1 << j))) {
                                          ~  ~~^~~~
1 warning generated.
  CC     cshpar.lo
  CC     glob.lo
  CC     input.lo
  CC     lexical.lo
  CC     numparse.lo
  CC     std.lo
  CC     unixcom.lo
  CCLD   libparser.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/parser'
Making all in wdisp
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/wdisp'
  CC     windisp.lo
  CC     winprint.lo
  CCLD   libwindisp.la
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/frontend/wdisp'
<truncated for space>...
make[4]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib/devices/vsrc'
  CC     vsrc.lo
  CC     vsrcacct.lo
  CC     vsrcacld.lo
  CC     vsrcask.lo
  CC     vsrcdel.lo
  CC     vsrcdest.lo
  CC     vsrcfbr.lo
  CC     vsrcinit.lo
  CC     vsrcload.lo
  CC     vsrcmdel.lo
  CC     vsrcpar.lo
  CC     vsrcpzld.lo
  CC     vsrcpzs.lo
  CC     vsrcset.lo
  CC     vsrctemp.lo
  CCLD   libvsrc.la
make[4]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib/devices/vsrc'
make[4]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib/devices'
  CC     dev.lo
  CC     devsup.lo
  CC     cktaccept.lo
  CC     cktask.lo
  CC     cktbindnode.lo
  CC     cktcrte.lo
  CC     cktfinddev.lo
  CC     cktinit.lo
  CC     limit.lo
  CCLD   libdev.la
make[4]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib/devices'
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib/devices'
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib'
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/spicelib'
Making all in include/ngspice
make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/include/ngspice'
make  all-am
make[3]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src/include/ngspice'
make[3]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/include/ngspice'
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src/include/ngspice'
make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src'
  CC     ngspice-main.o
  CC     ngspice-conf.o
  CC     ngspice-ngspice.o
  CCLD   ngspice
Traceback (most recent call last):
  File "/home/samreid/Documents/srr/emscripten/emcc", line 1293, in <module>
    shared.Building.link(temp_files, specified_target)
  File "/home/samreid/Documents/srr/emscripten/tools/shared.py", line 1105, in link
    assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error: 
make[2]: *** [ngspice] Error 1
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src'
make: *** [all-recursive] Error 1

The final error is in the CCLD step, here is the tail of the above trace:

make[2]: Entering directory `/home/samreid/Downloads/ngspice-25/release/src'
  CC     ngspice-main.o
  CC     ngspice-conf.o
  CC     ngspice-ngspice.o
  CCLD   ngspice
Traceback (most recent call last):
  File "/home/samreid/Documents/srr/emscripten/emcc", line 1293, in <module>
    shared.Building.link(temp_files, specified_target)
  File "/home/samreid/Documents/srr/emscripten/tools/shared.py", line 1105, in link
    assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error: 
make[2]: *** [ngspice] Error 1
make[2]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/samreid/Downloads/ngspice-25/release/src'
make: *** [all-recursive] Error 1

Any help to figure out how to proceed would be awesome, thanks!

Was it helpful?

Solution

You probably underestimate, what Emscripten is and does. Yes, it is a cross-compiler but to get source code translated via llvm there has to happen much more than just using a different compiler.

If you look at the ./configure output, it should already make you wonder:

checking host system type... x86_64-unknown-linux-gnu

This line cannot work since Javascript can only savely represent 32bit integers. So at least the x86_64 part of that arch config is wrong.

Also the line:

checking the name lister (/usr/bin/nm -B) interface... BSD nm

Like you already know, we are going to use LLVM, which means the native binary tools need to be replaced, too.

With configure scripts you have to run:

$ ~/Documents/srr/emscripten/emconfigure ./configure

This replaces most of tools and handling gets changed for Emscripten. Personally I would then recommend to invoke make like so:

$ ~/Documents/srr/emscripten/emmake make

While make alone should work, there are a lot of makefiles, that are written very badly, so enforcing the tools once again cannot hurt.

Full disclosure wise, from experience I would recommend against make and autotools builds. Use CMake if it is available.

Also prepare yourself to do quite a lot of work when porting. This is not a straight forward process and needs lot of manual work/testing as well as understanding all the tools/steps/source code.

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top