1

I have a problem with the following code. The compilation of the .mex file is done, but when I try to run it from the matlab script , I receive an error like

Invalid MEX-file 'myfile.mexa64': 'myfile.mexa64' is not a valid shared library..

    mex CFLAGS="$CFLAGS -fopenmp -m64 -Ofast -fPIC --fast-math" ...
    CXXFLAGS="\$CXXFLAGS -fopenmp -m64 -Ofast -fPIC --fast-math" ...
    LDFLAGS="\$LDFLAGS -fopenmp" ...
    CXXOPTIMFLAGS="$CXXOPTIMFLAGS -fopenmp" ...
    -lgomp -lfftw3_omp -lfftw3 Fourier_CPU.cpp

    n_1 = 100; n_2 = 100; n_3 = 100;

    A = rand(n_1,n_2,n_3) + 1i*rand(n_1,n_2,n_3);

    fc = @() Fourier_CPU(A,n_1,n_2,n_3);
    B = fc();

The Fourier_CPU file is the .cpp file that calls some fftw functions. I NOTE that the code works correctly when I am running it on my laptop by gives the error above when I run it on a server. I think that this have to do something with the libraries linking, but I am not sure what's the problem. Any help will be appreciated a lot.

Ilias
  • 31
  • 5

0 Answers0