我正在尝试使用我自己的mexopts.sh
在OSX上使用g ++ 4.8在Matlab R2014b中编译Mex文件。相关选项包括:
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -std=c++0x -arch x86_64 -mmacosx-version-min=10.10 -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/path/to/MATLAB_R2014b.app/bin/maci64 -L/path/to/MATLAB_R2014b.app/bin/maci64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
Mex发布的编译命令是:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
-> g++ -c -I/path/to/MATLAB_R2014b.app/extern/include -I/path/to/MATLAB_R2014b.app/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -std=c++0x -arch x86_64 -mmacosx-version-min=10.10 -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O2 -DNDEBUG "/path/to/myfile.cpp" -o /path/to/myfile.o
我的问题出在第一行Configured with: ...
,我想将--prefix
和--with-gxx-include-dir
更改为与GCC相同的值:
sheljohn@computer$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin14/4.8.3/lto-wrapper
Target: x86_64-apple-darwin14
Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc48/gcc48/work/gcc-4.8.3/configure --prefix=/opt/local --build=x86_64-apple-darwin14 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --disable-isl-version-check --with-cloog=/opt/local --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8.3_3'
Thread model: posix
gcc version 4.8.3 (MacPorts gcc48 4.8.3_3)
有没有办法改变这些选项?