错误:无效的MEX文件'[MEX_FILENAME]':网关功能缺失

时间:2019-07-17 10:07:15

标签: c matlab mex

我通过用户提供的一组文件成功地在 Linux 下的 Matlab 2018a 中编译了一个mex函数。当我尝试使用该功能时,出现错误消息Error: Invalid MEX-file '[MEX_FILENAME]': Gateway function is missing。此错误来自何处以及如何处理?

我通过:

编译
mex -v -R2018a kalcvf/kalcvf.c kalcvf/dlyap.c kalcvf/matlib.c -lmwblas -lmwlapack

(我必须将所有sprintf_s替换为snprintf,因为前者不适用于Linux)

更新:主c文件如下:

#include "matlib.h"

/* all warning messages were supressed because in case of failure in dlyap
   there exist default solution in the main algorithm */
//#define _DLYAP_NOMSG_

#ifdef KALCVF_MEX
#undef KALCVF_MEX
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {

    double *data, *a, *F, *b, *H, *var, *z0, *vz0, *logl, *pred, *vpred, *filt, *vfilt;
    const mwSize *dims;
    mwSize lead, T, Nz, Ny, rows, cols, ndims, inca=0, incF=0, incb=0, incH=0, incvar=0;

    /*===== check number of input and output arguments =====*/

    if ( (nrhs != 7) && (nrhs != 9) )
        mexErrMsgTxt("Seven or nine input arguments required.");
    if ( (nlhs > 5) )
        mexErrMsgTxt("More than five output arguments specified.");

    /*===== check number of forecasting steps =====*/
    lead = (mwSize)mxGetScalar(prhs[1]);
    if ( (mxGetM(prhs[1])*mxGetN(prhs[1]) != 1) || (lead < 0) )
        mexErrMsgTxt("lead must be positive integer scalar.");

    /*===== check input matrix dimensions =====*/

    /* data must be Ny�T matrix */
    Ny = mxGetM(prhs[0]);
    T  = mxGetN(prhs[0]);

    /* a must be Nz�1 or Nz�(T+lead) vector */
    Nz = mxGetM(prhs[2]);
    if ( (cols=mxGetN(prhs[2])) == 1 )
        inca = 0;
    else if ( cols == (T+lead) )
        inca = Nz;
    else {
        snprintf(msg,101, "data has Ny=%d rows and T=%d columns, lead is equal to %d, "
            "a has Nz=%d rows, but the number of columns in a (%d) is neither one "
            "nor T+lead=%d.", Ny, T, lead, Nz, cols, T+lead);
        mexErrMsgTxt(msg);
    }

    /* F must be Nz�Nz or Nz�Nz�(T+lead) matrix */
    dims = mxGetDimensions(prhs[3]);
    if ( (dims[0] != Nz) || (dims[1] != Nz) ) {
        snprintf(msg,101, "a and F must have the same number of rows. F must be square in the first two dimensions. "
            "a has Nz=%d rows, but F has %d rows and %d columns.", Nz, dims[0], dims[1]);
        mexErrMsgTxt(msg);
    }
    ndims = mxGetNumberOfDimensions(prhs[3]);
    if ( ndims == 2 )
        incF = 0;
    else if ( ndims == 3 ) {
        if ( dims[2] == (T+lead) )
            incF = Nz*Nz;
        else {
            snprintf(msg,101, "F must have (T+lead)=%d elements in third dimension.", T+lead);
            mexErrMsgTxt(msg);
        }
    } else
        mexErrMsgTxt("F must be two- or three-dimensional matrix.");

    /* b must be Ny�1 or Ny�(T+lead) vector */
    if ( (rows=mxGetM(prhs[4])) != Ny ) {
        snprintf(msg,101, "data and b must have the same number of rows. "
            "data has Ny=%d rows, but the number of rows in b is %d.", Ny, rows);
        mexErrMsgTxt(msg);
    }
    if ( (cols=mxGetN(prhs[4])) == 1 )
        incb = 0;
    else if ( cols == (T+lead) )
        incb = Ny;
    else {
        snprintf(msg,101, "data has Ny=%d rows and T=%d columns, lead is equal to %d, "
            "b has Ny=%d rows, but the number of columns in b (%d) is neither one "
            "nor T+lead=%d.", Ny, T, lead, Ny, cols, T+lead);
        mexErrMsgTxt(msg);
    }

    /* H must be Ny�Nz or Ny�Nz�(T+lead) matrix */
    dims = mxGetDimensions(prhs[5]);
    if ( dims[0] != Ny ) {
        snprintf(msg,101, "data and H must have the same number of rows. "
            "data has Ny=%d rows, but the number of rows in H is %d.", Ny, dims[0]);
        mexErrMsgTxt(msg);
    }
    if ( dims[1] != Nz ) {
        snprintf(msg,101, "H must have the same number of columns as rows in matrix a. "
            "a has Nz=%d rows, but the number of columns in H is %d.", Nz, dims[1]);
        mexErrMsgTxt(msg);
    }
    ndims = mxGetNumberOfDimensions(prhs[5]);
    if ( ndims == 2 )
        incH = 0;
    else if ( ndims == 3 ) {
        if ( dims[2] == (T+lead) )
            incH = Ny*Nz;
        else {
            snprintf(msg,101, "H must have (T+lead)=%d elements in third dimension.", T+lead);
            mexErrMsgTxt(msg);
        }
    } else
        mexErrMsgTxt("H must be two- or three-dimensional matrix.");

    /* var must be (Ny+Nz)�(Ny+Nz) or (Ny+Nz)�(Ny+Nz)�(T+lead) matrix */
    dims = mxGetDimensions(prhs[6]);
    if ( (dims[0] != Ny+Nz) || (dims[1] != Ny+Nz) ) {
        snprintf(msg,101, "var must contain variance matrix for the errors in transition and measurement equations. "
            "var must be square p.d.f. %d�%d or %d�%d�%d matrix, but your var has %d rows and %d columns.",
            Ny+Nz, Ny+Nz, Ny+Nz, Ny+Nz, T+lead, dims[0], dims[1]);
        mexErrMsgTxt(msg);
    }
    ndims = mxGetNumberOfDimensions(prhs[6]);
    if ( ndims == 2 )
        incvar = 0;
    else if ( ndims == 3 ) {
        if ( dims[2] == (T+lead) )
            incvar = (Ny+Nz)*(Ny+Nz);
        else {
            snprintf(msg,101, "var must have (T+lead)=%d elements in third dimension.", T+lead);
            mexErrMsgTxt(msg);
        }
    } else
        mexErrMsgTxt("var must be two- or three-dimensional matrix.");

    /* if specified, z0 must be Nz�1 vector and vz0 must be Nz�Nz matrix */
    if ( nrhs==9 ) {
        rows = mxGetM(prhs[7]);
        cols = mxGetN(prhs[7]);
        if ( ( rows != Nz ) || ( cols != 1 ) ) {
            snprintf(msg,101, "a and z0 must have the same number of rows. z0 must be Nz�1 vector. "
                "a has Nz=%d rows, but z0 has %d rows and %d columns.", Nz, rows, cols);
            mexErrMsgTxt(msg);
        }
        rows=mxGetM(prhs[8]);
        cols=mxGetN(prhs[8]);
        if ( ( rows != Nz ) || ( cols != Nz ) ) {
            snprintf(msg,101, "a and vz0 must have the same number of rows. vz0 must be square Nz�Nz matrix. "
                "a has Nz=%d rows, but vz0 has %d rows and %d columns.", Nz, rows, cols);
            mexErrMsgTxt(msg);
        }
    }

    /*===== get pointers to input arguments =====*/

    data = mxGetPr(prhs[0]);
    a    = mxGetPr(prhs[2]);
    F    = mxGetPr(prhs[3]);
    b    = mxGetPr(prhs[4]);
    H    = mxGetPr(prhs[5]);
    var  = mxGetPr(prhs[6]);
    if ( nrhs == 9 ) {
        z0 = mxGetPr(prhs[7]);
        vz0 = mxGetPr(prhs[8]);
    } else {
        z0  = NULL;
        vz0 = NULL;
    }

    /*===== create output scalar value of the average log likelihood function =====*/

    logl = mxGetPr(plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL));

    /*===== get pointers to optional output arguments =====*/

    if ( nlhs < 5 ) vfilt = NULL;
    else {
        mwSize dim[3] = { Nz, Nz, T };
        vfilt = mxGetPr(plhs[4]=mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL));
    }
    if ( nlhs < 4 ) filt = NULL;
    else filt  = mxGetPr(plhs[3]=mxCreateDoubleMatrix(Nz, T, mxREAL));
    if ( nlhs < 3 ) vpred = NULL;
    else {
        mwSize dim[3] = { Nz, Nz, T+lead };
        vpred = mxGetPr(plhs[2]=mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL));
    }
    if ( nlhs < 2 ) pred = NULL;
    else pred  = mxGetPr(plhs[1]=mxCreateDoubleMatrix(Nz, T+lead, mxREAL));

    /*===== compute Kalman Filter =====*/

    *logl = kalcvf(data, (int)T, (int)lead, (int)Ny, (int)Nz, a, (int)inca, F, (int)incF, b, (int)incb, H, (int)incH,
        var, (int)incvar, z0, vz0, pred, vpred, filt, vfilt);

}
#endif

/* The Kalman filter */
#define PI 3.141592653589793238
double kalcvf(double *data, int T, int lead, int Ny, int Nz,
              double *a_all, int inca, double *F_all, int incF,
              double *b_all, int incb, double *H_all, int incH,
              double *var_all, int incvar, double *z0, double *vz0,
              double *pred, double *vpred, double *filt, double *vfilt) {

    double *a, *F, *b, *H, *var, *V, *G, *R, *P;
    double logl=0.0, prod;
    int Nyz, NyzNyz, NyNz, NzNz, Nz1, incpred=0, incvpred=0, info=0, t, i;

    Nyz = Ny+Nz;
    NyzNyz = Nyz*Nyz;
    NyNz = Ny*Nz;
    NzNz = Nz*Nz;
    Nz1 = Nz+1;

    /* If specified, pointers pred and vpred will be incremented by incpred and incvpred
       to save data from each iteration. If not specified, allocate memory for vector pred
       and matrix vpred, and leave zero increments */
    if (pred) incpred = Nz;
    else pred = (double *)mxCalloc(Nz, sizeof(double));
    if (vpred) incvpred = NzNz;
    else vpred = (double *)mxCalloc(NzNz, sizeof(double));

    /* initialize pred and vpred */
    if (z0)
        cblas_dcopy(Nz, z0, one, pred, one);
    else {
        cblas_dcopy(Nz, a_all, one, pred, one);
        dlins(Nz, one, F_all, pred, &info);
    }
    if (vz0)
        cblas_dcopy(NzNz, vz0, one, vpred, one);
    else {
        dlyap(Nz, F_all, var_all, Nyz, vpred, &info);
        if ( info > 0 ) {
            double million=1e6;
            cblas_dcopy(NzNz, &zero_d, zero, vpred, one);
            cblas_daxpy(Nz, one_d, &million, zero, vpred, Nz1);
        }
    }

    /* allocate memory for temporary variables */
    a   = (double *) mxCalloc(Nz,     sizeof(double));
    F   = (double *) mxCalloc(NzNz,   sizeof(double));
    b   = (double *) mxCalloc(Ny,     sizeof(double));
    H   = (double *) mxCalloc(NyNz,   sizeof(double));
    var = (double *) mxCalloc(NyzNyz, sizeof(double));
    P   = (double *) mxCalloc(NzNz,   sizeof(double));
    /* var = [V G; G' R] */
    V = var;          /* V(t) = Var(eta(t)) */
    G = var+Nyz*Nz;   /* G(t) = Cov(eta(t),eps(t)) */
    R = G+Nz;         /* R(t) = Var(eps(t)) */

    for (t=0; t<T; t++) {
        /* H = H_all(:,:,t) */
        cblas_dcopy(NyNz, &H_all[t*incH], one, H, one);
        /* b = b_all(:,t) */
        cblas_dcopy(Ny, &b_all[t*incb], one, b, one);
        /* b = -H*pred-b */
        cblas_dgemv(CblasColMajor, CblasNoTrans, Ny, Nz, mone_d, H, Ny, pred, one, mone_d, b, one);
        /* b = data(:,t)+b */
        cblas_daxpy(Ny, one_d, &data[t*Ny], one, b, one);
      /* P = vpred */
        cblas_dcopy(NzNz, vpred, one, P, one);
        /* P = chol(P)' */
      dpotrf(chl, &Nz, P, &Nz, &info);
        /* H = H*P */
        cblas_dtrmm(CblasColMajor, CblasRight, CblasLower, CblasNoTrans, CblasNonUnit, Ny, Nz, one_d, P, Nz, H, Ny);
        /* var = var_all(:,:,t) */
        cblas_dcopy(NyzNyz, &var_all[t*incvar], one, var, one);
        /* R = H*H'+R */
        cblas_dsyrk(CblasColMajor, CblasLower, CblasNoTrans, Ny, Nz, one_d, H, Ny, one_d, R, Nyz);
        /* R = chol(R)' */
        dpotrf(chl, &Ny, R, &Nyz, &info);
        /* b = R\b */
        cblas_dtrsv(CblasColMajor, CblasLower, CblasNoTrans, CblasNonUnit, Ny, R, Nyz, b, one);
        /* logl += 2*log(prod(diag(R)))+b'*b */
        prod = R[0];
        for (i=1; i<Ny; i++)
            prod *= R[i*(Nyz+1)];
        logl += 2*log(prod)+cblas_ddot(Ny, b, one, b, one);
        if (t<T-1 || lead>0) {
            /* F = F_all(:,:,t) */
            cblas_dcopy(NzNz, &F_all[t*incF], one, F, one);
            /* a = a_all(:,t) */
            cblas_dcopy(Nz, &a_all[t*inca], one, a, one);
            /* a = F*pred+a */
            cblas_dgemv(CblasColMajor, CblasNoTrans, Nz, Nz, one_d, F, Nz, pred, one, one_d, a, one);
            /* F = F*P */
            cblas_dtrmm(CblasColMajor, CblasRight, CblasLower, CblasNoTrans, CblasNonUnit, Nz, Nz, one_d, P, Nz, F, Nz);
            /* G = F*H'+G */
            cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, Nz, Ny, Nz, one_d, F, Nz, H, Ny, one_d, G, Nyz);
            /* G = G/R' */
            cblas_dtrsm(CblasColMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, Nz, Ny, one_d, R, Nyz, G, Nyz);
            /* a = G*b+a */
            cblas_dgemv(CblasColMajor, CblasNoTrans, Nz, Ny, one_d, G, Nyz, b, one, one_d, a, one);
            /* V = F*F'+V */
            cblas_dsyrk(CblasColMajor, CblasLower, CblasNoTrans, Nz, Nz, one_d, F, Nz, one_d, V, Nyz);
            /* V = -G*G'+V */
            cblas_dsyrk(CblasColMajor, CblasLower, CblasNoTrans, Nz, Ny, mone_d, G, Nyz, one_d, V, Nyz);
        }
        if (filt || vfilt) {
            /* H = H*P' */
            cblas_dtrmm(CblasColMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, Ny, Nz, one_d, P, Nz, H, Ny);
            /* H = R\H */
            cblas_dtrsm(CblasColMajor, CblasLeft, CblasLower, CblasNoTrans, CblasNonUnit, Ny, Nz, one_d, R, Nyz, H, Ny);
            if (filt) {
                /* filt = pred */
                cblas_dcopy(Nz, pred, one, filt, one);
                /* filt = H'*b+filt */
                cblas_dgemv(CblasColMajor, CblasTrans, Ny, Nz, one_d, H, Ny, b, one, one_d, filt, one);
                /* increment filt */
                filt += Nz;
            }
            if (vfilt) {
                /* vfilt = vpread */
                cblas_dcopy(NzNz, vpred, one, vfilt, one);
                /* vfilt = -H'*H+vfilt */
                cblas_dsyrk(CblasColMajor, CblasLower, CblasTrans, Nz, Ny, mone_d, H, Ny, one_d, vfilt, Nz);
                /* vfilt = tril(vfilt)+tril(vfilt,-1)' */
                dtril(Nz, vfilt, Nz);
                /* increment vfilt */
                vfilt += NzNz;
            }
        }
        if (t<T-1 || lead>0) {
            /* pred(:,t+1) = a */
            if (incpred) pred += incpred;
            cblas_dcopy(Nz, a, one, pred, one);
            /* vpred(:,:,t+1) = tril(V)+tril(V,-1)' */
            if (incvpred) vpred += incvpred;
            for (i=0; i<Nz; i++)
                cblas_dcopy(Nz, &V[i], Nyz, &vpred[i], Nz);
            dtril(Nz, vpred, Nz);
        }
    }
    if (lead>1 && (incpred || incvpred)) {
        for (t=T+1; t<T+lead; t++) {
            /* F = F_all(:,:,t) */
            cblas_dcopy(NzNz, &F_all[t*incF], one, F, one);
            /* a = a_all(:,t) */
            cblas_dcopy(Nz, &a_all[t*inca], one, a, one);
            /* a = F*pred+a */
            cblas_dgemv(CblasColMajor, CblasNoTrans, Nz, Nz, one_d, F, Nz, pred, one, one_d, a, one);
            /* pred(:,t) = a */
            if (incpred) pred += incpred;
            cblas_dcopy(Nz, a, one, pred, one);
            /* P = vpred */
            cblas_dcopy(NzNz, vpred, one, P, one);
            /* P = chol(P)' */
            dpotrf(chl, &Nz, P, &Nz, &info);
            /* F = F*P */
            cblas_dtrmm(CblasColMajor, CblasRight, CblasLower, CblasNoTrans, CblasNonUnit, Nz, Nz, one_d, P, Nz, F, Nz);
            /* var = var_all(:,:,t) */
            cblas_dcopy(NyzNyz, &var_all[t*incvar], one, var, one);
            /* vpred = V */
            if (incvpred) vpred += incvpred;
            for (i=0; i<Nz; i++)
                cblas_dcopy(Nz, &V[i], Nyz, &vpred[i], Nz);
            /* vpred = F*F'+vpred */
            cblas_dsyrk(CblasColMajor, CblasLower, CblasNoTrans, Nz, Nz, one_d, F, Nz, one_d, vpred, Nz);
            dtril(Nz, vpred, Nz);
        }
    }

    logl = -(Ny*log(2*PI)+logl/T)/2;

    if (!incpred) mxFree(pred);
    if (!incvpred) mxFree(vpred);
    mxFree(a);
    mxFree(F);
    mxFree(b);
    mxFree(H);
    mxFree(var);
    mxFree(P);
    return (logl);
}
#undef PI

为完整起见,mex编译的输出为:

    >> mex -v -R2018a kalcvf/kalcvf.c kalcvf/dlyap.c kalcvf/matlib.c -lmwblas -lmwlapack
Verbose mode is on.
... Looking for compiler 'gcc' ...
... Executing command 'which gcc' ...Yes ('/usr/bin/gcc').
... Executing command 'gcc -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so').
Found installed compiler 'gcc'.
Options file details
-------------------------------------------------------------------
    Compiler location: /usr/bin/gcc
    Options file: /home/lukas/.matlab/R2018a/mex_C_glnxa64.xml
    CMDLINE2 : /usr/bin/gcc -pthread -Wl,--no-undefined -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/glnxa64 -shared  -O -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_8846989578426_15298/kalcvf.o /tmp/mex_8846989578426_15298/dlyap.o /tmp/mex_8846989578426_15298/matlib.o /tmp/mex_8846989578426_15298/c_mexapi_version.o   -lmwblas  -lmwlapack   -L"/usr/local/MATLAB/R2018a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o kalcvf.mexa64
    CC : /usr/bin/gcc
    DEFINES : -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE 
    MATLABMEX : -DMATLAB_MEX_FILE 
    CFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread
    INCLUDE : -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include"
    COPTIMFLAGS : -O -DNDEBUG
    CDEBUGFLAGS : -g
    LD : /usr/bin/gcc
    LDFLAGS : -pthread -Wl,--no-undefined -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/glnxa64
    LDTYPE : -shared 
    FUNCTIONMAP : "/usr/local/MATLAB/R2018a/extern/lib/glnxa64/mexFunction.map"
    VERSIONMAP : "/usr/local/MATLAB/R2018a/extern/lib/glnxa64/c_exportsmexfileversion.map"
    LINKEXPORT : -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/mexFunction.map"
    LINKEXPORTVER : -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/c_exportsmexfileversion.map"
    LINKLIBS : -lmwblas  -lmwlapack   -L"/usr/local/MATLAB/R2018a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++
    LDOPTIMFLAGS : -O
    LDDEBUGFLAGS : -g
    MWCPPLIB : "/usr/local/MATLAB/R2018a/sys/os/glnxa64/libstdc++.so.6"
    OBJEXT : .o
    LDEXT : .mexa64
    SETENV : CC="/usr/bin/gcc"
                CXX="g++"
                CFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                CXXFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                COPTIMFLAGS="-O -DNDEBUG"
                CXXOPTIMFLAGS="-O -DNDEBUG"
                CDEBUGFLAGS="-g"
                CXXDEBUGFLAGS="-g"
                LD="/usr/bin/gcc"
                LDXX="g++"
                LDFLAGS="-pthread -Wl,--no-undefined -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/glnxa64 -shared  -lmwblas  -lmwlapack   -L"/usr/local/MATLAB/R2018a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/mexFunction.map""
                LDDEBUGFLAGS="-g"
    GCC : /usr/bin/gcc
    CPPLIBS : /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so
    MATLABROOT : /usr/local/MATLAB/R2018a
    ARCH : glnxa64
    SRC : "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/kalcvf.c";"/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c";"/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/matlib.c";"/usr/local/MATLAB/R2018a/extern/version/c_mexapi_version.c"
    OBJ : /tmp/mex_8846989578426_15298/kalcvf.o;/tmp/mex_8846989578426_15298/dlyap.o;/tmp/mex_8846989578426_15298/matlib.o;/tmp/mex_8846989578426_15298/c_mexapi_version.o
    OBJS : /tmp/mex_8846989578426_15298/kalcvf.o /tmp/mex_8846989578426_15298/dlyap.o /tmp/mex_8846989578426_15298/matlib.o /tmp/mex_8846989578426_15298/c_mexapi_version.o 
    SRCROOT : /home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/kalcvf
    DEF : /tmp/mex_8846989578426_15298/kalcvf.def
    EXP : "kalcvf.exp"
    LIB : "kalcvf.lib"
    EXE : kalcvf.mexa64
    ILK : "kalcvf.ilk"
    MANIFEST : "kalcvf.mexa64.manifest"
    TEMPNAME : kalcvf
    EXEDIR : 
    EXENAME : kalcvf
    OPTIM : -O -DNDEBUG
    LINKOPTIM : -O
    CMDLINE1_0 : /usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/kalcvf.c" -o /tmp/mex_8846989578426_15298/kalcvf.o
    CMDLINE1_1 : /usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c" -o /tmp/mex_8846989578426_15298/dlyap.o
    CMDLINE1_2 : /usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/matlib.c" -o /tmp/mex_8846989578426_15298/matlib.o
    CMDLINE1_3 : /usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/usr/local/MATLAB/R2018a/extern/version/c_mexapi_version.c" -o /tmp/mex_8846989578426_15298/c_mexapi_version.o
-------------------------------------------------------------------
Building with 'gcc'.
Warning: You are using gcc version '7.4.0'. The version of gcc is not supported. The version
currently supported with MEX is '6.3.x'. For a list of currently supported compilers see:
https://www.mathworks.com/support/compilers/current_release. 
/usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/kalcvf.c" -o /tmp/mex_8846989578426_15298/kalcvf.o
/usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c" -o /tmp/mex_8846989578426_15298/dlyap.o
/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c: In function ‘dlyap’:
/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:102:24: warning: ‘) is 0. The factorization has been completed, but Uis exactly singular. Division by 0 will occur if you use the factor U for solving a system of linear equations.’ directive output truncated writing 162 bytes into a region of size between 76 and 96 [-Wformat-truncation=]
       snprintf(msg,101,"u(%d,%d) is 0. The factorization has been completed, but U"
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:103:56: note: format string is defined here
       snprintf(msg,101,"u(%d,%d) is 0. The factorization has been completed, but U"
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "is exactly singular. Division by 0 will occur if you use the factor "
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
          "U for solving a system of linear equations.", info[0], info[0]);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
In file included from /usr/include/stdio.h:862:0,
                 from /usr/local/MATLAB/R2018a/extern/include/mex.h:194,
                 from /home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/matlib.h:4,
                 from /home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:33:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 168 and 188 bytes into a destination of size 101
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:165:24: warning: ‘ and ’ directive output truncated writing 5 bytes into a region of size 0 [-Wformat-truncation=]
       snprintf(msg,101,"The algorithm has failed to find all the eigenvalues after "
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:166:55: note: format string is defined here
          "a total %d iterations. Elements 1,2, ..., %d and %d, %d,"
                                                       ^~~~~
In file included from /usr/include/stdio.h:862:0,
                 from /usr/local/MATLAB/R2018a/extern/include/mex.h:194,
                 from /home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/matlib.h:4,
                 from /home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/dlyap.c:33:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 211 and 261 bytes into a destination of size 101
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/home/lukas/Documents/PhD/Econometrics/Matlab_mex_files/kalcvf/matlib.c" -o /tmp/mex_8846989578426_15298/matlib.o
/usr/bin/gcc -c -DMX_COMPAT_64  -DMATLAB_MEXCMD_RELEASE=R2018a  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "/usr/local/MATLAB/R2018a/extern/version/c_mexapi_version.c" -o /tmp/mex_8846989578426_15298/c_mexapi_version.o
/usr/bin/gcc -pthread -Wl,--no-undefined -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/glnxa64 -shared  -O -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_8846989578426_15298/kalcvf.o /tmp/mex_8846989578426_15298/dlyap.o /tmp/mex_8846989578426_15298/matlib.o /tmp/mex_8846989578426_15298/c_mexapi_version.o   -lmwblas  -lmwlapack   -L"/usr/local/MATLAB/R2018a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o kalcvf.mexa64
MEX completed successfully.

0 个答案:

没有答案
相关问题