【问题标题】:Linking error when compiling ngspice with emscripten on ubuntu在 ubuntu 上使用 emscripten 编译 ngspice 时出现链接错误
【发布时间】:2014-01-01 19:35:26
【问题描述】:

我正在尝试在 Ubuntu 下使用 emscripten 编译 ngspice。我在来自 Windows 8 主机的 hyper-v VM 上运行 Ubuntu 13.10 64 位。我从http://ngspice.sourceforge.net/download.html 下载了最新的稳定版 ngpsice (ngspice-25),并按照 INSTALL 中的安装说明测试了它是否可以正确构建和运行(为简单起见,省略了配置参数):

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

这一切都与 gcc 4.8.1 完美配合,我可以从命令行运行已编译的 ngspice。接下来,我使用 apt-get 安装了 emscripten,它会报告这个版本:

$ ~/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.

这是我的 clang 版本: Debian clang 版本 3.2-7ubuntu1 (tags/RELEASE_32/final) (基于 LLVM 3.2) 目标:x86_64-pc-linux-gnu 线程模型:posix

还有我的 LLVM 版本(由 llvm-link 报告): LLVM (http://llvm.org/): LLVM 3.2 版 优化构建。 建于 2013 年 6 月 7 日 (18:44:38)。 默认目标:x86_64-pc-linux-gnu 主机CPU:corei7

用emscripten编译hello-world.cpp并在nodeJS中运行正常。

然后我用 emscripten 编译器代替配置步骤,如下所示:

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

这是配置步骤的输出:

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

配置完成后,make产生:

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

最后的错误在CCLD步骤,这里是上面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

任何帮助弄清楚如何进行都会很棒,谢谢!

【问题讨论】:

    标签: javascript c emscripten


    【解决方案1】:

    您可能低估了 Emscripten 是什么以及做什么。是的,它是一个交叉编译器,但要通过 llvm 翻译源代码,不仅仅需要使用不同的编译器。

    如果您查看./configure 的输出,您应该会感到疑惑:

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

    此行无法工作,因为 Javascript 只能保存表示 32 位整数。所以至少该拱配置的x86_64 部分是错误的。

    还有一行:

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

    如您所知,我们将使用 LLVM,这意味着也需要替换原生二进制工具。

    使用配置脚本,您必须运行:

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

    这取代了大部分工具,并且 Emscripten 的处理方式也发生了变化。就我个人而言,我会建议像这样调用 make:

    $ ~/Documents/srr/emscripten/emmake make
    

    虽然 make 单独应该工作,但有很多 makefile 写得非常糟糕,所以再次执行这些工具不会有什么坏处。

    完全披露明智,根据经验,我建议不要使用 make 和 autotools 构建。如果 CMake 可用,请使用它。

    还要准备好在移植时做很多工作。这不是一个直接的过程,需要大量的手动工作/测试以及了解所有工具/步骤/源代码。

    祝你好运。

    【讨论】:

    • 感谢您的回答,我在这里找到了有关使用 emscripten 项目构建工具的更多信息:github.com/kripken/emscripten/wiki/Building-Projects。这些步骤足以让它在 OS X 上构建。我通过在配置调用中指定 --disable-debug 解决了这个 Ubuntu 构建问题(不确定如何/为什么起作用)。
    猜你喜欢
    • 2015-07-15
    • 2012-01-12
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多