2

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
halfer
  • 19,824
  • 17
  • 99
  • 186
  • Welcome, please take the [tour]. We need the complete output, not just the error message. The last command the `make` issued is the most important. – Vladimir F Героям слава Apr 04 '19 at 05:52
  • It seems a apart of Openblas was built with gfortran. The names of a few of the Makefile variable suggest you're trying to use CUDA. What compilers are you using? – evets Apr 04 '19 at 06:15
  • Thank you for your replies. I was able to fix the problem by adding ```-lgfortran``` to ```ADD_LFLAGS```. – einmalistkeinmal Apr 05 '19 at 10:42
  • I had a similar problem when trying to use `lapack` library. Linking with `gfortran` library solved my problem, HOWEVER, make sure to place `gfortran` last in the list of linked libraries because the ordering matters. This was the tail of my command line: `-lm -llapacke -llapack -lrefblas -lgfortran`. When `-lgfortran` was first, linker gave me error. – Danijel Feb 04 '22 at 13:59

1 Answers1

3

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
Thomas
  • 676
  • 3
  • 18
  • I'm building my application in windows with Qt. Adding `win32: LIBS += -lgfortran` to `.pro` file fixed my problem. I'm using MinGW compiler. – Mohammad Rahimi Jul 20 '20 at 13:15