opencv_ts links in gtest symbols which get pulled in by opencv.pc (Bug #3225)
Description
The ts module links in gtest (ts_gtest.cpp). The gtest symbols then get exported in libopencv_ts.so
The default opencv.pc file has -lopencv_ts, which effectively causes opencv to export the google test framework symbols.
This causes problems when trying to build our own unit tests using a different version of gtest, or a version of gtest compiled with different flags, as the opencv gtest symbols interfere with ours.
Our current workaround is to not use opencv.pc, and manually specify the libraries to link against.
Suggest using a custom namespace for opencv's version of gtest, or not including -lopencv_ts in the default opencv.pc file.
Associated revisions
Merge pull request #3225 from jormansa:bug_#3631
History
Updated by Dinar Ahmatnurov over 11 years ago
Roman, please take a look
- Assignee set to Roman Donchenko
Updated by Roman Donchenko over 11 years ago
Agreed, this is a Bad Thing. I don't think I'll be able to change this in 2.4 (for compatibility reasons), but I'll try to do something in master.
- Status changed from New to Open
Updated by Roman Donchenko over 11 years ago
- Target version set to 3.0-alpha
Updated by Maksim Shabunin almost 10 years ago
- Target version changed from 3.0-alpha to 3.0
Updated by Maksim Shabunin almost 10 years ago
- Assignee changed from Roman Donchenko to Maksim Shabunin
- Category changed from ts to build/install
- Difficulty set to Medium
- Affected version changed from 2.4.6 (latest release) to branch 'master' (3.0-dev)
Updated by Maksim Shabunin almost 10 years ago
Should be fixed in https://github.com/Itseez/opencv/pull/4032
ts module is marked INTERNAL -> not represented in pkg-config file
- Status changed from Open to Done
- Pull request set to https://github.com/Itseez/opencv/pull/4032
Updated by Pavel Rojtberg almost 10 years ago
this effectively drops the ts module for external usage. at least I found the ts module very convenient as it did not require to pull in another testing framework. a different fix could be:
change
# define GTEST_API_ CV_EXPORTS
to
# define GTEST_API_
i.e. not exporting the gtest symbols in the first place.
Updated by Pavel Rojtberg almost 10 years ago
never mind. this is not as easy to fix as I thought: as the ts module is static CV_EXPORTS wont help and making it shared will introduce a different set of errors..