Ask Your Question

Revision history [back]

Undefined reference to _gfortran_concat_string

Hi!

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:

try_compile(__VALID_LAPACK
    "${OpenCV_BINARY_DIR}"
    "${OpenCV_SOURCE_DIR}/cmake/checks/lapack_check.cpp"
    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${LAPACK_INCLUDE_DIR}\;${CMAKE_BINARY_DIR}"
                "-DLINK_DIRECTORIES:STRING=${LAPACK_LINK_LIBRARIES}"
                "-DLINK_LIBRARIES:STRING=${LAPACK_LIBRARIES}\;-lgfortran"
    OUTPUT_VARIABLE TRY_OUT
)

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