juliamatlab / mexjulia

embedding Julia in the MATLAB process.
MIT License
52 stars 14 forks source link

Crash after the first call #58

Open ChrisRackauckas opened 6 years ago

ChrisRackauckas commented 6 years ago

I am getting a crash after the first call returns, just doing jl.eval('2+2'). This is on CentOS with the COPR build.

Build:

>> jl.config
         build_cflags: '-O -I"/usr/include/julia" -DJULIA_ENABLE_THREADING'
        build_ldflags: '-L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64"'
         build_ldlibs: '-ljulia -ldl'
            build_src: '/home/crackauc/.julia/mexjulia/mexjulia.cpp'
              inc_dir: '/usr/include/julia'
             is_debug: 'false'
            julia_bin: '/usr/bin/julia'
           julia_home: '/usr/bin'
             lib_base: 'julia'
              lib_dir: '/usr/bin/../lib64'
             lib_path: '/usr/bin/../lib64/libjulia.so.0.6'
            sys_image: '/usr/lib64/julia/sys.so'
    threading_enabled: 'true'

/home/crackauc/.julia/mexjulia is not on the MATLAB path. Adding it and saving...
Warning: Unable to save path to file '/usr/local/MATLAB/R2017b/toolbox/local/pathdef.m'. You can save your path to a different
location by calling SAVEPATH with an input argument that specifies the full path. For MATLAB to use that path in future sessions,
save the path to 'pathdef.m' in your MATLAB startup folder. 
> In savepath (line 176)
  In jl.config (line 264) 
The mex command to be executed:
mex LDFLAGS='-L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64" $LDFLAGS' -v -largeArrayDims -outdir "/home/crackauc/.julia/mexjulia" -O -I"/usr/include/julia" -DJULIA_ENABLE_THREADING /home/crackauc/.julia/mexjulia/mexjulia.cpp -ljulia -ldl
Verbose mode is on.
... Looking for compiler 'g++' ...
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Executing command 'g++ -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so').
Found installed compiler 'g++'.
Options file details
-------------------------------------------------------------------
    Compiler location: /usr/bin/g++
    Options file: /home/crackauc/.matlab/R2017b/mex_C++_glnxa64.xml
    CMDLINE2 : /usr/bin/g++ -L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64" -pthread -Wl,--no-undefined  -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2017b/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_74651827174027896_26765/mexjulia.o /tmp/mex_74651827174027896_26765/cpp_mexapi_version.o   -ljulia  -ldl   -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -L"/usr/local/MATLAB/R2017b/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o /home/crackauc/.julia/mexjulia/mexjulia.mexa64
    CXX : /usr/bin/g++
    DEFINES : -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE 
    MATLABMEX : -DMATLAB_MEX_FILE 
    CFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread
    CXXFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11
    INCLUDE : -I"/usr/include/julia"  -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include"
    CXXOPTIMFLAGS : -O -DNDEBUG
    CXXDEBUGFLAGS : -g
    LDXX : /usr/bin/g++
    LDFLAGS : -L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64" -pthread -Wl,--no-undefined 
    LDTYPE : -shared
    LINKEXPORT : -Wl,--version-script,"/usr/local/MATLAB/R2017b/extern/lib/glnxa64/mexFunction.map"
    LINKEXPORTVER : -Wl,--version-script,"/usr/local/MATLAB/R2017b/extern/lib/glnxa64/c_exportsmexfileversion.map"
    LINKLIBS : -ljulia  -ldl   -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -L"/usr/local/MATLAB/R2017b/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++
    LDOPTIMFLAGS : -O
    LDDEBUGFLAGS : -g
    MWCPPLIB : "/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6"
    OBJEXT : .o
    LDEXT : .mexa64
    SETENV : CC="gcc"
                CXX="/usr/bin/g++"
                CFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                CXXFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                COPTIMFLAGS="-O -DNDEBUG"
                CXXOPTIMFLAGS="-O -DNDEBUG"
                CDEBUGFLAGS="-g"
                CXXDEBUGFLAGS="-g"
                LD="gcc"
                LDXX="/usr/bin/g++"
                LDFLAGS="-L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64" -pthread -Wl,--no-undefined  -shared -ljulia  -ldl   -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -L"/usr/local/MATLAB/R2017b/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -Wl,--version-script,"/usr/local/MATLAB/R2017b/extern/lib/glnxa64/mexFunction.map""
                LDDEBUGFLAGS="-g"
    GCC : /usr/bin/g++
    CPPLIB_DIR : /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so
    MATLABROOT : /usr/local/MATLAB/R2017b
    ARCH : glnxa64
    SRC : "/home/crackauc/.julia/mexjulia/mexjulia.cpp";"/usr/local/MATLAB/R2017b/extern/version/cpp_mexapi_version.cpp"
    OBJ : /tmp/mex_74651827174027896_26765/mexjulia.o;/tmp/mex_74651827174027896_26765/cpp_mexapi_version.o
    OBJS : /tmp/mex_74651827174027896_26765/mexjulia.o /tmp/mex_74651827174027896_26765/cpp_mexapi_version.o 
    SRCROOT : /home/crackauc/.julia/mexjulia/mexjulia
    DEF : /tmp/mex_74651827174027896_26765/mexjulia.def
    EXP : /home/crackauc/.julia/mexjulia/mexjulia.exp
    LIB : /home/crackauc/.julia/mexjulia/mexjulia.lib
    EXE : /home/crackauc/.julia/mexjulia/mexjulia.mexa64
    ILK : /home/crackauc/.julia/mexjulia/mexjulia.ilk
    MANIFEST : /home/crackauc/.julia/mexjulia/mexjulia.mexa64.manifest
    TEMPNAME : /home/crackauc/.julia/mexjulia/mexjulia
    EXEDIR : /home/crackauc/.julia/mexjulia/
    EXENAME : mexjulia
    OPTIM : -O -DNDEBUG
    LINKOPTIM : -O
    CMDLINE1_0 : /usr/bin/g++ -c -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/include/julia"  -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/home/crackauc/.julia/mexjulia/mexjulia.cpp" -o /tmp/mex_74651827174027896_26765/mexjulia.o
    CMDLINE1_1 : /usr/bin/g++ -c -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/include/julia"  -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/usr/local/MATLAB/R2017b/extern/version/cpp_mexapi_version.cpp" -o /tmp/mex_74651827174027896_26765/cpp_mexapi_version.o
-------------------------------------------------------------------
Building with 'g++'.
/usr/bin/g++ -c -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/include/julia"  -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/home/crackauc/.julia/mexjulia/mexjulia.cpp" -o /tmp/mex_74651827174027896_26765/mexjulia.o
/usr/bin/g++ -c -DJULIA_ENABLE_THREADING  -DMX_COMPAT_64  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/include/julia"  -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/usr/local/MATLAB/R2017b/extern/version/cpp_mexapi_version.cpp" -o /tmp/mex_74651827174027896_26765/cpp_mexapi_version.o
/usr/bin/g++ -L"/usr/bin/../lib64" -Wl,-rpath="/usr/bin/../lib64" -pthread -Wl,--no-undefined  -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2017b/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_74651827174027896_26765/mexjulia.o /tmp/mex_74651827174027896_26765/cpp_mexapi_version.o   -ljulia  -ldl   -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -L"/usr/local/MATLAB/R2017b/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o /home/crackauc/.julia/mexjulia/mexjulia.mexa64
MEX completed successfully.

And then:

jl.eval('2+2')

[crackauc@crackauc2 mexjulia]$ matlab

WARNING: deprecated syntax "typealias mwSize UInt" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:38.
Use "const mwSize = UInt" instead.

WARNING: deprecated syntax "typealias mwIndex Int" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:39.
Use "const mwIndex = Int" instead.

WARNING: deprecated syntax "typealias mxChar UInt16" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:40.
Use "const mxChar = UInt16" instead.

WARNING: deprecated syntax "typealias mxClassID Cint" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:41.
Use "const mxClassID = Cint" instead.

WARNING: deprecated syntax "typealias mxComplexity Cint" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:42.
Use "const mxComplexity = Cint" instead.

WARNING: deprecated syntax "typealias Pairs Union{Pair,NTuple{2}}" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:498.
Use "const Pairs = Union{Pair,NTuple{2}}" instead.

WARNING: deprecated syntax "typealias Pairs NTuple{2}" at /home/crackauc/.julia/mexjulia/jl/mxarray.jl:500.
Use "const Pairs = NTuple{2}" instead.
Segmentation fault (core dumped)