From: Michele Catalano on
Dear All,

I'm trying to compile a fortran source code with mex compiling options. I would introduce openMp statements to fasten the jobs. I'm using gfortran.

While I can compile by shell, when I compile with option file engopts.sh I get errors such as:

simulDSGEengProva.o: In function `MAIN__':
simulDSGEengProva.F90:(.text+0x9222): undefined reference to `GOMP_parallel_start'
simulDSGEengProva.F90:(.text+0x922f): undefined reference to `GOMP_parallel_end'
simulDSGEengProva.o: In function `MAIN__.omp_fn.0':
simulDSGEengProva.F90:(.text+0xa737): undefined reference to `omp_get_num_threads'
simulDSGEengProva.F90:(.text+0xa73e): undefined reference to `omp_get_thread_num'
collect2: ld returned 1 exit status

mex: link of 'simulDSGEengProva' failed.


I think it is due to compiler inability to link against some library, in particular that related with openMp i.e., libgomp.

I attach the options in engopts.sh file:

FC='/usr/bin/gfortran'
FFLAGS="$MFLAGS -fopenmp -fexceptions "
FLIBS="$RPATH $MLIBS -L/usr/lib/ -lm -lstdc++"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD="$COMPILER "
LDFLAGS=''
LDOPTIMFLAGS='-O'
LDDEBUGFLAGS='-g'


What could be the problem?

thanks in advance