Search code examples
fortrangfortranmxnetopenblas

How to fix 'undefined reference to _gfortran_concat_string and to _gfortran_etime when building MXNET?


I am trying to build MXNET from this repo https://github.com/mahyarnajibi/SNIPER/tree/cvpr3k. I have cuda, cudnn, and openblas installed. I build the code with the following command: make -j 8 USE_CUDA_PATH=/usr/local/cuda

The error message is as follows:

/usr/local/lib/libopenblas.so: undefined reference to `_gfortran_concat_string'
/usr/local/liblibopenblas.so: undefined reference to `_gfortran_etime'
collect2: error: ld returned 1 exit status
Makefile:454: recipe for target 'bin/im2rec' failed
make: *** [bin/im2rec] Error 1
make: *** Waiting for unfinished jobs....

My config.mk file has these settings for some relevant (i think) variables:

ADD_LDFLAGS=
ADD_CFLAGS=
USE_CUDA=1
USE_CUDNN=1
USE_OPENCV=1
USE_BLAS=openblas
USE_LAPACK=1

Solution

  • This is a linker error. As the author mentioned, this error can be solved by specifying gfortran in the LDFLAGS. Modify your config.mk to have:

    ADD_LDFLAGS=-lgfortran