Ask Your Question

Undefined reference to _gfortran_concat_string

asked 2017-11-04 15:11:12 -0600


I'm trying to compile OpenCV 3.3.1 (also contrib 3.3.1) from source with LAPACK (OpenBLAS 0.2.20) on Windows 7 64bit with MinGW 7.2.0 and Cmake (GUI) 3.9.5.

I maneged to Configure and create MinGW Makefiles (setting openblas variables and turning of ENABLE_PRECOMPILED_HEADERS). To accomplish this I had to modify OpenCVFindLAPACK.cmake file here:


After generating MinGW files, I tried to make, but the following happens:

$ mingw32-make
[  0%] Built target gen-pkgconfig
[  1%] Built target zlib
[  3%] Built target libtiff
[  5%] Built target libjpeg
[ 10%] Built target libwebp
[ 11%] Built target libjasper
[ 12%] Built target libpng
[ 15%] Built target IlmImf
[ 18%] Built target libprotobuf
[ 18%] Linking CXX shared library ..\..\bin\libopencv_core331.dll
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormbr.o):sormbr.f:(.text+0x3d2): undefined reference to `_gfortran_concat_string'
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormbr.o):sormbr.f:(.text+0x5da): undefined reference to `_gfortran_concat_string'
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormbr.o):sormbr.f:(.text+0x653): undefined reference to `_gfortran_concat_string'
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormbr.o):sormbr.f:(.text+0x6d1): undefined reference to `_gfortran_concat_string'
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormlq.o):sormlq.f:(.text+0x30d): undefined reference to `_gfortran_concat_string'
C:/OpenBLAS-develop/build/lib/libopenblas.a(sormlq.o):sormlq.f:(.text+0x8b0): more undefined references to `_gfortran_concat_string' follow
C:/OpenBLAS-develop/build/lib/libopenblas.a(iparam2stage.o):iparam2stage.F:(.text+0x1be): undefined reference to `_gfortran_compare_string'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1791: bin/libopencv_core331.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2451: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

How can I do to libgfortran to sove this?

Or, is there other way to solve it?

Thanks in advance. :D

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-04 15:36:39 -0600

New users can't answer their own questions within 2 days... so I'll comment:

Adding -lgfortran to the end of this file C:\OpenCV\build\modules\core\CMakeFiles\opencv_core.dir\link.txt seems to solve the problem.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-11-04 15:11:12 -0600

Seen: 2,048 times

Last updated: Nov 04 '17