我在 OS X 10.15.7 上使用 clang++ 构建 Octave 时遇到链接器错误。
例如“bsxfun_add(intNDArray<octave_int > const&, intNDArray<octave_int > const&)”,引用自:libcorefcn.a(libcorefcn_la-bsxfun.o) 中的 octave_value bsxfun_forward_op<intNDArray<octave_int >, &(bsxfun_add(intNDArray<octave_int > const&, intNDArray<octave_int > const&))>(octave_value const&, octave_value const&)
$ export CXXFLAGS="--std=c++11 --stdlib=libc++ $CXXFLAGS"
$ export CC=/usr/bin/clang
$ export CXX=/usr/bin/clang++
$ export CCLD=/usr/bin/clang
$ export CXXLD=/usr/bin/clang++
./configure --enable-shared LD_LIBRARY_PATH="-L/usr/local/lib -L/opt/local/lib -L/opt/local/libexec/qt5/lib" LDFLAGS="-L/usr/local/lib -L/opt/local/lib -L/opt/local/libexec/qt5/lib" CPPFLAGS="-I/usr/local/include/sundials -I/opt/local/include" --with-libiconv-prefix=/opt/local/lib --with-suitesparseconfig-includedir=/opt/local/include/ --with-sundials_ida-includedir=/usr/local/include/sundials --with-sundials_ida-libdir=/usr/local/lib
...
$ make V=1
libtool: link: /usr/bin/clang++ -dynamiclib -o liboctave/.libs/liboctave.8.dylib liboctave/.libs/liboctave_la-liboctave-build-info.o liboctave/.libs/liboctave_la-version.o -Wl,-force_load,liboctave/array/.libs/libarray.a -Wl,-force_load,liboctave/external/blas-xtra/.libs/libxerbla.a -Wl,-force_load,liboctave/external/ranlib/.libs/libranlib.a -Wl,-force_load,liboctave/external/.libs/libexternal.a -Wl,-force_load,liboctave/numeric/.libs/libnumeric.a -Wl,-force_load,liboctave/operators/.libs/liboperators.a -Wl,-force_load,liboctave/system/.libs/libsystem.a -Wl,-force_load,liboctave/util/.libs/libutil.a -Wl,-force_load,liboctave/wrappers/.libs/libwrappers.a -Wl,-force_load,libgnu/.libs/libgnu.a -L/opt/local/lib -L/usr/local/lib -L/opt/local/libexec/qt5/lib -lcurl -lcholmod -lumfpack -lamd -lcamd -lcolamd -lccolamd -lcxsparse -lsuitesparseconfig -larpack -lqrupdate -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -lopenblas -lreadline -lncurses -lpcre -ldl -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0/../../.. /usr/local/lib/libgfortran.dylib /usr/local/lib/libquadmath.dylib -liconv -lm -pthread -stdlib=libc++ -Wl,-framework -Wl,CoreFoundation -pthread -install_name /usr/local/lib/octave/7.0.0/liboctave.8.dylib -compatibility_version 9 -current_version 9.0 -Wl,-single_module
libtool: link: (cd "liboctave/.libs" && rm -f "liboctave.dylib" && ln -s "liboctave.8.dylib" "liboctave.dylib")
libtool: link: ( cd "liboctave/.libs" && rm -f "liboctave.la" && ln -s "../liboctave.la" "liboctave.la" )
/bin/sh ./libtool --tag=CXX --mode=link /usr/bin/clang++ -fPIC -D_THREAD_SAFE -pthread -Wall -W -Wshadow -Woverloaded-virtual -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -fvisibility=hidden -std=c++11 -stdlib=libc++ -version-info 8:0:0 -no-undefined -bindir /usr/local/bin -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/usr/local/lib -L/opt/local/lib -L/opt/local/libexec/qt5/lib -o libinterp/liboctinterp.la -rpath /usr/local/lib/octave/7.0.0 libinterp/liboctinterp_la-octave.lo libinterp/operators/liboctinterp_la-op-b-b.lo libinterp/operators/liboctinterp_la-op-b-bm.lo libinterp/operators/liboctinterp_la-op-b-sbm.lo libinterp/operators/liboctinterp_la-op-bm-b.lo libinterp/operators/liboctinterp_la-op-bm-bm.lo libinterp/operators/liboctinterp_la-op-bm-sbm.lo libinterp/operators/liboctinterp_la-op-cdm-cdm.lo libinterp/operators/liboctinterp_la-op-cdm-cm.lo libinterp/operators/liboctinterp_la-op-cdm-cs.lo libinterp/operators/liboctinterp_la-op-cdm-dm.lo libinterp/operators/liboctinterp_la-op-cdm-m.lo libinterp/operators/liboctinterp_la-op-cdm-s.lo libinterp/operators/liboctinterp_la-op-cell.lo libinterp/operators/liboctinterp_la-op-chm.lo libinterp/operators/liboctinterp_la-op-class.lo libinterp/operators/liboctinterp_la-op-cm-cdm.lo libinterp/operators/liboctinterp_la-op-cm-cm.lo libinterp/operators/liboctinterp_la-op-cm-cs.lo libinterp/operators/liboctinterp_la-op-cm-dm.lo libinterp/operators/liboctinterp_la-op-cm-m.lo libinterp/operators/liboctinterp_la-op-cm-pm.lo libinterp/operators/liboctinterp_la-op-cm-s.lo libinterp/operators/liboctinterp_la-op-cm-scm.lo libinterp/operators/liboctinterp_la-op-cm-sm.lo libinterp/operators/liboctinterp_la-op-cs-cm.lo libinterp/operators/liboctinterp_la-op-cs-cs.lo libinterp/operators/liboctinterp_la-op-cs-m.lo libinterp/operators/liboctinterp_la-op-cs-s.lo libinterp/operators/liboctinterp_la-op-cs-scm.lo libinterp/operators/liboctinterp_la-op-cs-sm.lo libinterp/operators/liboctinterp_la-op-dm-cdm.lo libinterp/operators/liboctinterp_la-op-dm-cm.lo libinterp/operators/liboctinterp_la-op-dm-cs.lo libinterp/operators/liboctinterp_la-op-dm-dm.lo libinterp/operators/liboctinterp_la-op-dm-m.lo libinterp/operators/liboctinterp_la-op-dm-s.lo libinterp/operators/liboctinterp_la-op-dm-scm.lo libinterp/operators/liboctinterp_la-op-dm-sm.lo libinterp/operators/liboctinterp_la-op-fcdm-fcdm.lo libinterp/operators/liboctinterp_la-op-fcdm-fcm.lo libinterp/operators/liboctinterp_la-op-fcdm-fcs.lo libinterp/operators/liboctinterp_la-op-fcdm-fdm.lo libinterp/operators/liboctinterp_la-op-fcdm-fm.lo libinterp/operators/liboctinterp_la-op-fcdm-fs.lo libinterp/operators/liboctinterp_la-op-fcm-fcdm.lo libinterp/operators/liboctinterp_la-op-fcm-fcm.lo libinterp/operators/liboctinterp_la-op-fcm-fcs.lo libinterp/operators/liboctinterp_la-op-fcm-fdm.lo libinterp/operators/liboctinterp_la-op-fcm-fm.lo libinterp/operators/liboctinterp_la-op-fcm-fs.lo libinterp/operators/liboctinterp_la-op-fcm-pm.lo libinterp/operators/liboctinterp_la-op-fcn.lo libinterp/operators/liboctinterp_la-op-fcs-fcm.lo libinterp/operators/liboctinterp_la-op-fcs-fcs.lo libinterp/operators/liboctinterp_la-op-fcs-fm.lo libinterp/operators/liboctinterp_la-op-fcs-fs.lo libinterp/operators/liboctinterp_la-op-fdm-fcdm.lo libinterp/operators/liboctinterp_la-op-fdm-fcm.lo libinterp/operators/liboctinterp_la-op-fdm-fcs.lo libinterp/operators/liboctinterp_la-op-fdm-fdm.lo libinterp/operators/liboctinterp_la-op-fdm-fm.lo libinterp/operators/liboctinterp_la-op-fdm-fs.lo libinterp/operators/liboctinterp_la-op-fm-fcdm.lo libinterp/operators/liboctinterp_la-op-fm-fcm.lo libinterp/operators/liboctinterp_la-op-fm-fcs.lo libinterp/operators/liboctinterp_la-op-fm-fdm.lo libinterp/operators/liboctinterp_la-op-fm-fm.lo libinterp/operators/liboctinterp_la-op-fm-fs.lo libinterp/operators/liboctinterp_la-op-fm-pm.lo libinterp/operators/liboctinterp_la-op-fs-fcm.lo libinterp/operators/liboctinterp_la-op-fs-fcs.lo libinterp/operators/liboctinterp_la-op-fs-fm.lo libinterp/operators/liboctinterp_la-op-fs-fs.lo libinterp/operators/liboctinterp_la-op-i16-i16.lo libinterp/operators/liboctinterp_la-op-i32-i32.lo libinterp/operators/liboctinterp_la-op-i64-i64.lo libinterp/operators/liboctinterp_la-op-i8-i8.lo libinterp/operators/liboctinterp_la-op-int-concat.lo libinterp/operators/liboctinterp_la-op-m-cdm.lo libinterp/operators/liboctinterp_la-op-m-cm.lo libinterp/operators/liboctinterp_la-op-m-cs.lo libinterp/operators/liboctinterp_la-op-m-dm.lo libinterp/operators/liboctinterp_la-op-m-m.lo libinterp/operators/liboctinterp_la-op-m-pm.lo libinterp/operators/liboctinterp_la-op-m-s.lo libinterp/operators/liboctinterp_la-op-m-scm.lo libinterp/operators/liboctinterp_la-op-m-sm.lo libinterp/operators/liboctinterp_la-op-mi.lo libinterp/operators/liboctinterp_la-op-pm-cm.lo libinterp/operators/liboctinterp_la-op-pm-fcm.lo libinterp/operators/liboctinterp_la-op-pm-fm.lo libinterp/operators/liboctinterp_la-op-pm-m.lo libinterp/operators/liboctinterp_la-op-pm-pm.lo libinterp/operators/liboctinterp_la-op-pm-scm.lo libinterp/operators/liboctinterp_la-op-pm-sm.lo libinterp/operators/liboctinterp_la-op-range.lo libinterp/operators/liboctinterp_la-op-s-cm.lo libinterp/operators/liboctinterp_la-op-s-cs.lo libinterp/operators/liboctinterp_la-op-s-m.lo libinterp/operators/liboctinterp_la-op-s-s.lo libinterp/operators/liboctinterp_la-op-s-scm.lo libinterp/operators/liboctinterp_la-op-s-sm.lo libinterp/operators/liboctinterp_la-op-sbm-b.lo libinterp/operators/liboctinterp_la-op-sbm-bm.lo libinterp/operators/liboctinterp_la-op-sbm-sbm.lo libinterp/operators/liboctinterp_la-op-scm-cm.lo libinterp/operators/liboctinterp_la-op-scm-cs.lo libinterp/operators/liboctinterp_la-op-scm-m.lo libinterp/operators/liboctinterp_la-op-scm-s.lo libinterp/operators/liboctinterp_la-op-scm-scm.lo libinterp/operators/liboctinterp_la-op-scm-sm.lo libinterp/operators/liboctinterp_la-op-sm-cm.lo libinterp/operators/liboctinterp_la-op-sm-cs.lo libinterp/operators/liboctinterp_la-op-sm-m.lo libinterp/operators/liboctinterp_la-op-sm-s.lo libinterp/operators/liboctinterp_la-op-sm-scm.lo libinterp/operators/liboctinterp_la-op-sm-sm.lo libinterp/operators/liboctinterp_la-op-str-m.lo libinterp/operators/liboctinterp_la-op-str-s.lo libinterp/operators/liboctinterp_la-op-str-str.lo libinterp/operators/liboctinterp_la-op-struct.lo libinterp/operators/liboctinterp_la-op-ui16-ui16.lo libinterp/operators/liboctinterp_la-op-ui32-ui32.lo libinterp/operators/liboctinterp_la-op-ui64-ui64.lo libinterp/operators/liboctinterp_la-op-ui8-ui8.lo libinterp/template-inst/liboctinterp_la-Array-tc.lo libinterp/template-inst/liboctinterp_la-Array-jit.lo libinterp/liboctinterp_la-build-env-features.lo libinterp/liboctinterp_la-build-env.lo libinterp/liboctinterp_la-builtins.lo libinterp/corefcn/liboctinterp_la-oct-errno.lo libinterp/liboctinterp_la-liboctinterp-build-info.lo libinterp/operators/liboctinterp_la-ops.lo libinterp/octave-value/liboctave-value.la libinterp/parse-tree/libparse-tree.la libinterp/corefcn/libcorefcn.la liboctave/liboctave.la -L/opt/local/lib -lfreetype -lhdf5 -lGraphicsMagick++ -lGraphicsMagick -lz -lcholmod -lumfpack -lamd -lcamd -lcolamd -lccolamd -lcxsparse -lsuitesparseconfig -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -framework OpenGL -lfontconfig -lfreetype -lX11 -framework Carbon -lgl2ps -lcurl -lcholmod -lumfpack -lamd -lcamd -lcolamd -lccolamd -lcxsparse -lsuitesparseconfig -larpack -lqrupdate -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -lopenblas -lreadline -lncurses -lpcre -ldl -L/usr/local/lib -L/opt/local/lib -L/opt/local/libexec/qt5/lib -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0/../../.. -lgfortran -lquadmath -lm -lm -liconv -Wl,-framework -Wl,CoreFoundation -lm
libtool: link: /usr/bin/clang++ -dynamiclib -o libinterp/.libs/liboctinterp.8.dylib libinterp/.libs/liboctinterp_la-octave.o libinterp/operators/.libs/liboctinterp_la-op-b-b.o libinterp/operators/.libs/liboctinterp_la-op-b-bm.o libinterp/operators/.libs/liboctinterp_la-op-b-sbm.o libinterp/operators/.libs/liboctinterp_la-op-bm-b.o libinterp/operators/.libs/liboctinterp_la-op-bm-bm.o libinterp/operators/.libs/liboctinterp_la-op-bm-sbm.o libinterp/operators/.libs/liboctinterp_la-op-cdm-cdm.o libinterp/operators/.libs/liboctinterp_la-op-cdm-cm.o libinterp/operators/.libs/liboctinterp_la-op-cdm-cs.o libinterp/operators/.libs/liboctinterp_la-op-cdm-dm.o libinterp/operators/.libs/liboctinterp_la-op-cdm-m.o libinterp/operators/.libs/liboctinterp_la-op-cdm-s.o libinterp/operators/.libs/liboctinterp_la-op-cell.o libinterp/operators/.libs/liboctinterp_la-op-chm.o libinterp/operators/.libs/liboctinterp_la-op-class.o libinterp/operators/.libs/liboctinterp_la-op-cm-cdm.o libinterp/operators/.libs/liboctinterp_la-op-cm-cm.o libinterp/operators/.libs/liboctinterp_la-op-cm-cs.o libinterp/operators/.libs/liboctinterp_la-op-cm-dm.o libinterp/operators/.libs/liboctinterp_la-op-cm-m.o libinterp/operators/.libs/liboctinterp_la-op-cm-pm.o libinterp/operators/.libs/liboctinterp_la-op-cm-s.o libinterp/operators/.libs/liboctinterp_la-op-cm-scm.o libinterp/operators/.libs/liboctinterp_la-op-cm-sm.o libinterp/operators/.libs/liboctinterp_la-op-cs-cm.o libinterp/operators/.libs/liboctinterp_la-op-cs-cs.o libinterp/operators/.libs/liboctinterp_la-op-cs-m.o libinterp/operators/.libs/liboctinterp_la-op-cs-s.o libinterp/operators/.libs/liboctinterp_la-op-cs-scm.o libinterp/operators/.libs/liboctinterp_la-op-cs-sm.o libinterp/operators/.libs/liboctinterp_la-op-dm-cdm.o libinterp/operators/.libs/liboctinterp_la-op-dm-cm.o libinterp/operators/.libs/liboctinterp_la-op-dm-cs.o libinterp/operators/.libs/liboctinterp_la-op-dm-dm.o libinterp/operators/.libs/liboctinterp_la-op-dm-m.o libinterp/operators/.libs/liboctinterp_la-op-dm-s.o libinterp/operators/.libs/liboctinterp_la-op-dm-scm.o libinterp/operators/.libs/liboctinterp_la-op-dm-sm.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fcdm.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fdm.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fm.o libinterp/operators/.libs/liboctinterp_la-op-fcdm-fs.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fcdm.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fdm.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fm.o libinterp/operators/.libs/liboctinterp_la-op-fcm-fs.o libinterp/operators/.libs/liboctinterp_la-op-fcm-pm.o libinterp/operators/.libs/liboctinterp_la-op-fcn.o libinterp/operators/.libs/liboctinterp_la-op-fcs-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fcs-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fcs-fm.o libinterp/operators/.libs/liboctinterp_la-op-fcs-fs.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fcdm.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fdm.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fm.o libinterp/operators/.libs/liboctinterp_la-op-fdm-fs.o libinterp/operators/.libs/liboctinterp_la-op-fm-fcdm.o libinterp/operators/.libs/liboctinterp_la-op-fm-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fm-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fm-fdm.o libinterp/operators/.libs/liboctinterp_la-op-fm-fm.o libinterp/operators/.libs/liboctinterp_la-op-fm-fs.o libinterp/operators/.libs/liboctinterp_la-op-fm-pm.o libinterp/operators/.libs/liboctinterp_la-op-fs-fcm.o libinterp/operators/.libs/liboctinterp_la-op-fs-fcs.o libinterp/operators/.libs/liboctinterp_la-op-fs-fm.o libinterp/operators/.libs/liboctinterp_la-op-fs-fs.o libinterp/operators/.libs/liboctinterp_la-op-i16-i16.o libinterp/operators/.libs/liboctinterp_la-op-i32-i32.o libinterp/operators/.libs/liboctinterp_la-op-i64-i64.o libinterp/operators/.libs/liboctinterp_la-op-i8-i8.o libinterp/operators/.libs/liboctinterp_la-op-int-concat.o libinterp/operators/.libs/liboctinterp_la-op-m-cdm.o libinterp/operators/.libs/liboctinterp_la-op-m-cm.o libinterp/operators/.libs/liboctinterp_la-op-m-cs.o libinterp/operators/.libs/liboctinterp_la-op-m-dm.o libinterp/operators/.libs/liboctinterp_la-op-m-m.o libinterp/operators/.libs/liboctinterp_la-op-m-pm.o libinterp/operators/.libs/liboctinterp_la-op-m-s.o libinterp/operators/.libs/liboctinterp_la-op-m-scm.o libinterp/operators/.libs/liboctinterp_la-op-m-sm.o libinterp/operators/.libs/liboctinterp_la-op-mi.o libinterp/operators/.libs/liboctinterp_la-op-pm-cm.o libinterp/operators/.libs/liboctinterp_la-op-pm-fcm.o libinterp/operators/.libs/liboctinterp_la-op-pm-fm.o libinterp/operators/.libs/liboctinterp_la-op-pm-m.o libinterp/operators/.libs/liboctinterp_la-op-pm-pm.o libinterp/operators/.libs/liboctinterp_la-op-pm-scm.o libinterp/operators/.libs/liboctinterp_la-op-pm-sm.o libinterp/operators/.libs/liboctinterp_la-op-range.o libinterp/operators/.libs/liboctinterp_la-op-s-cm.o libinterp/operators/.libs/liboctinterp_la-op-s-cs.o libinterp/operators/.libs/liboctinterp_la-op-s-m.o libinterp/operators/.libs/liboctinterp_la-op-s-s.o libinterp/operators/.libs/liboctinterp_la-op-s-scm.o libinterp/operators/.libs/liboctinterp_la-op-s-sm.o libinterp/operators/.libs/liboctinterp_la-op-sbm-b.o libinterp/operators/.libs/liboctinterp_la-op-sbm-bm.o libinterp/operators/.libs/liboctinterp_la-op-sbm-sbm.o libinterp/operators/.libs/liboctinterp_la-op-scm-cm.o libinterp/operators/.libs/liboctinterp_la-op-scm-cs.o libinterp/operators/.libs/liboctinterp_la-op-scm-m.o libinterp/operators/.libs/liboctinterp_la-op-scm-s.o libinterp/operators/.libs/liboctinterp_la-op-scm-scm.o libinterp/operators/.libs/liboctinterp_la-op-scm-sm.o libinterp/operators/.libs/liboctinterp_la-op-sm-cm.o libinterp/operators/.libs/liboctinterp_la-op-sm-cs.o libinterp/operators/.libs/liboctinterp_la-op-sm-m.o libinterp/operators/.libs/liboctinterp_la-op-sm-s.o libinterp/operators/.libs/liboctinterp_la-op-sm-scm.o libinterp/operators/.libs/liboctinterp_la-op-sm-sm.o libinterp/operators/.libs/liboctinterp_la-op-str-m.o libinterp/operators/.libs/liboctinterp_la-op-str-s.o libinterp/operators/.libs/liboctinterp_la-op-str-str.o libinterp/operators/.libs/liboctinterp_la-op-struct.o libinterp/operators/.libs/liboctinterp_la-op-ui16-ui16.o libinterp/operators/.libs/liboctinterp_la-op-ui32-ui32.o libinterp/operators/.libs/liboctinterp_la-op-ui64-ui64.o libinterp/operators/.libs/liboctinterp_la-op-ui8-ui8.o libinterp/template-inst/.libs/liboctinterp_la-Array-tc.o libinterp/template-inst/.libs/liboctinterp_la-Array-jit.o libinterp/.libs/liboctinterp_la-build-env-features.o libinterp/.libs/liboctinterp_la-build-env.o libinterp/.libs/liboctinterp_la-builtins.o libinterp/corefcn/.libs/liboctinterp_la-oct-errno.o libinterp/.libs/liboctinterp_la-liboctinterp-build-info.o libinterp/operators/.libs/liboctinterp_la-ops.o -Wl,-force_load,libinterp/octave-value/.libs/liboctave-value.a -Wl,-force_load,libinterp/parse-tree/.libs/libparse-tree.a -Wl,-force_load,libinterp/corefcn/.libs/libcorefcn.a -L/opt/local/lib -L/usr/local/lib -L/opt/local/libexec/qt5/lib liboctave/.libs/liboctave.dylib -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin19/10.2.0/../../.. -lhdf5 -lGraphicsMagick++ -lGraphicsMagick -lz -framework OpenGL -lfontconfig -lfreetype -lX11 -framework Carbon -lgl2ps -lcurl -lcholmod -lumfpack -lamd -lcamd -lcolamd -lccolamd -lcxsparse -lsuitesparseconfig -larpack -lqrupdate -lfftw3_threads -lfftw3 -lfftw3f_threads -lfftw3f -lopenblas -lreadline -lncurses -lpcre -ldl /usr/local/lib/libgfortran.dylib /usr/local/lib/libquadmath.dylib -liconv -lm -pthread -stdlib=libc++ -Wl,-framework -Wl,CoreFoundation -pthread -framework OpenGL -framework Carbon -install_name /usr/local/lib/octave/7.0.0/liboctinterp.8.dylib -compatibility_version 9 -current_version 9.0 -Wl,-single_module
Undefined symbols for architecture x86_64:
"bsxfun_add(intNDArray<octave_int<signed char> > const&, intNDArray<octave_int<signed char> > const&)", referenced from:
octave_value bsxfun_forward_op<intNDArray<octave_int<signed char> >, &(bsxfun_add(intNDArray<octave_int<signed char> > const&, intNDArray<octave_int<signed char> > const&))>(octave_value const&, octave_value const&) in libcorefcn.a(libcorefcn_la-bsxfun.o)
"bsxfun_add(intNDArray<octave_int<unsigned char> > const&, intNDArray<octave_int<unsigned char> > const&)", referenced from:
octave_value bsxfun_forward_op<intNDArray<octave_int<unsigned char> >, &(bsxfun_add(intNDArray<octave_int<unsigned char> > const&, intNDArray<octave_int<unsigned char> > const&))>(octave_value const&, octave_value const&) in libcorefcn.a(libcorefcn_la-bsxfun.o)
来自 libcorefcn.a:
U __Z10bsxfun_addRK10intNDArrayI10octave_intIaEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIhEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIiEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIjEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIsEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intItEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIxEES4_
U __Z10bsxfun_addRK10intNDArrayI10octave_intIyEES4_
U __Z10bsxfun_addRK12FloatNDArrayS1_
U __Z10bsxfun_addRK14ComplexNDArrayS1_
U __Z10bsxfun_addRK19FloatComplexNDArrayS1_
U __Z10bsxfun_addRK7NDArrayS1_
并分解:
__Z10bsxfun_addRK10intNDArrayI10octave_intIaEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIhEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIiEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIjEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIsEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intItEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIxEES4_
__Z10bsxfun_addRK10intNDArrayI10octave_intIyEES4_
__Z10bsxfun_addRK12FloatNDArrayS1_
__Z10bsxfun_addRK14ComplexNDArrayS1_
__Z10bsxfun_addRK19FloatComplexNDArrayS1_
__Z10bsxfun_addRK7NDArrayS1_
_bsxfun_add(intNDArray<octave_int<signed char> > const&, intNDArray<octave_int<signed char> > const&)
_bsxfun_add(intNDArray<octave_int<unsigned char> > const&, intNDArray<octave_int<unsigned char> > const&)
_bsxfun_add(intNDArray<octave_int<int> > const&, intNDArray<octave_int<int> > const&)
_bsxfun_add(intNDArray<octave_int<unsigned int> > const&, intNDArray<octave_int<unsigned int> > const&)
_bsxfun_add(intNDArray<octave_int<short> > const&, intNDArray<octave_int<short> > const&)
_bsxfun_add(intNDArray<octave_int<unsigned short> > const&, intNDArray<octave_int<unsigned short> > const&)
_bsxfun_add(intNDArray<octave_int<long long> > const&, intNDArray<octave_int<long long> > const&)
_bsxfun_add(intNDArray<octave_int<unsigned long long> > const&, intNDArray<octave_int<unsigned long long> > const&)
_bsxfun_add(FloatNDArray const&, FloatNDArray const&)
_bsxfun_add(ComplexNDArray const&, ComplexNDArray const&)
_bsxfun_add(FloatComplexNDArray const&, FloatComplexNDArray const&)
_bsxfun_add(NDArray const&, NDArray const&)
根据“nm -n”,函数(一旦被分解http://demangler.com) 位于静态库“libcorefcn.a”中。链接器错误似乎与通过参数 -force-load 包含的静态库有关。知道哪里出了问题吗?
答案1
我必须将 -std=c+11 切换为 -std=c++17 并添加 -isysroot
export CXXFLAGS="-std=c++11 -stdlib=libc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk $CXXFLAGS"
这是配置命令:
./configure --with-libiconv-prefix=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/ CXXFLAGS="-std=c++17 -stdlib=libc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Users/davidlaxer/SuiteSparse/include -I/opt/local/include -I/opt/local/libexec/qt5/include -I/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/include" CPPFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Users/davidlaxer/SuiteSparse/include -I/opt/local/include -I/opt/local/libexec/qt5/include -I/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/include" LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib -L/Users/davidlaxer/SuiteSparse/lib/ -L/opt/local/lib -L/opt/local/libexec/qt5/lib -L/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/lib" DYLD_LIBRARY_PATH="-L/opt/local/lib -L/opt/local/libexec/qt5/lib -L/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/lib" LD_LIBRARY_PATH="-L/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib -L/Users/davidlaxer/SuiteSparse/lib/ -L/opt/local/lib -L/opt/local/libexec/qt5/lib -L/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/lib" --with-suitesparseconfig-includedir=/Users/davidlaxer/SuiteSparse/include --with-suitesparseconfig-libdir=/Users/davidlaxer/SuiteSparse/lib --disable-readline --with-sundials_ida-includedir=/opt/local/include/sundials --with-sundials_ida-libdir=/opt/local/lib/ --with-qt=5