Failed linking when ts library enabled on MinGW 4.9.2 (Bug #4108)


Added by Claudio Caraffi about 10 years ago. Updated about 10 years ago.


Status:Done Start date:2015-01-08
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:-
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description

If I do not disable the ts library, I get the linking errors reported in attachment.
I am using MinGW 4.9.2 on X64 targeting 32bit
undefined reference to `cv::theRNG()
undefined reference to `cv::setNumThreads(int)'
undefined reference to `cvErrorStr'
undefined reference to `cvGetTickCount'
undefined reference to `cv::getTickFrequency()'
undefined reference to `cv::swap(cv::Mat&, cv::Mat&)'
undefined reference to `cv::matchTemplate(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int)'
undefined reference to `cv::ocl::PlatformInfo::~PlatformInfo()'

Note:
- tbb is activated
- ipp is deactivated (See comments here http://answers.opencv.org/question/40159/cannot-compile-opencv-30/)


tsRelatedLinkingErrors.txt (62.1 kB) Claudio Caraffi, 2015-01-08 12:02 pm


Associated revisions

Revision 01c3ed61
Added by Vadim Pisarevsky over 9 years ago

Merge pull request #4108 from Reen:patch-1

History

Updated by Claudio Caraffi about 10 years ago

To be more precise: library ts can be created, what trigger the linking error is activating BUILD_TESTS/BUILD_PERF_TESTS (Which are disabled if the ts library is not built).

It's an error in the order in which the library are listed in the command line. See the 2 version below. The first is the repository one and fails, the second works, by placing linking to opencv_ts library before the other opencv libraries.

cmd.exe /C "cd . && C:\Programs\MinGW\bin\c++.exe -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Winit-self -Wpointer-arith -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-undef -Wno-shadow -O2 -DNDEBUG -DNDEBUG modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_main.cpp.obj modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_superres.cpp.obj -o bin/opencv_test_superres.exe -Wl,--out-implib,bin\libopencv_test_superres.dll.a -Wl,--major-image-version,0,--minor-image-version,0 lib/libopencv_core300.dll.a lib/libopencv_imgproc300.dll.a lib/libopencv_imgcodecs300.dll.a lib/libopencv_video300.dll.a lib/libopencv_videoio300.dll.a lib/libopencv_superres300.dll.a lib/libopencv_ts300.a lib/libopencv_highgui300.dll.a -ltbb -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

cmd.exe /C "cd . && C:\Programs\MinGW\bin\c++.exe -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Winit-self -Wpointer-arith -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-undef -Wno-shadow -O2 -DNDEBUG -DNDEBUG modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_main.cpp.obj modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_superres.cpp.obj -o bin/opencv_test_superres.exe -Wl,--out-implib,bin\libopencv_test_superres.dll.a -Wl,--major-image-version,0,--minor-image-version,0 lib/libopencv_ts300.a lib/libopencv_core300.dll.a lib/libopencv_imgproc300.dll.a lib/libopencv_imgcodecs300.dll.a lib/libopencv_video300.dll.a lib/libopencv_videoio300.dll.a lib/libopencv_superres300.dll.a lib/libopencv_highgui300.dll.a -ltbb -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

See related question http://answers.opencv.org/question/52926/changing-order-of-library-linking-for-opencv-tests/

Updated by Claudio Caraffi about 10 years ago

I think I have found a solution (editing OpenCVModule.cmake), I am preparing a pull request.

Updated by Claudio Caraffi about 10 years ago

  • % Done changed from 0 to 30
  • Target version set to 3.0

Updated by Claudio Caraffi about 10 years ago

  • % Done changed from 30 to 80

Updated by Claudio Caraffi about 10 years ago

  • % Done changed from 80 to 100
  • Status changed from New to Done

Also available in: Atom PDF